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 101 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
39 changes: 19 additions & 20 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"
"os"

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand All @@ -16,29 +17,40 @@ import (
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
"github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/capability"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer"
ibctransferkeeper "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/keeper"
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
ibc "github.com/cosmos/cosmos-sdk/x/ibc/core"
ibcclient "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/05-port/types"
Expand All @@ -47,44 +59,30 @@ import (
ibcmock "github.com/cosmos/cosmos-sdk/x/ibc/testing/mock"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
"github.com/cosmos/cosmos-sdk/x/slashing"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/regen-network/regen-ledger/types/module/server"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

// types
sdk "github.com/cosmos/cosmos-sdk/types"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/CosmWasm/wasmd/x/wasm"
"github.com/regen-network/regen-ledger/types/module/server"
)

const (
Expand Down Expand Up @@ -320,6 +318,7 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest

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

var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))

Expand Down
6 changes: 3 additions & 3 deletions app/experimental_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
"github.com/cosmos/cosmos-sdk/x/gov"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

moduletypes "github.com/regen-network/regen-ledger/types/module"
"github.com/regen-network/regen-ledger/types/module/server"
data "github.com/regen-network/regen-ledger/x/data/module"
Expand Down
1 change: 1 addition & 0 deletions app/stable_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"

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

Expand Down
5 changes: 0 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ 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=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
Expand Down Expand Up @@ -895,7 +894,6 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
Expand All @@ -905,7 +903,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
Expand All @@ -914,7 +911,6 @@ gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
Expand All @@ -924,7 +920,6 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
Expand Down
59 changes: 39 additions & 20 deletions types/module/server/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,34 @@ 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
initGenesisHandlers map[string]module.InitGenesisHandler
exportGenesisHandlers map[string]module.ExportGenesisHandler
baseApp *baseapp.BaseApp
cdc *codec.ProtoCodec
keys map[string]ModuleKey
router *router
requiredServices map[reflect.Type]bool
initGenesisHandlers map[string]module.InitGenesisHandler
exportGenesisHandlers map[string]module.ExportGenesisHandler
registerInvariantsHandler map[string]RegisterInvariantsHandler
}

// RegisterInvariants registers all module routes and module querier routes
func (mm *Manager) RegisterInvariants(ir sdk.InvariantRegistry) {
for _, invariant := range mm.registerInvariantsHandler {
if invariant != nil {
invariant(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{},
initGenesisHandlers: map[string]module.InitGenesisHandler{},
exportGenesisHandlers: map[string]module.ExportGenesisHandler{},
baseApp: baseApp,
cdc: cdc,
keys: map[string]ModuleKey{},
registerInvariantsHandler: map[string]RegisterInvariantsHandler{},
initGenesisHandlers: map[string]module.InitGenesisHandler{},
exportGenesisHandlers: map[string]module.ExportGenesisHandler{},
router: &router{
handlers: map[string]handler{},
providedServices: map[reflect.Type]bool{},
Expand Down Expand Up @@ -105,6 +116,7 @@ func (mm *Manager) RegisterModules(modules []module.Module) error {
}

serverMod.RegisterServices(cfg)
mm.registerInvariantsHandler[name] = cfg.registerInvariantsHandler
mm.initGenesisHandlers[name] = cfg.initGenesisHandler
mm.exportGenesisHandlers[name] = cfg.exportGenesisHandler

Expand Down Expand Up @@ -211,15 +223,18 @@ func exportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, exportGenesisHandle
return genesisData, 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
initGenesisHandler module.InitGenesisHandler
exportGenesisHandler module.ExportGenesisHandler
msgServer gogogrpc.Server
queryServer gogogrpc.Server
key *rootModuleKey
cdc codec.Marshaler
requiredServices map[reflect.Type]bool
router sdk.Router
initGenesisHandler module.InitGenesisHandler
exportGenesisHandler module.ExportGenesisHandler
registerInvariantsHandler RegisterInvariantsHandler
}

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

func (c *configurator) RegisterInvariantsHandler(registry RegisterInvariantsHandler) {
c.registerInvariantsHandler = registry
}
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved

func (c *configurator) RegisterGenesisHandlers(initGenesisHandler module.InitGenesisHandler, exportGenesisHandler module.ExportGenesisHandler) {
c.initGenesisHandler = initGenesisHandler
c.exportGenesisHandler = exportGenesisHandler
Expand Down
2 changes: 2 additions & 0 deletions types/module/server/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkmodule "github.com/cosmos/cosmos-sdk/types/module"

"github.com/regen-network/regen-ledger/types/module"
)

Expand All @@ -20,6 +21,7 @@ type Configurator interface {
ModuleKey() RootModuleKey
Marshaler() codec.Marshaler
RequireServer(interface{})
RegisterInvariantsHandler(registry RegisterInvariantsHandler)
RegisterGenesisHandlers(module.InitGenesisHandler, module.ExportGenesisHandler)

// Router() is temporarily added here to use in the group module.
Expand Down
3 changes: 1 addition & 2 deletions types/module/server/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"fmt"
"testing"

"github.com/regen-network/regen-ledger/testutil"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
Expand All @@ -20,6 +18,7 @@ import (
dbm "github.com/tendermint/tm-db"
"google.golang.org/grpc"

"github.com/regen-network/regen-ledger/testutil"
regentypes "github.com/regen-network/regen-ledger/types"
"github.com/regen-network/regen-ledger/types/module"
)
Expand Down
3 changes: 1 addition & 2 deletions x/data/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package server_test
import (
"testing"

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

"github.com/stretchr/testify/suite"

"github.com/regen-network/regen-ledger/types/module"
"github.com/regen-network/regen-ledger/types/module/server"
datamodule "github.com/regen-network/regen-ledger/x/data/module"
"github.com/regen-network/regen-ledger/x/data/server/testsuite"
Expand Down
3 changes: 1 addition & 2 deletions x/data/server/testsuite/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package testsuite
import (
"context"

"github.com/regen-network/regen-ledger/testutil"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/suite"

"github.com/regen-network/regen-ledger/testutil"
"github.com/regen-network/regen-ledger/x/data"
)

Expand Down
3 changes: 2 additions & 1 deletion x/group/client/testsuite/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"fmt"
"strconv"

tmcli "github.com/tendermint/tendermint/libs/cli"

"github.com/regen-network/regen-ledger/testutil/cli"
"github.com/regen-network/regen-ledger/x/group"
"github.com/regen-network/regen-ledger/x/group/client"
tmcli "github.com/tendermint/tendermint/libs/cli"
)

func (s *IntegrationTestSuite) TestQueryGroupInfo() {
Expand Down
8 changes: 3 additions & 5 deletions x/group/client/testsuite/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@ import (
"strings"
"testing"

tmcli "github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
banktestutil "github.com/cosmos/cosmos-sdk/x/bank/client/testutil"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/suite"
tmcli "github.com/tendermint/tendermint/libs/cli"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/regen-network/regen-ledger/testutil/cli"
"github.com/regen-network/regen-ledger/testutil/network"

"github.com/regen-network/regen-ledger/x/group"
"github.com/regen-network/regen-ledger/x/group/client"
"github.com/stretchr/testify/suite"
)

type IntegrationTestSuite struct {
Expand Down
Loading