From 28969fec1d77d3555f2109191e651459c323b3fc Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Thu, 22 Aug 2024 15:57:43 +0530 Subject: [PATCH 1/2] Enable governance module --- app/app.go | 4 ++++ app/app.yaml | 9 +++++++-- go.mod | 2 ++ go.sum | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index ae4ae6ba..8d89fbb1 100644 --- a/app/app.go +++ b/app/app.go @@ -34,6 +34,7 @@ import ( distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -48,6 +49,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/gov" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects @@ -80,6 +82,7 @@ type LaconicApp struct { StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper DistrKeeper distrkeeper.Keeper + GovKeeper *govkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper ConsensusParamsKeeper consensuskeeper.Keeper @@ -147,6 +150,7 @@ func NewLaconicApp( &app.StakingKeeper, &app.SlashingKeeper, &app.DistrKeeper, + &app.GovKeeper, &app.CrisisKeeper, &app.ConsensusParamsKeeper, &app.AuctionKeeper, diff --git a/app/app.yaml b/app/app.yaml index 56fcbe31..88920b62 100644 --- a/app/app.yaml +++ b/app/app.yaml @@ -7,10 +7,10 @@ modules: # there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant. # NOTE: staking module is required if HistoricalEntries param > 0 begin_blockers: [distribution, slashing, staking] - end_blockers: [crisis, staking, auction, registry] + end_blockers: [crisis, gov, staking, auction, registry] # NOTE: The genutils module must occur after staking so that pools are properly initialized with tokens from genesis accounts. # NOTE: The genutils module must also occur after auth so that it can access the params from auth. - init_genesis: [auth, bank, distribution, staking, slashing, crisis, genutil, auction, bond, registry, onboarding] + init_genesis: [auth, bank, distribution, staking, slashing, gov, crisis, genutil, auction, bond, registry, onboarding] override_store_keys: - module_name: auth kv_store_key: acc @@ -25,6 +25,8 @@ modules: permissions: [burner, staking] - account: not_bonded_tokens_pool permissions: [burner, staking] + - account: gov + permissions: [burner, staking] - account: auction - account: auction_burn - account: bond @@ -54,6 +56,9 @@ modules: - name: tx config: "@type": cosmos.tx.config.v1.Config + - name: gov + config: + "@type": cosmos.gov.module.v1.Module - name: crisis config: "@type": cosmos.crisis.module.v1.Module diff --git a/go.mod b/go.mod index a41ec79a..5761c476 100644 --- a/go.mod +++ b/go.mod @@ -68,6 +68,7 @@ require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect @@ -135,6 +136,7 @@ require ( github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.8.6 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 900b830e..de99cde1 100644 --- a/go.sum +++ b/go.sum @@ -164,10 +164,14 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -1124,6 +1128,7 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -- 2.45.2 From 946cb9d4f56f4aa121fcef00aa1326bb38b8c86b Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 22 Aug 2024 17:12:13 +0530 Subject: [PATCH 2/2] Handle gov module custom config --- app/app.go | 10 +++++++++- app/app.yaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 8d89fbb1..98dba649 100644 --- a/app/app.go +++ b/app/app.go @@ -34,7 +34,11 @@ import ( distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -49,7 +53,6 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects - _ "github.com/cosmos/cosmos-sdk/x/gov" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects @@ -113,6 +116,11 @@ func AppConfig() depinject.Config { // supply custom module basics map[string]module.AppModuleBasic{ genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + }, + ), }, ), ) diff --git a/app/app.yaml b/app/app.yaml index 88920b62..75fae7f0 100644 --- a/app/app.yaml +++ b/app/app.yaml @@ -26,7 +26,7 @@ modules: - account: not_bonded_tokens_pool permissions: [burner, staking] - account: gov - permissions: [burner, staking] + permissions: [burner] - account: auction - account: auction_burn - account: bond -- 2.45.2