From 213eb9218345692db8cf81335b05b81360d50fca Mon Sep 17 00:00:00 2001 From: sontrinh16 Date: Thu, 5 Sep 2024 11:01:46 +0700 Subject: [PATCH 1/4] remove ics --- app/app.go | 103 ++++---------------------------- app/upgrades/v1.1.6/constant.go | 3 + app/upgrades/v1.1.6/upgrade.go | 12 ++++ 3 files changed, 28 insertions(+), 90 deletions(-) create mode 100644 app/upgrades/v1.1.6/constant.go create mode 100644 app/upgrades/v1.1.6/upgrade.go diff --git a/app/app.go b/app/app.go index 6cd7ff5a..ae49a5c6 100644 --- a/app/app.go +++ b/app/app.go @@ -95,21 +95,8 @@ import ( tmos "github.com/tendermint/tendermint/libs/os" dbm "github.com/tendermint/tm-db" - ibcprovider "github.com/cosmos/interchain-security/x/ccv/provider" - ibcproviderclient "github.com/cosmos/interchain-security/x/ccv/provider/client" - ibcproviderkeeper "github.com/cosmos/interchain-security/x/ccv/provider/keeper" - providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" - "github.com/onomyprotocol/onomy/app/upgrades" - v1_0_1 "github.com/onomyprotocol/onomy/app/upgrades/v1.0.1" - v1_0_3 "github.com/onomyprotocol/onomy/app/upgrades/v1.0.3" - v1_0_3_4 "github.com/onomyprotocol/onomy/app/upgrades/v1.0.3.4" - v1_0_3_5 "github.com/onomyprotocol/onomy/app/upgrades/v1.0.3.5" - v1_1_1 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.1" - v1_1_2 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.2" - v1_1_4 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.4" - v1_1_5 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.5" - v1_1_5_fix "github.com/onomyprotocol/onomy/app/upgrades/v1.1.5-fix" + v1_1_6 "github.com/onomyprotocol/onomy/app/upgrades/v1.1.6" "github.com/onomyprotocol/onomy/docs" "github.com/onomyprotocol/onomy/x/dao" daoclient "github.com/onomyprotocol/onomy/x/dao/client" @@ -136,9 +123,6 @@ func getGovProposalHandlers() []govclient.ProposalHandler { ibcclientclient.UpgradeProposalHandler, daoclient.FundTreasuryProposalHandler, daoclient.ExchangeWithTreasuryProposalProposalHandler, - ibcproviderclient.ConsumerAdditionProposalHandler, - ibcproviderclient.ConsumerRemovalProposalHandler, - ibcproviderclient.EquivocationProposalHandler, ) return govProposalHandlers @@ -171,20 +155,18 @@ var ( transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, dao.AppModuleBasic{}, - ibcprovider.AppModuleBasic{}, ) // module account permissions. maccPerms = map[string][]string{ // nolint:gochecknoglobals // cosmos-sdk application style - authtypes.FeeCollectorName: nil, - daotypes.ModuleName: {authtypes.Minter}, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - providertypes.ConsumerRewardsPool: nil, + authtypes.FeeCollectorName: nil, + daotypes.ModuleName: {authtypes.Minter}, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, } // module accounts that are allowed to receive tokens. @@ -252,7 +234,6 @@ type OnomyApp struct { TransferKeeper ibctransferkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper AuthzKeeper authzkeeper.Keeper - ProviderKeeper ibcproviderkeeper.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper @@ -296,7 +277,6 @@ func New( // nolint:funlen // app new cosmos func minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey, - providertypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -323,7 +303,6 @@ func New( // nolint:funlen // app new cosmos func // grant capabilities for the ibc and ibc-transfer modules scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedIBCProviderKeeper := app.CapabilityKeeper.ScopeToModule(providertypes.ModuleName) // add keepers app.AccountKeeper = authkeeper.NewAccountKeeper( @@ -406,7 +385,6 @@ func New( // nolint:funlen // app new cosmos func stakingtypes.NewMultiStakingHooks( app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), - app.ProviderKeeper.Hooks(), ), ) @@ -417,29 +395,9 @@ func New( // nolint:funlen // app new cosmos func } }) - app.ProviderKeeper = ibcproviderkeeper.NewKeeper( - appCodec, - keys[providertypes.StoreKey], - app.GetSubspace(providertypes.ModuleName), - scopedIBCProviderKeeper, - app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, - app.IBCKeeper.ConnectionKeeper, - app.IBCKeeper.ClientKeeper, - app.StakingKeeper, - app.SlashingKeeper, - app.AccountKeeper, - app.EvidenceKeeper, - app.DistrKeeper, - app.BankKeeper, - authtypes.FeeCollectorName, - ) - providerModule := ibcprovider.NewAppModule(&app.ProviderKeeper) - // Create static IBC router, add transfer route, then set and seal it ibcRouter := ibcporttypes.NewRouter() ibcRouter.AddRoute(ibctransfertypes.ModuleName, ibcmodule) - ibcRouter.AddRoute(providertypes.ModuleName, providerModule) app.IBCKeeper.SetRouter(ibcRouter) // register the proposal types @@ -449,8 +407,7 @@ func New( // nolint:funlen // app new cosmos func AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)). - AddRoute(daotypes.RouterKey, dao.NewProposalHandler(app.DaoKeeper)). - AddRoute(providertypes.RouterKey, ibcprovider.NewProviderProposalHandler(app.ProviderKeeper)) + AddRoute(daotypes.RouterKey, dao.NewProposalHandler(app.DaoKeeper)) app.GovKeeper = govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, @@ -489,7 +446,6 @@ func New( // nolint:funlen // app new cosmos func authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), transferModule, dao.NewAppModule(appCodec, app.DaoKeeper), - providerModule, ) // During begin block slashing happens after distr.BeginBlocker so that @@ -516,7 +472,6 @@ func New( // nolint:funlen // app new cosmos func vestingtypes.ModuleName, feegrant.ModuleName, daotypes.ModuleName, - providertypes.ModuleName, ) app.mm.SetOrderEndBlockers( upgradetypes.ModuleName, @@ -538,7 +493,6 @@ func New( // nolint:funlen // app new cosmos func vestingtypes.ModuleName, feegrant.ModuleName, daotypes.ModuleName, - providertypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -566,7 +520,6 @@ func New( // nolint:funlen // app new cosmos func vestingtypes.ModuleName, feegrant.ModuleName, daotypes.ModuleName, - providertypes.ModuleName, ) app.mm.RegisterInvariants(&app.CrisisKeeper) @@ -623,7 +576,6 @@ func New( // nolint:funlen // app new cosmos func app.SetEndBlocker(app.EndBlocker) app.setupUpgradeHandlers() - app.SetupForkLogic(v1_1_5_fix.CreateFork(&app.StakingKeeper, &app.ProviderKeeper, keys[providertypes.StoreKey])) if loadLatest { if err := app.LoadLatestVersion(); err != nil { @@ -633,7 +585,6 @@ func New( // nolint:funlen // app new cosmos func app.ScopedIBCKeeper = scopedIBCKeeper app.ScopedTransferKeeper = scopedTransferKeeper - app.ScopedIBCProviderKeeper = scopedIBCProviderKeeper return app } @@ -692,9 +643,6 @@ func (app *OnomyApp) BlockedAddrs() map[string]bool { blockedAddrs[authtypes.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc] } - // For ICS multiden fix - delete(blockedAddrs, authtypes.NewModuleAddress(providertypes.ConsumerRewardsPool).String()) - return blockedAddrs } @@ -803,7 +751,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibchost.ModuleName) paramsKeeper.Subspace(daotypes.ModuleName) - paramsKeeper.Subspace(providertypes.ModuleName) return paramsKeeper } @@ -814,27 +761,7 @@ func (app *OnomyApp) SimulationManager() *module.SimulationManager { } func (app *OnomyApp) setupUpgradeHandlers() { - app.UpgradeKeeper.SetUpgradeHandler(v1_0_1.Name, v1_0_1.UpgradeHandler) - app.UpgradeKeeper.SetUpgradeHandler(v1_0_3.Name, v1_0_3.UpgradeHandler) - app.UpgradeKeeper.SetUpgradeHandler(v1_0_3_4.Name, v1_0_3_4.UpgradeHandler) - app.UpgradeKeeper.SetUpgradeHandler(v1_0_3_5.Name, v1_0_3_5.UpgradeHandler) - // we need to have the reference to `app` which is why we need this `func` here - app.UpgradeKeeper.SetUpgradeHandler( - v1_1_1.Name, - func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - for moduleName, eachModule := range app.mm.Modules { - fromVM[moduleName] = eachModule.ConsensusVersion() - } - - // This is critical for the chain upgrade to work - app.ProviderKeeper.InitGenesis(ctx, providertypes.DefaultGenesisState()) - - return app.mm.RunMigrations(ctx, app.configurator, fromVM) - }, - ) - app.UpgradeKeeper.SetUpgradeHandler(v1_1_2.Name, v1_1_2.UpgradeHandler) - app.UpgradeKeeper.SetUpgradeHandler(v1_1_4.Name, v1_1_4.UpgradeHandler) - app.UpgradeKeeper.SetUpgradeHandler(v1_1_5.Name, v1_1_5.CreateUpgradeHandler(app.mm, app.configurator, &app.AccountKeeper, &app.BankKeeper, &app.StakingKeeper)) + app.UpgradeKeeper.SetUpgradeHandler(v1_1_6.Name, v1_1_6.UpgradeHandler) upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() if err != nil { @@ -849,13 +776,9 @@ func (app *OnomyApp) setupUpgradeHandlers() { var storeUpgrades *storetypes.StoreUpgrades switch upgradeInfo.Name { - case v1_1_1.Name: - storeUpgrades = &storetypes.StoreUpgrades{ - Added: []string{providertypes.ModuleName, providertypes.StoreKey}, - } - case v1_1_4.Name: + case v1_1_6.Name: storeUpgrades = &storetypes.StoreUpgrades{ - Added: []string{authz.ModuleName, authzkeeper.StoreKey}, + Deleted: []string{"provider"}, } default: // no store upgrades diff --git a/app/upgrades/v1.1.6/constant.go b/app/upgrades/v1.1.6/constant.go new file mode 100644 index 00000000..6c4c91a2 --- /dev/null +++ b/app/upgrades/v1.1.6/constant.go @@ -0,0 +1,3 @@ +package v1_1_6 //nolint:revive,stylecheck // app version + +const Name = "v1.1.6" diff --git a/app/upgrades/v1.1.6/upgrade.go b/app/upgrades/v1.1.6/upgrade.go new file mode 100644 index 00000000..c0f5e6cc --- /dev/null +++ b/app/upgrades/v1.1.6/upgrade.go @@ -0,0 +1,12 @@ +package v1_1_6 //nolint:revive,stylecheck // app version + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +// UpgradeHandler is an x/upgrade handler. +func UpgradeHandler(_ sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return vm, nil +} From ccdc681ee09d8bcc4b578c5e6899a7b2311d6f0e Mon Sep 17 00:00:00 2001 From: vuong177 Date: Mon, 9 Sep 2024 18:45:26 +0700 Subject: [PATCH 2/4] bump go version --- .github/workflows/ci.yml | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74b1947f..0687d740 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: ^1.19 + go-version: ^1.21 id: go - name: Install Rust components run: | diff --git a/go.mod b/go.mod index 84c71cb1..a5bd7b1f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/onomyprotocol/onomy -go 1.19 +go 1.21 require ( github.com/cosmos/cosmos-sdk v0.45.16-ics From a7e8d45f2427caa7dc031ba377e11cf8ab6c624d Mon Sep 17 00:00:00 2001 From: vuong177 Date: Tue, 10 Sep 2024 17:03:33 +0700 Subject: [PATCH 3/4] tidy --- .github/workflows/automated-release.yml | 2 +- .github/workflows/ci.yml | 2 +- go.mod | 2 +- go.sum | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index 9fc66fc3..9d818bb4 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: ^1.19 + go-version: ^1.22 id: go - name: Checkout code diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0687d740..fefd25b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: ^1.21 + go-version: ^1.22 id: go - name: Install Rust components run: | diff --git a/go.mod b/go.mod index a5bd7b1f..490f498b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/onomyprotocol/onomy -go 1.21 +go 1.22 require ( github.com/cosmos/cosmos-sdk v0.45.16-ics diff --git a/go.sum b/go.sum index a9021200..04228632 100644 --- a/go.sum +++ b/go.sum @@ -1197,6 +1197,7 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= 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/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= @@ -2306,6 +2307,7 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/oxyno-zeta/gomock-extra-matcher v1.1.0 h1:Yyk5ov0ZPKBXtVEeIWtc4J2XVrHuNoIK+0F2BUJgtsc= +github.com/oxyno-zeta/gomock-extra-matcher v1.1.0/go.mod h1:UMGTHYEmJ1dRq8LDZ7VTAYO4nqM3GD1UGC3RJEUxEz0= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -3059,6 +3061,7 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -3591,6 +3594,7 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 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= From 90abdf11c4f03737fbcc01af0433cba6a9574567 Mon Sep 17 00:00:00 2001 From: vuong177 Date: Thu, 12 Sep 2024 23:38:25 +0700 Subject: [PATCH 4/4] fix broken CI --- .github/workflows/automated-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index 9d818bb4..966cef1d 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -30,6 +30,7 @@ jobs: release_name: ${{ github.ref }} draft: false prerelease: true + allowUpdates: true # build & upload onomyd