diff --git a/app/setup_handlers.go b/app/setup_handlers.go index 321c1f3aa..372de33e9 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" m "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -22,6 +23,12 @@ func setUpgradeHandler(app *ElysApp) { app.Logger().Info("Running upgrade handler for " + version.Version) if version.Version == "v0.29.32" { + app.Logger().Info("Deleting proposals with ID <= 185") + store := ctx.KVStore(app.keys[govtypes.StoreKey]) + for i := uint64(1); i <= 185; i++ { + store.Delete(govtypes.ProposalKey(i)) + } + // update the signing info for the validators signers := []string{ "elysvalcons1j7047ewlfa75dv0q93lnqkctr9afgfayyvmhc4", // euphoria diff --git a/scripts/upgrade-assure/submit-upgrade-proposal.go b/scripts/upgrade-assure/submit-upgrade-proposal.go index ffe513685..b75ffec00 100644 --- a/scripts/upgrade-assure/submit-upgrade-proposal.go +++ b/scripts/upgrade-assure/submit-upgrade-proposal.go @@ -26,6 +26,7 @@ func submitUpgradeProposal(cmdPath, name, newVersion, upgradeHeight, homePath, k "--gas", "1000000", "--deposit", "10000000uelys", "--home", homePath, + "--output", "json", "--yes", } diff --git a/scripts/upgrade-assure/update-genesis.go b/scripts/upgrade-assure/update-genesis.go index 36b18c25c..4dde004cf 100644 --- a/scripts/upgrade-assure/update-genesis.go +++ b/scripts/upgrade-assure/update-genesis.go @@ -72,6 +72,9 @@ func updateGenesis(validatorBalance, homePath, genesisFilePath string) { // add localhost as allowed client genesis.AppState.Ibc.ClientGenesis.Params.AllowedClients = append(genesis.AppState.Ibc.ClientGenesis.Params.AllowedClients, "09-localhost") + // reset gov as there are broken proposoals + genesis.AppState.Gov = genesisInit.AppState.Gov + // update voting period genesis.AppState.Gov.Params.VotingPeriod = "20s" genesis.AppState.Gov.Params.MaxDepositPeriod = "20s" diff --git a/scripts/upgrade-assure/upgrade-assure.go b/scripts/upgrade-assure/upgrade-assure.go index 18a46dea4..6a0ee9a18 100644 --- a/scripts/upgrade-assure/upgrade-assure.go +++ b/scripts/upgrade-assure/upgrade-assure.go @@ -114,7 +114,7 @@ func main() { waitForServiceToStart(rpc, moniker) // wait for next block - waitForNextBlock(oldBinaryPath, rpc, moniker) + waitForNextBlock(oldBinaryPath, rpc, moniker, 5*time.Minute) if skipProposal { // listen for signals @@ -129,7 +129,7 @@ func main() { createValidator(oldBinaryPath, validatorKeyName2, validatorSelfDelegation2, moniker2, validatorPubkey2, homePath, keyringBackend, chainId, rpc, broadcastMode) // wait for next block - waitForNextBlock(oldBinaryPath, rpc, moniker) + waitForNextBlock(oldBinaryPath, rpc, moniker, 2*time.Minute) // stop old binary stop(oldBinaryCmd) @@ -162,18 +162,12 @@ func main() { // submit upgrade proposal txHash := submitUpgradeProposal(oldBinaryPath, validatorKeyName, newVersion, upgradeBlockHeight, homePath, keyringBackend, chainId, rpc, broadcastMode) - err = waitForTxConfirmation(oldBinaryPath, rpc, txHash, 5*time.Minute) - if err != nil { - log.Fatalf("upgrade proposal not confirmed: %v", err) - } + waitForTxConfirmation(oldBinaryPath, rpc, txHash, 5*time.Minute) // vote on upgrade proposal txHash = voteOnUpgradeProposal(oldBinaryPath, validatorKeyName, proposalId, homePath, keyringBackend, chainId, rpc, broadcastMode) - err = waitForTxConfirmation(oldBinaryPath, rpc, txHash, 5*time.Minute) - if err != nil { - log.Fatalf("voting on upgrade proposal not confirmed: %v", err) - } + waitForTxConfirmation(oldBinaryPath, rpc, txHash, 5*time.Minute) // wait for upgrade block height waitForBlockHeight(oldBinaryPath, rpc, upgradeBlockHeight) @@ -196,8 +190,8 @@ func main() { waitForServiceToStart(rpc2, moniker2) // wait for next block - waitForNextBlock(newBinaryPath, rpc, moniker) - waitForNextBlock(newBinaryPath, rpc2, moniker2) + waitForNextBlock(newBinaryPath, rpc, moniker, 5*time.Minute) + waitForNextBlock(newBinaryPath, rpc2, moniker2, 5*time.Minute) // check if the upgrade was successful queryUpgradeApplied(newBinaryPath, rpc, newVersion) diff --git a/scripts/upgrade-assure/vote-on-upgrade-proposal.go b/scripts/upgrade-assure/vote-on-upgrade-proposal.go index 5edb5b8f9..5e2ae6efe 100644 --- a/scripts/upgrade-assure/vote-on-upgrade-proposal.go +++ b/scripts/upgrade-assure/vote-on-upgrade-proposal.go @@ -17,6 +17,7 @@ func voteOnUpgradeProposal(cmdPath, name, proposalId, homePath, keyringBackend, "--fees", "100000uelys", "--gas", "1000000", "--home", homePath, + "--output", "json", "--yes", } diff --git a/scripts/upgrade-assure/wait-for-next-block.go b/scripts/upgrade-assure/wait-for-next-block.go index 5f6200129..41c000a41 100644 --- a/scripts/upgrade-assure/wait-for-next-block.go +++ b/scripts/upgrade-assure/wait-for-next-block.go @@ -6,11 +6,10 @@ import ( "time" ) -func waitForNextBlock(cmdPath, node, moniker string) { +func waitForNextBlock(cmdPath, node, moniker string, timeout time.Duration) { var currentBlockHeight, newBlockHeight int var err error - timeout := 120 * time.Second start := time.Now() // First, get the current block height diff --git a/scripts/upgrade-assure/wait-for-tx-confirmation.go b/scripts/upgrade-assure/wait-for-tx-confirmation.go index 4d9e18dc4..24ac5ca43 100644 --- a/scripts/upgrade-assure/wait-for-tx-confirmation.go +++ b/scripts/upgrade-assure/wait-for-tx-confirmation.go @@ -1,26 +1,27 @@ package main import ( - "fmt" "log" "time" ) -func waitForTxConfirmation(cmdPath, node, txHash string, timeout time.Duration) error { +func waitForTxConfirmation(cmdPath, node, txHash string, timeout time.Duration) { start := time.Now() for { if time.Since(start) > timeout { - return fmt.Errorf("timeout reached while waiting for tx confirmation") + log.Fatalf(ColorRed + "timeout reached while waiting for tx confirmation") } success, err := checkTxStatus(cmdPath, node, txHash) if err != nil { - log.Printf("error checking tx status: %v", err) + log.Printf(ColorRed+"error checking tx status, retrying in 5 seconds: %v", err) time.Sleep(5 * time.Second) continue } if success { - return nil + break } - time.Sleep(10 * time.Second) + log.Printf(ColorYellow+"waiting for tx confirmation %s", txHash) + time.Sleep(5 * time.Second) } + log.Printf(ColorGreen+"tx %s confirmed", txHash) }