From f7799b199927e7194c29aed8dc14251b81a53d95 Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Mon, 21 Aug 2023 16:37:18 -0600 Subject: [PATCH 1/6] set v12 upgrade handler --- .drone.yml | 28 ++++-------- app/upgrades.go | 78 ++-------------------------------- scripts/ci/upgrade/proposal.sh | 6 +-- 3 files changed, 14 insertions(+), 98 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5ead886b1..eb7c2f782 100644 --- a/.drone.yml +++ b/.drone.yml @@ -77,12 +77,12 @@ steps: password: from_secret: docker_password tags: - - v11.0.0-beta.2 + - 12.0.0-alpha.1 when: event: - push branch: - - jhernandezb/remove-spm-dep + - jhernandezb/v12-upgrade - name: docker_release image: plugins/docker settings: @@ -244,7 +244,7 @@ steps: trigger: branch: - - main + - release/v12.x event: - pull_request - push @@ -313,7 +313,7 @@ steps: environment: GOPROXY: http://goproxy - name: stargaze - image: publicawesome/stargaze:10.0.1 + image: publicawesome/stargaze:11.0.0 commands: - ./scripts/ci/upgrade/setup-preinstalled-stargaze.sh environment: @@ -345,12 +345,12 @@ steps: commands: - /bin/bash ./scripts/ci/transfer-relayer.sh - name: proposal - image: publicawesome/stargaze:10.0.1 + image: publicawesome/stargaze:11.0.0 commands: - ./scripts/ci/upgrade/proposal.sh - name: stargaze-upgraded pull: always - image: publicawesome/stargaze:v11.0.0-beta.2 + image: publicawesome/stargaze:12.0.0-alpha.1 commands: - ./scripts/ci/upgrade/run-upgrade.sh environment: @@ -367,18 +367,6 @@ steps: - http://gaia:26657 - http://osmosis:26657 - http://icad:26657 - - name: check-params - pull: always - image: publicawesome/stargaze:v11.0.0-beta.2 - commands: - - starsd q mint params --node http://stargaze-upgraded:26657 - - starsd q alloc params --node http://stargaze-upgraded:26657 - - starsd q tokenfactory params --node http://stargaze-upgraded:26657 - - starsd q bank balances stars1mnyrspq208uv5m2krdctan2dkyht0szje9s43h --node http://stargaze-upgraded:26657 - - starsd q bank balances stars103y4f6h80lc45nr8chuzr3fyzqywm9n0gnr394 --node http://stargaze-upgraded:26657 - - starsd q distribution community-pool --node http://stargaze-upgraded:26657 - environment: - GOPROXY: http://goproxy - name: relayer-upgrade-start image: publicawesome/hermes:0.15.0 commands: @@ -405,7 +393,7 @@ steps: trigger: branch: - - main + - release/v12.x event: - pull_request - push @@ -416,6 +404,6 @@ volumes: --- kind: signature -hmac: 080a970b32e1116f813eb85afec92aa95a77ec11f20da1baafc48d40a9a99c6f +hmac: a41a2d807eb0a057b55afc2f3a5addc67d3df8923eca45ce85d548a495b01a25 ... diff --git a/app/upgrades.go b/app/upgrades.go index bdbf553be..558d3f454 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -2,20 +2,15 @@ package app import ( "fmt" - "time" store "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - allocmoduletypes "github.com/public-awesome/stargaze/v12/x/alloc/types" - ibchooks "github.com/public-awesome/stargaze/v12/x/ibchooks/types" - tokenfactorytypes "github.com/public-awesome/stargaze/v12/x/tokenfactory/types" ) // next upgrade name -const upgradeName = "v11" +const upgradeName = "v12" // RegisterUpgradeHandlers returns upgrade handlers func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { @@ -25,75 +20,8 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { if err != nil { return nil, err } - - // Following param changes reflect what was approved by prop 165 and combined in a single upgrade for Prop 1-3 - // https://www.mintscan.io/stargaze/proposals/165 - // 1- Reduce Emissions to 711k daily this is done by adjusting mint params - // 2- Introduce a new Supplement Amount and Redirect Funds for the next 6 months - // requiring future proposals to refill the module account - // 3- Stop funding community pool and nft incentive allocation - // at the same time this code allows re-enabling incentive allocation - // through param change proposals only - - // change mint params to include the new supplement amount - // and store it back to the keeper - mintParams := app.MintKeeper.GetParams(ctx) - // 259.7M to the upgrade happening on the 11th of July 2023 - mintParams.InitialAnnualProvisions = sdk.NewDec(259_700_000_000_000) - // reset to 2023-01-01 so there is a thirdening happening on next January 1 - mintParams.StartTime = time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC) - // update blocks per year using 5.9 s avg block time - mintParams.BlocksPerYear = 5345036 - app.MintKeeper.SetParams(ctx, mintParams) - denom := app.MintKeeper.GetParams(ctx).MintDenom - - // token factory params - params := app.TokenFactoryKeeper.GetParams(ctx) - // 10k STARS - params.DenomCreationFee = sdk.NewCoins(sdk.NewInt64Coin(denom, 10_000_000_000)) - - app.TokenFactoryKeeper.SetParams(ctx, params) - - // set community tax to 0 since the allocation module will now take care of it - // making an accurate allocation of the inflation - distributionParams := app.DistrKeeper.GetParams(ctx) - distributionParams.CommunityTax = sdk.ZeroDec() - app.DistrKeeper.SetParams(ctx, distributionParams) - - // change alloc params to set nft incentives to 0% until incentives are live - allocParams := app.AllocKeeper.GetParams(ctx) - - // distribution proportions - proportions := allocParams.DistributionProportions - proportions.NftIncentives = sdk.ZeroDec() // nft incentives to 0% - proportions.CommunityPool = sdk.NewDecWithPrec(5, 2) // 5% community pool - - allocParams.DistributionProportions = proportions - // supplement amount from the specific module account - // set to 100k STARS daily ~= 6.82 STARS per block using same 5.9s avg block time - allocParams.SupplementAmount = sdk.NewCoins(sdk.NewInt64Coin(denom, 6_828_704)) // 6.9 STARS per block - app.AllocKeeper.SetParams(ctx, allocParams) - - // check if the account was previously created if that's the case reset it - supplementPoolAddress := authtypes.NewModuleAddress(allocmoduletypes.SupplementPoolName) - if app.AccountKeeper.HasAccount(ctx, supplementPoolAddress) { - account := app.AccountKeeper.GetAccount(ctx, supplementPoolAddress) - app.AccountKeeper.RemoveAccount(ctx, account) - } - // create module account - supplmentPoolAccount := app.AccountKeeper.GetModuleAccount(ctx, allocmoduletypes.SupplementPoolName) - - fundAmount := sdk.NewInt64Coin(denom, 18_300_000_000_000) // 18M STARS - // if there is not enough founds skip - if app.DistrKeeper.GetFeePoolCommunityCoins(ctx).AmountOf(denom).LT(sdk.NewDecCoinFromCoin(fundAmount).Amount) { - return migrations, nil - } - err = app.DistrKeeper.DistributeFromFeePool(ctx, sdk.NewCoins(fundAmount), supplmentPoolAccount.GetAddress()) - if err != nil { - return nil, err - } - return migrations, nil + }) upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() @@ -103,7 +31,7 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := store.StoreUpgrades{ - Added: []string{tokenfactorytypes.ModuleName, ibchooks.StoreKey}, + Added: []string{}, } // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) diff --git a/scripts/ci/upgrade/proposal.sh b/scripts/ci/upgrade/proposal.sh index 16f5ce45d..6b7e707ea 100755 --- a/scripts/ci/upgrade/proposal.sh +++ b/scripts/ci/upgrade/proposal.sh @@ -22,10 +22,10 @@ HEIGHT=$(starsd status --node http://stargaze:26657 --home $STARGAZE_HOME | jq . echo "current height $HEIGHT" HEIGHT=$(expr $HEIGHT + 20) echo "submit with height $HEIGHT" -starsd tx gov submit-proposal software-upgrade v11 --upgrade-height $HEIGHT \ +starsd tx gov submit-proposal software-upgrade v12 --upgrade-height $HEIGHT \ --deposit 1000000000ustars \ ---description "v11 Upgrade" \ ---title "v11 Upgrade" \ +--description "v12 Upgrade" \ +--title "v12 Upgrade" \ --gas-prices 1ustars --gas auto --gas-adjustment 1.5 --from validator \ --chain-id stargaze -b block --yes --node http://stargaze:26657 --home $STARGAZE_HOME --keyring-backend test From 01eb8332d0e2a5cadd4180a402ee6ce64fdb097d Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Mon, 21 Aug 2023 16:44:57 -0600 Subject: [PATCH 2/6] format and sleep --- app/upgrades.go | 1 - scripts/ci/setup-relayer.sh | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/upgrades.go b/app/upgrades.go index 558d3f454..9c6d80205 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -21,7 +21,6 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { return nil, err } return migrations, nil - }) upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() diff --git a/scripts/ci/setup-relayer.sh b/scripts/ci/setup-relayer.sh index 20defb325..cf8981798 100755 --- a/scripts/ci/setup-relayer.sh +++ b/scripts/ci/setup-relayer.sh @@ -5,6 +5,7 @@ hermes keys add stargaze -f $PWD/scripts/ci/hermes/stargaze.json hermes keys add gaia -f $PWD/scripts/ci/hermes/gaia.json hermes keys add osmosis -f $PWD/scripts/ci/hermes/osmosis.json hermes keys add icad -f $PWD/scripts/ci/hermes/icad.json +sleep 5 hermes create connection stargaze gaia hermes create connection stargaze osmosis hermes create connection stargaze icad From 502fce083dada40e07ed28c8c751ecd4f1c732eb Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Mon, 21 Aug 2023 16:57:24 -0600 Subject: [PATCH 3/6] add store migration --- app/upgrades.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/upgrades.go b/app/upgrades.go index 9c6d80205..8532e1283 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4/router/types" ) // next upgrade name @@ -30,7 +31,9 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := store.StoreUpgrades{ - Added: []string{}, + Added: []string{ + packetforwardtypes.StoreKey, + }, } // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) From db719242ea841d83b190bc34d32d1afc602bb1c5 Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Mon, 21 Aug 2023 17:01:02 -0600 Subject: [PATCH 4/6] run on release --- .github/workflows/interchaintest.yml | 46 ++++++++++++++++------------ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/.github/workflows/interchaintest.yml b/.github/workflows/interchaintest.yml index 89c47f60f..c7ae091fe 100644 --- a/.github/workflows/interchaintest.yml +++ b/.github/workflows/interchaintest.yml @@ -1,13 +1,14 @@ name: Run InterchainTest -on: +on: pull_request: branches: - main - + - release/v12.x + release: types: published - + workflow_dispatch: jobs: @@ -22,7 +23,7 @@ jobs: - name: Set up Golang uses: actions/setup-go@v3 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -33,7 +34,7 @@ jobs: context: . tags: publicawesome/stargaze:local-dev outputs: type=docker,dest=/tmp/sg.tar - + - name: Upload the Docker image # Uploading as artifact so that all the tests which run as different jobs can use this image uses: actions/upload-artifact@v3 with: @@ -54,7 +55,7 @@ jobs: - name: Set up Golang uses: actions/setup-go@v3 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - name: Build Interchaintest run: make interchaintest @@ -62,41 +63,47 @@ jobs: - name: Upload binary as artifact # Uploading as artifact so that all the tests which run as different jobs can use this binary uses: actions/upload-artifact@v3 with: - name: interchaintest - path: ./bin/interchaintest - retention-days: 1 + name: interchaintest + path: ./bin/interchaintest + retention-days: 1 run_gaia_interchaintest: name: gaia โš›๏ธ - needs: [build_interchaintest,build_sg_image] + needs: [build_interchaintest, build_sg_image] uses: ./.github/workflows/interchaintest_runner.yml with: - test-matrix: 'interchain_test/gaia.matrix.json' + test-matrix: "interchain_test/gaia.matrix.json" run_osmosis_interchaintest: name: osmosis ๐Ÿงช - needs: [build_interchaintest,build_sg_image] + needs: [build_interchaintest, build_sg_image] uses: ./.github/workflows/interchaintest_runner.yml with: - test-matrix: 'interchain_test/osmosis.matrix.json' - + test-matrix: "interchain_test/osmosis.matrix.json" + run_icad_interchaintest: name: icad ๐Ÿ”— - needs: [build_interchaintest,build_sg_image] + needs: [build_interchaintest, build_sg_image] uses: ./.github/workflows/interchaintest_runner.yml with: - test-matrix: 'interchain_test/icad.matrix.json' + test-matrix: "interchain_test/icad.matrix.json" run_pfm_interchaintest: name: pfm โฉ needs: [build_sg_image] uses: ./.github/workflows/interchaintest_custom_runner.yml with: - test-cmd: 'test-pfm' + test-cmd: "test-pfm" cleanup: name: Delete artifacts ๐Ÿ—‘๏ธ - needs: [run_gaia_interchaintest,run_osmosis_interchaintest,run_icad_interchaintest,run_pfm_interchaintest] + needs: + [ + run_gaia_interchaintest, + run_osmosis_interchaintest, + run_icad_interchaintest, + run_pfm_interchaintest, + ] runs-on: ubuntu-latest steps: @@ -105,10 +112,9 @@ jobs: with: name: interchaintest failOnError: false - + - name: Delete sg # Delete the stargaze docker image from workflow artifacts as its not needed anymore uses: geekyeggo/delete-artifact@v2 with: name: sg failOnError: false - \ No newline at end of file From f5c21684c12733423cbad765724d432c4f2a6bf7 Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Mon, 21 Aug 2023 17:14:22 -0600 Subject: [PATCH 5/6] startup check --- cmd/starsd/cmd/init.go | 6 ------ cmd/starsd/cmd/root.go | 1 + cmd/starsd/cmd/start.go | 6 ------ cmd/starsd/main.go | 19 ------------------- 4 files changed, 1 insertion(+), 31 deletions(-) diff --git a/cmd/starsd/cmd/init.go b/cmd/starsd/cmd/init.go index bfd52813a..1035d869e 100644 --- a/cmd/starsd/cmd/init.go +++ b/cmd/starsd/cmd/init.go @@ -100,12 +100,6 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { } } - if chainID == "big-bang-1" { - seeds = []string{ - "69666f77b6a2355fcfc64c9879520a352b62917e@45.55.57.176:36656", - } - } - // Override default settings in config.toml config.P2P.Seeds = strings.Join(seeds, ",") config.P2P.MaxNumInboundPeers = 120 diff --git a/cmd/starsd/cmd/root.go b/cmd/starsd/cmd/root.go index 213cd50e6..0b8c5f1bc 100644 --- a/cmd/starsd/cmd/root.go +++ b/cmd/starsd/cmd/root.go @@ -126,6 +126,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) wasm.AddModuleInitFlags(startCmd) + startCmd.PreRunE = chainPreRuns(CheckLibwasmVersion, startCmd.PreRunE) } func queryCommand() *cobra.Command { diff --git a/cmd/starsd/cmd/start.go b/cmd/starsd/cmd/start.go index 11b15b73f..a44417c31 100644 --- a/cmd/starsd/cmd/start.go +++ b/cmd/starsd/cmd/start.go @@ -3,7 +3,6 @@ package cmd import ( "fmt" - "github.com/CosmWasm/wasmd/x/wasm" wasmvmapi "github.com/CosmWasm/wasmvm" "github.com/spf13/cobra" ) @@ -21,11 +20,6 @@ func CheckLibwasmVersion(_ *cobra.Command, _ []string) error { return nil } -func CustomStart(startCmd *cobra.Command) { - wasm.AddModuleInitFlags(startCmd) - startCmd.PreRunE = chainPreRuns(CheckLibwasmVersion, startCmd.PreRunE) -} - type preRunFn func(cmd *cobra.Command, args []string) error func chainPreRuns(pfns ...preRunFn) preRunFn { diff --git a/cmd/starsd/main.go b/cmd/starsd/main.go index 970f64b80..3b62db569 100644 --- a/cmd/starsd/main.go +++ b/cmd/starsd/main.go @@ -9,25 +9,6 @@ import ( "github.com/public-awesome/stargaze/v12/cmd/starsd/cmd" ) -// func main() { -// rootCmd, _ := cosmoscmd.NewRootCmd( -// "stars", -// app.AccountAddressPrefix, -// app.DefaultNodeHome, -// app.Name, -// app.ModuleBasics, -// app.NewStargazeApp, -// cosmoscmd.AddSubCmd(cmd.TestnetCmd(app.ModuleBasics)), -// cosmoscmd.AddCustomInitCmd(cmd.InitCmd(app.ModuleBasics, app.DefaultNodeHome)), -// cosmoscmd.AddSubCmd(cmd.PrepareGenesisCmd(app.DefaultNodeHome, app.ModuleBasics)), -// cosmoscmd.CustomizeStartCmd(cmd.CustomStart), -// // this line is used by starport scaffolding # root/arguments -// ) -// if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { -// os.Exit(1) -// } -// } - func main() { rootCmd, _ := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { From 725d8d04683201c61aff522ffb1071d7f84f7bb2 Mon Sep 17 00:00:00 2001 From: jhernandezb Date: Mon, 21 Aug 2023 17:53:39 -0600 Subject: [PATCH 6/6] update timeouts --- e2e/packet_forward_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/packet_forward_test.go b/e2e/packet_forward_test.go index 312de5e0b..e715e1ba9 100644 --- a/e2e/packet_forward_test.go +++ b/e2e/packet_forward_test.go @@ -239,7 +239,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, chainA) + err = testutil.WaitForBlocks(ctx, 10, chainA) require.NoError(t, err) chainABalance, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom) @@ -313,7 +313,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainD, chainDHeight, chainDHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, chainA) + err = testutil.WaitForBlocks(ctx, 10, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -376,7 +376,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+25, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, chainA) + err = testutil.WaitForBlocks(ctx, 10, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -433,7 +433,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+25, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, chainA) + err = testutil.WaitForBlocks(ctx, 10, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -502,7 +502,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, chainA) + err = testutil.WaitForBlocks(ctx, 10, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -568,7 +568,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainB, chainBHeight, chainBHeight+10, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, chainB) + err = testutil.WaitForBlocks(ctx, 10, chainB) require.NoError(t, err) // assert balance for user controlled wallet @@ -626,7 +626,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 3, chainA) + err = testutil.WaitForBlocks(ctx, 10, chainA) require.NoError(t, err) // assert balances for user controlled wallets