From 80cfeaa4c7123e87de162b9d8038eacb7d7cbff4 Mon Sep 17 00:00:00 2001 From: Jorge Hernandez <3452489+jhernandezb@users.noreply.github.com> Date: Fri, 8 Apr 2022 12:12:18 -0600 Subject: [PATCH] v4 upgrade handler (#583) * add v4 upgrade handler * add upgrade to ci * update config to latest hermes * update config --- .drone.yml | 134 ++++++++++++++++++++++++++++++++- app/upgrades.go | 23 +----- scripts/ci/upgrade/config.toml | 7 +- scripts/ci/upgrade/proposal.sh | 15 ++-- 4 files changed, 147 insertions(+), 32 deletions(-) diff --git a/.drone.yml b/.drone.yml index 8b0bac05e..1dd91f60c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -248,7 +248,139 @@ volumes: node: runner: integration --- +kind: pipeline +type: docker +name: upgrade-integration-test +workspace: + path: /stargaze +steps: + - name: restore-cache + image: meltwater/drone-cache:dev + volumes: + - name: cache + path: /go + environment: + AWS_ACCESS_KEY_ID: + from_secret: minio_key_id + AWS_SECRET_ACCESS_KEY: + from_secret: minio_secret_key + pull: true + settings: + restore: true + bucket: + from_secret: minio_bucket + region: us-east-1 + mount: + - '/go/pkg/mod' + - name: build-wrapper + image: publicawesome/golang:1.18.0-devtooling + volumes: + - name: cache + path: /go + commands: + - mkdir -p /stargaze/bin/ + - CGO_ENABLED=0 go build -o /stargaze/bin/upgrade-watcher ./testutil/watcher/ + - chmod +x /stargaze/bin/upgrade-watcher + environment: + GOPROXY: http://goproxy + - name: gaia + image: publicawesome/gaia:6.0.0 + detach: true + commands: + - ./scripts/ci/setup-gaia.sh + environment: + GOPROXY: http://goproxy + - name: osmosis + image: publicawesome/osmosis:7.1.0 + detach: true + commands: + - ./scripts/ci/setup-osmosis.sh + environment: + GOPROXY: http://goproxy + - name: stargaze + image: publicawesome/stargaze:3.0.0 + commands: + - ./scripts/ci/upgrade/setup-preinstalled-stargaze.sh + environment: + GOPROXY: http://goproxy + detach: true + - name: readiness + image: publicawesome/stargaze-readiness-checker:latest + settings: + timeout: 300 + blocks: 10 + chain_list: + - http://stargaze:26657 + - http://gaia:26657 + - http://osmosis:26657 + - name: relayer + image: publicawesome/hermes:0.13.0 + commands: + - /bin/bash ./scripts/ci/setup-relayer.sh + + - name: relayer-start + image: publicawesome/hermes:0.13.0 + commands: + - /bin/bash ./scripts/ci/start-relayer.sh + detach: true + - name: relayer-sender + image: publicawesome/hermes:0.13.0 + commands: + - /bin/bash ./scripts/ci/transfer-relayer.sh + - name: proposal + image: publicawesome/stargaze:3.0.0 + commands: + - ./scripts/ci/upgrade/proposal.sh + - name: stargaze-upgraded + image: publicawesome/stargaze:latest + commands: + - ./scripts/ci/upgrade/run-upgrade.sh + environment: + GOPROXY: http://goproxy + detach: true + - name: readiness-upgrade + image: publicawesome/stargaze-readiness-checker:latest + settings: + timeout: 300 + blocks: 10 + chain_list: + - http://stargaze-upgraded:26657 + - http://gaia:26657 + - http://osmosis:26657 + - name: relayer-upgrade-start + image: publicawesome/hermes:0.13.0 + commands: + - /bin/bash ./scripts/ci/upgrade/start-relayer.sh + detach: true + - name: relayer-ugprade-sender + image: publicawesome/hermes:0.13.0 + commands: + - /bin/bash ./scripts/ci/upgrade/transfer-relayer.sh + - name: discord + image: appleboy/drone-discord + settings: + webhook_id: + from_secret: discord_webhook_id + webhook_token: + from_secret: discord_webhook_token + when: + status: [success, failure] + +trigger: + branch: + - main + event: + - pull_request + - push +volumes: +- name: cache + temp: {} +node: + runner: integration +depends_on: + - ibc-integration-test +--- kind: signature -hmac: 79fa65281bdbcc548e9581a4af196892a345f4c35e6b68122e76b9f475bb14ea +hmac: 90ae2c601fcc19fc7b9c54f6ac840aad550971fb5aa68957aa5f951ef9ed6f9b ... diff --git a/app/upgrades.go b/app/upgrades.go index dab65158e..d790f67e8 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -3,8 +3,6 @@ package app import ( "fmt" - "github.com/CosmWasm/wasmd/x/wasm" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" store "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -12,27 +10,12 @@ import ( ) // next upgrade name -const upgradeName = "v3" +const upgradeName = "v4" // RegisterUpgradeHandlers returns upgrade handlers func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { app.UpgradeKeeper.SetUpgradeHandler(upgradeName, func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - newVM, err := app.mm.RunMigrations(ctx, cfg, vm) - if err != nil { - return newVM, err - } - // consensus params - // increase max gas as part of the upgrade to handle cosmwam - consensusParams := app.BaseApp.GetConsensusParams(ctx) - consensusParams.Block.MaxGas = 75_000_000 // 75M - app.BaseApp.StoreConsensusParams(ctx, consensusParams) - - // wasm params - wasmParams := app.WasmKeeper.GetParams(ctx) - wasmParams.CodeUploadAccess = wasmtypes.AllowNobody - wasmParams.MaxWasmCodeSize = DefaultMaxWasmCodeSize - app.WasmKeeper.SetParams(ctx, wasmParams) - return newVM, err + return app.mm.RunMigrations(ctx, cfg, vm) }) upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() @@ -42,7 +25,7 @@ func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) { if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := store.StoreUpgrades{ - Added: []string{wasm.ModuleName}, + 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/config.toml b/scripts/ci/upgrade/config.toml index b4ddaa761..e2a1932f7 100644 --- a/scripts/ci/upgrade/config.toml +++ b/scripts/ci/upgrade/config.toml @@ -18,7 +18,6 @@ enabled = false enabled = true clear_interval = 100 clear_on_start = true -filter = false tx_confirmation = true [[chains]] @@ -68,3 +67,9 @@ gas_adjustment = 0.1 clock_drift = '300s' trusting_period = '2days' trust_threshold = { numerator = '1', denominator = '3' } + +[chains.packet_filter] +policy = 'deny' +list = [ + ['ica*', '*'], # deny relaying on all channels whose port starts with `ica` +] diff --git a/scripts/ci/upgrade/proposal.sh b/scripts/ci/upgrade/proposal.sh index f1bb6812c..1020ca3c6 100755 --- a/scripts/ci/upgrade/proposal.sh +++ b/scripts/ci/upgrade/proposal.sh @@ -8,20 +8,15 @@ apk add -U --no-cache jq tree STARGAZE_HOME=/stargaze/starsd starsd config keyring-backend test --home $STARGAZE_HOME -echo "BaseApp Params" -starsd q params subspace baseapp BlockParams --node http://stargaze:26657 -starsd q params subspace baseapp EvidenceParams --node http://stargaze:26657 -starsd q params subspace baseapp ValidatorParams --node http://stargaze:26657 - HEIGHT=$(starsd status --node http://stargaze:26657 --home $STARGAZE_HOME | jq .SyncInfo.latest_block_height -r) -tree -L 2 /stargaze/starsd/ + echo "current height $HEIGHT" HEIGHT=$(expr $HEIGHT + 20) echo "submit with height $HEIGHT" -starsd tx gov submit-proposal software-upgrade v3 --upgrade-height $HEIGHT \ +starsd tx gov submit-proposal software-upgrade v4 --upgrade-height $HEIGHT \ --deposit 10000000ustars \ ---description "Add cosmwasm" \ ---title "V3 Upgrade" \ +--description "V4 Upgrade" \ +--title "V4 Upgrade" \ --gas-prices 0.025ustars --gas auto --gas-adjustment 1.5 --from validator \ --chain-id stargaze -b block --yes --node http://stargaze:26657 --home $STARGAZE_HOME --keyring-backend test @@ -32,4 +27,4 @@ starsd tx gov vote 1 "yes" --gas-prices 0.025ustars --gas auto --gas-adjustment --chain-id stargaze -b block --yes --node http://stargaze:26657 --home $STARGAZE_HOME --keyring-backend test sleep 60 starsd q gov proposals --node http://stargaze:26657 --home $STARGAZE_HOME -sleep 60 \ No newline at end of file +sleep 60