From 812a06915fd41f545c8ca7f641aea4cd07a05e60 Mon Sep 17 00:00:00 2001 From: zemyblue Date: Mon, 23 May 2022 15:54:03 +0900 Subject: [PATCH] apply lbm-sdk v0.46.0-rc1 (#62) * apply lbm-sdk v0.46.0-rc1 - added x/foundation module - add index field in to TxResponse * doc: add the changes of this pr. Signed-off-by: zemyblue * chore: remove unnecessary code. Signed-off-by: zemyblue --- CHANGELOG.md | 5 ++++- app/app.go | 39 +++++++++++++++++++++------------------ cli_test/test_helpers.go | 5 ++++- go.mod | 4 ++-- go.sum | 14 ++++++++++---- 5 files changed, 41 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab893606..0457a4eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,8 +36,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +This version based on lbm-sdk v0.46.0 + ### Features -* (cosmos-sdk) [\#56](https://github.com/line/lbm/pull/56) bump up cosmos-sdk v0.45.1 +* (cosmos-sdk) [\#56](https://github.com/line/lbm/pull/56) bump up cosmos-sdk v0.45.1 +* (x/foundation) [\#62](https://github.com/line/lbm/pull/62) add `x/foundation` module of lbm-sdk ### Improvements diff --git a/app/app.go b/app/app.go index 82d97708..2361ab8f 100644 --- a/app/app.go +++ b/app/app.go @@ -49,10 +49,6 @@ import ( "github.com/line/lbm-sdk/x/capability" capabilitykeeper "github.com/line/lbm-sdk/x/capability/keeper" capabilitytypes "github.com/line/lbm-sdk/x/capability/types" - "github.com/line/lbm-sdk/x/consortium" - consortiumclient "github.com/line/lbm-sdk/x/consortium/client" - consortiumkeeper "github.com/line/lbm-sdk/x/consortium/keeper" - consortiummodule "github.com/line/lbm-sdk/x/consortium/module" "github.com/line/lbm-sdk/x/crisis" crisiskeeper "github.com/line/lbm-sdk/x/crisis/keeper" crisistypes "github.com/line/lbm-sdk/x/crisis/types" @@ -66,6 +62,10 @@ import ( "github.com/line/lbm-sdk/x/feegrant" feegrantkeeper "github.com/line/lbm-sdk/x/feegrant/keeper" feegrantmodule "github.com/line/lbm-sdk/x/feegrant/module" + "github.com/line/lbm-sdk/x/foundation" + foundationclient "github.com/line/lbm-sdk/x/foundation/client" + foundationkeeper "github.com/line/lbm-sdk/x/foundation/keeper" + foundationmodule "github.com/line/lbm-sdk/x/foundation/module" "github.com/line/lbm-sdk/x/genutil" genutiltypes "github.com/line/lbm-sdk/x/genutil/types" "github.com/line/lbm-sdk/x/gov" @@ -95,7 +95,7 @@ import ( "github.com/line/lbm-sdk/x/staking" stakingkeeper "github.com/line/lbm-sdk/x/staking/keeper" stakingtypes "github.com/line/lbm-sdk/x/staking/types" - "github.com/line/lbm-sdk/x/stakingplus" + stakingplusmodule "github.com/line/lbm-sdk/x/stakingplus/module" "github.com/line/lbm-sdk/x/token" "github.com/line/lbm-sdk/x/token/class" classkeeper "github.com/line/lbm-sdk/x/token/class/keeper" @@ -128,15 +128,15 @@ var ( genutil.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, - staking.AppModuleBasic{}, + stakingplusmodule.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, - consortiummodule.AppModuleBasic{}, + foundationmodule.AppModuleBasic{}, gov.NewAppModuleBasic( append( wasmclient.ProposalHandlers, - consortiumclient.UpdateConsortiumParamsProposalHandler, - consortiumclient.UpdateValidatorAuthsProposalHandler, + foundationclient.UpdateFoundationParamsProposalHandler, + foundationclient.UpdateValidatorAuthsProposalHandler, paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, @@ -163,6 +163,8 @@ var ( maccPerms = map[string][]string{ authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, + foundation.TreasuryName: nil, + foundation.AdministratorName: nil, minttypes.ModuleName: {authtypes.Minter}, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, @@ -204,7 +206,7 @@ type LinkApp struct { // nolint: golint SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper - ConsortiumKeeper consortiumkeeper.Keeper + FoundationKeeper foundationkeeper.Keeper GovKeeper govkeeper.Keeper CrisisKeeper crisiskeeper.Keeper UpgradeKeeper upgradekeeper.Keeper @@ -268,7 +270,7 @@ func NewLinkApp( ibctransfertypes.StoreKey, capabilitytypes.StoreKey, feegrant.StoreKey, - consortium.StoreKey, + foundation.StoreKey, class.StoreKey, token.StoreKey, wasm.StoreKey, @@ -329,7 +331,8 @@ func NewLinkApp( ) app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) - app.ConsortiumKeeper = consortiumkeeper.NewKeeper(appCodec, keys[consortium.StoreKey], stakingKeeper) + foundationConfig := foundation.DefaultConfig() + app.FoundationKeeper = foundationkeeper.NewKeeper(appCodec, keys[foundation.StoreKey], app.BaseApp.MsgServiceRouter(), app.AccountKeeper, app.BankKeeper, stakingKeeper, authtypes.FeeCollectorName, foundationConfig) classKeeper := classkeeper.NewKeeper(appCodec, keys[class.StoreKey]) app.TokenKeeper = tokenkeeper.NewKeeper(appCodec, keys[token.StoreKey], app.AccountKeeper, classKeeper) @@ -407,7 +410,7 @@ func NewLinkApp( AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)). - AddRoute(consortium.RouterKey, consortiumkeeper.NewProposalHandler(app.ConsortiumKeeper)). + AddRoute(foundation.RouterKey, foundationkeeper.NewProposalHandler(app.FoundationKeeper)). AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, wasm.EnableAllProposals)) govKeeper := govkeeper.NewKeeper( @@ -445,12 +448,12 @@ func NewLinkApp( capability.NewAppModule(appCodec, *app.CapabilityKeeper), crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - consortiummodule.NewAppModule(appCodec, app.ConsortiumKeeper, app.StakingKeeper), + foundationmodule.NewAppModule(appCodec, app.FoundationKeeper, app.StakingKeeper), gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - stakingplus.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.ConsortiumKeeper), + stakingplusmodule.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.FoundationKeeper), upgrade.NewAppModule(app.UpgradeKeeper), wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper), evidence.NewAppModule(app.EvidenceKeeper), @@ -469,6 +472,7 @@ func NewLinkApp( upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, + foundation.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, evidencetypes.ModuleName, @@ -484,7 +488,6 @@ func NewLinkApp( vestingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, - consortium.ModuleName, token.ModuleName, wasm.ModuleName, ) @@ -507,7 +510,7 @@ func NewLinkApp( vestingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, - consortium.ModuleName, + foundation.ModuleName, token.ModuleName, wasm.ModuleName, ) @@ -540,7 +543,7 @@ func NewLinkApp( vestingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, - consortium.ModuleName, + foundation.ModuleName, token.ModuleName, // wasm after ibc transfer wasm.ModuleName, diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 25ee3c2c..99b202d9 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -57,6 +57,7 @@ import ( wasmcli "github.com/line/lbm-sdk/x/wasm/client/cli" wasmtypes "github.com/line/lbm-sdk/x/wasm/types" + ostcmd "github.com/line/ostracon/cmd/ostracon/commands" ostcfg "github.com/line/ostracon/config" ostflags "github.com/line/ostracon/libs/cli/flags" "github.com/line/ostracon/libs/log" @@ -141,6 +142,8 @@ func init() { server.ShowValidatorCmd(), server.ShowAddressCmd(), server.VersionCmd(), + ostcmd.ResetAllCmd, + ostcmd.ResetStateCmd, ) } @@ -352,7 +355,7 @@ func getCliCtx(f *Fixtures) client.Context { // UnsafeResetAll is lbm unsafe-reset-all func (f *Fixtures) UnsafeResetAll(flags ...string) { - cmd := server.UnsafeResetAllCmd() + cmd := ostcmd.ResetAllCmd _, err := testcli.ExecTestCLICmd(getCliCtx(f), cmd, addFlags("", flags...)) require.NoError(f.T, err) diff --git a/go.mod b/go.mod index 5c59d7f6..47f5fe3f 100644 --- a/go.mod +++ b/go.mod @@ -5,12 +5,12 @@ go 1.15 require ( github.com/google/gofuzz v1.2.0 // indirect github.com/gorilla/mux v1.8.0 - github.com/line/lbm-sdk v0.46.0-rc0 + github.com/line/lbm-sdk v0.46.0-rc1 github.com/line/ostracon v1.0.5 github.com/line/tm-db/v2 v2.0.0-init.1.0.20220121012851-61d2bc1d9486 github.com/prometheus/client_golang v1.12.1 github.com/rakyll/statik v0.1.7 - github.com/spf13/cast v1.4.1 + github.com/spf13/cast v1.5.0 github.com/spf13/cobra v1.4.0 github.com/spf13/viper v1.11.0 github.com/stretchr/testify v1.7.1 diff --git a/go.sum b/go.sum index 3aa614e5..86e53929 100644 --- a/go.sum +++ b/go.sum @@ -339,6 +339,8 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= @@ -687,8 +689,9 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -711,8 +714,8 @@ github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55 h1:cXVtMiJkvQ4kn0px github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55/go.mod h1:DHRJroSL7NaRkpvocRx3OtRsleXVsYSxBI9SfHFlTQ0= github.com/line/iavl/v2 v2.0.0-init.1.0.20220215225951-cb11c91d8857 h1:8kWqbLNeb37357e4U/7uLMVCRF3K9bxwTGb6JmRUKpI= github.com/line/iavl/v2 v2.0.0-init.1.0.20220215225951-cb11c91d8857/go.mod h1:uK2CYRdukSVRGhc5Q8zoDUnm/zAbfnZATbFXrfCrQKA= -github.com/line/lbm-sdk v0.46.0-rc0 h1:UQdjT/Te5uu35sINrKIb0+A/05hXq3Gg+0iCg9PMwFU= -github.com/line/lbm-sdk v0.46.0-rc0/go.mod h1:zbPQ4QMG9BYwm+38ntDzTkbHQb2lASowSPAYsJSFAqg= +github.com/line/lbm-sdk v0.46.0-rc1 h1:au29/L4aGQIewcYdV64AXfC58HwSrsxxn/m4LvOh5Hk= +github.com/line/lbm-sdk v0.46.0-rc1/go.mod h1:RTjbLeeSxSoNYLG9v8s5f9iOOQqZMxoTv3QWJdnZpdo= github.com/line/ostracon v0.34.9-0.20210429084710-ef4fe0a40c7d/go.mod h1:ttnbq+yQJMQ9a2MT5SEisOoa/+pOgh2KenTiK/rVdiw= github.com/line/ostracon v1.0.5 h1:fHTbmFbpF2zu8yqggntoxMYnpTQknaimgw2pWDOVESg= github.com/line/ostracon v1.0.5/go.mod h1:Xeu8AXIcWUmQ80AQMgM+m5PGiVHaIVW8wa66KgF46ZU= @@ -955,6 +958,8 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= @@ -997,8 +1002,9 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=