Skip to content

Commit b483912

Browse files
committed
add upgrade handler
1 parent 661c405 commit b483912

File tree

8 files changed

+53
-15
lines changed

8 files changed

+53
-15
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ endif
8686

8787
check_go_version:
8888
@echo "Go version: $(GO_MAJOR_VERSION).$(GO_MINOR_VERSION)"
89-
ifneq ($(GO_MINOR_VERSION),23)
90-
@echo "ERROR: Go version 1.23 is required for this version of Stargaze"
89+
ifneq ($(GO_MINOR_VERSION),24)
90+
@echo "ERROR: Go version 1.24 is required for this version of Stargaze"
9191
exit 1
9292
endif
9393

app/upgrades.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
upgrades "github.com/public-awesome/stargaze/v17/app/upgrades"
99
mainnetupgradesv15 "github.com/public-awesome/stargaze/v17/app/upgrades/mainnet/v15"
1010
mainnetupgradesv16 "github.com/public-awesome/stargaze/v17/app/upgrades/mainnet/v16"
11+
mainnetupgradesv17 "github.com/public-awesome/stargaze/v17/app/upgrades/mainnet/v17"
1112
testnetupgradesv15b2 "github.com/public-awesome/stargaze/v17/app/upgrades/testnet/v15b2"
1213
testnetupgradesv15b3 "github.com/public-awesome/stargaze/v17/app/upgrades/testnet/v15b3"
1314
)
@@ -16,6 +17,7 @@ var Upgrades = []upgrades.Upgrade{
1617
// mainnet upgrades
1718
mainnetupgradesv15.Upgrade,
1819
mainnetupgradesv16.Upgrade,
20+
mainnetupgradesv17.Upgrade,
1921
// testnet upgrades
2022
testnetupgradesv15b2.Upgrade,
2123
testnetupgradesv15b3.Upgrade,

app/upgrades/mainnet/v16/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package v15
1+
package v16
22

33
import (
44
"context"

app/upgrades/mainnet/v17/upgrade.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package v17
2+
3+
import (
4+
"context"
5+
"time"
6+
7+
storetypes "cosmossdk.io/store/types"
8+
upgradetypes "cosmossdk.io/x/upgrade/types"
9+
sdk "github.com/cosmos/cosmos-sdk/types"
10+
"github.com/cosmos/cosmos-sdk/types/module"
11+
"github.com/public-awesome/stargaze/v17/app/keepers"
12+
"github.com/public-awesome/stargaze/v17/app/upgrades"
13+
)
14+
15+
// next upgrade name
16+
const UpgradeName = "v17"
17+
18+
var Upgrade = upgrades.Upgrade{
19+
UpgradeName: UpgradeName,
20+
CreateUpgradeHandler: func(mm *module.Manager, cfg module.Configurator, keepers keepers.StargazeKeepers) upgradetypes.UpgradeHandler {
21+
return func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
22+
startTime := time.Now()
23+
wctx := sdk.UnwrapSDKContext(ctx)
24+
wctx.Logger().Info("upgrade started", "upgrade_name", UpgradeName)
25+
migrations, err := mm.RunMigrations(ctx, cfg, fromVM)
26+
if err != nil {
27+
return nil, err
28+
}
29+
wctx.Logger().Info("upgrade completed", "duration_ms", time.Since(startTime).Milliseconds())
30+
return migrations, nil
31+
}
32+
},
33+
StoreUpgrades: storetypes.StoreUpgrades{
34+
Added: []string{},
35+
},
36+
}

e2e/chain_upgrade_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
)
2020

2121
const (
22-
initialVersion = "v15.0.0" // The last released git tag version of the stargaze binary. This version of the image is fetched from Heigliner backage repository.
23-
upgradeName = "v16" // The upcoming version name - Should match with upgrade handler name. This version needs to be built locally for tests. Using `make build-docker`
22+
initialVersion = "v16.0.0" // The last released git tag version of the stargaze binary. This version of the image is fetched from Heigliner backage repository.
23+
upgradeName = "v17" // The upcoming version name - Should match with upgrade handler name. This version needs to be built locally for tests. Using `make build-docker`
2424
)
2525

2626
const (

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module github.com/public-awesome/stargaze/v17
22

3-
go 1.23.5
3+
go 1.24.1
44

55
require (
66
github.com/CosmWasm/wasmd v0.54.1
77
github.com/CosmWasm/wasmvm/v2 v2.2.4
8-
github.com/cometbft/cometbft v0.38.17
8+
github.com/cometbft/cometbft v0.38.18
99
github.com/cosmos/cosmos-proto v1.0.0-beta.5
1010
github.com/cosmos/cosmos-sdk v0.50.14
1111
github.com/cosmos/go-bip39 v1.0.0
@@ -89,7 +89,7 @@ require (
8989
github.com/creachadair/tomledit v0.0.24 // indirect
9090
github.com/danieljoos/wincred v1.1.2 // indirect
9191
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
92-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
92+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
9393
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
9494
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
9595
github.com/dgraph-io/ristretto v0.1.1 // indirect

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ
346346
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
347347
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
348348
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
349-
github.com/cometbft/cometbft v0.38.17 h1:FkrQNbAjiFqXydeAO81FUzriL4Bz0abYxN/eOHrQGOk=
350-
github.com/cometbft/cometbft v0.38.17/go.mod h1:5l0SkgeLRXi6bBfQuevXjKqML1jjfJJlvI1Ulp02/o4=
349+
github.com/cometbft/cometbft v0.38.18 h1:1ZHYMdu0S75YxFM13LlPXnOwiIpUW5z9TKMQtTIALpw=
350+
github.com/cometbft/cometbft v0.38.18/go.mod h1:PlOQgf3jQorep+g6oVnJgtP65TJvBJoLiXjGaMdNxBE=
351351
github.com/cometbft/cometbft-db v0.14.1 h1:SxoamPghqICBAIcGpleHbmoPqy+crij/++eZz3DlerQ=
352352
github.com/cometbft/cometbft-db v0.14.1/go.mod h1:KHP1YghilyGV/xjD5DP3+2hyigWx0WTp9X+0Gnx0RxQ=
353353
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
@@ -401,10 +401,10 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
401401
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
402402
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
403403
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
404-
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
405-
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
406-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg=
407-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
404+
github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8=
405+
github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
406+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
407+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
408408
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
409409
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
410410
github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs=

scripts/ci/upgrade/proposal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cat <<EOT >> proposal.json
3232
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
3333
"authority": "stars10d07y265gmmuvt4z0w9aw880jnsr700jw7ycaz",
3434
"plan": {
35-
"name": "v16",
35+
"name": "v17",
3636
"height": "$HEIGHT",
3737
"info": ""
3838
}

0 commit comments

Comments
 (0)