From a01a5d24d1fa648dfbd08792a7632b41ee354482 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 5 Sep 2024 04:15:42 +0000 Subject: [PATCH] Add gov module to the chain (#56) Part of [Add gov module to laconicd](https://www.notion.so/Add-gov-module-to-laconicd-938c9f5f87634b4fbd7896d3907fb89e) Co-authored-by: IshaVenikar Reviewed-on: https://git.vdb.to/cerc-io/laconicd/pulls/56 Co-authored-by: Prathamesh Musale Co-committed-by: Prathamesh Musale --- app/app.go | 12 ++++++++++++ app/app.yaml | 9 +++++++-- go.mod | 2 ++ go.sum | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index ae4ae6baf..98dba6499 100644 --- a/app/app.go +++ b/app/app.go @@ -34,6 +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" @@ -80,6 +85,7 @@ type LaconicApp struct { StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper DistrKeeper distrkeeper.Keeper + GovKeeper *govkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper ConsensusParamsKeeper consensuskeeper.Keeper @@ -110,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, + }, + ), }, ), ) @@ -147,6 +158,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 56fcbe31c..75fae7f00 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] - 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 a41ec79a5..5761c4769 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 900b830ec..de99cde17 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=