Skip to content

Commit 2e7d706

Browse files
committed
fix: network upgrade tests
Signed-off-by: Artur Troian <[email protected]>
1 parent 49f968e commit 2e7d706

File tree

10 files changed

+43
-23
lines changed

10 files changed

+43
-23
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ require (
4747
google.golang.org/grpc v1.74.2
4848
gopkg.in/yaml.v3 v3.0.1
4949
gotest.tools/v3 v3.5.2
50-
pkg.akt.dev/go v0.0.3-rc20
50+
pkg.akt.dev/go v0.0.3-rc21
5151
pkg.akt.dev/go/cli v0.0.3-rc15
5252
pkg.akt.dev/go/sdl v0.0.2-rc6
5353
)
@@ -59,7 +59,7 @@ replace (
5959
// use akash fork of cometbft
6060
github.com/cometbft/cometbft => github.com/akash-network/cometbft v0.38.17-akash.2
6161
// use akash fork of cosmos sdk
62-
github.com/cosmos/cosmos-sdk => github.com/akash-network/cosmos-sdk v0.53.4-akash.1
62+
github.com/cosmos/cosmos-sdk => github.com/akash-network/cosmos-sdk v0.53.4-akash.2
6363

6464
github.com/cosmos/gogoproto => github.com/akash-network/gogoproto v1.7.0-akash.2
6565

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,8 +1281,8 @@ github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3
12811281
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM=
12821282
github.com/akash-network/cometbft v0.38.17-akash.2 h1:ZSlROvuSOUd3f6Jld43Wp5cgAmTY/BgKpSKi3228R7Y=
12831283
github.com/akash-network/cometbft v0.38.17-akash.2/go.mod h1:5l0SkgeLRXi6bBfQuevXjKqML1jjfJJlvI1Ulp02/o4=
1284-
github.com/akash-network/cosmos-sdk v0.53.4-akash.1 h1:AnO3bt7z6jZX9ME+fPSNHjHr3R32VF6Rgq5ApU2Q6Ig=
1285-
github.com/akash-network/cosmos-sdk v0.53.4-akash.1/go.mod h1:UJNjxvMQqI15nc5G2rhPIV/+ol3xDDoE+tif3v/W1pA=
1284+
github.com/akash-network/cosmos-sdk v0.53.4-akash.2 h1:m25lSYG3Gj7TSsKJKJyS+wDxZZBfzKCe4sHr2Mf6rmw=
1285+
github.com/akash-network/cosmos-sdk v0.53.4-akash.2/go.mod h1:UJNjxvMQqI15nc5G2rhPIV/+ol3xDDoE+tif3v/W1pA=
12861286
github.com/akash-network/gogoproto v1.7.0-akash.2 h1:zY5seM6kBOLMBWn15t8vrY1ao4J1HjrhNaEeO/Soro0=
12871287
github.com/akash-network/gogoproto v1.7.0-akash.2/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
12881288
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@@ -3278,8 +3278,8 @@ nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+
32783278
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
32793279
pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA=
32803280
pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
3281-
pkg.akt.dev/go v0.0.3-rc20 h1:1U7brEPHetU33VRN4ziu6Fl/UebXi0y1+8XCbzJa9FM=
3282-
pkg.akt.dev/go v0.0.3-rc20/go.mod h1:TF85k1RuubGnnESQud3FYoDT4/SWWHlccJ/JPw7gDzo=
3281+
pkg.akt.dev/go v0.0.3-rc21 h1:0VaxH2AN0aAadncGP+6oIOqLWqlmyhgFYKPSkp4U6Qs=
3282+
pkg.akt.dev/go v0.0.3-rc21/go.mod h1:gGRN0kbkHsW+/TXV6F+cFf7Hn79uT22mPm8kR+DG0CQ=
32833283
pkg.akt.dev/go/cli v0.0.3-rc15 h1:N6EI96ANOAw6hwV9YdKdQNnB2GsAKPrtcYBblUTB2RU=
32843284
pkg.akt.dev/go/cli v0.0.3-rc15/go.mod h1:FL6HuOFTqez4wPd/58ZbW8EtMY510/CdYhnNkvIvFV4=
32853285
pkg.akt.dev/go/sdl v0.0.2-rc6 h1:rlaiBL2xTl06Rq/MNePmMRyl6ucWweA5q4Mt9tZzwzM=

make/init.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ GOLANGCI_LINT_VERSION ?= v2.3.0
7171
STATIK_VERSION ?= v0.1.7
7272
GIT_CHGLOG_VERSION ?= v0.15.1
7373
MOCKERY_VERSION ?= 3.5.0
74-
COSMOVISOR_VERSION ?= v1.5.0
74+
COSMOVISOR_VERSION ?= v1.7.1
7575

7676
# ==== Build tools version tracking ====
7777
# <TOOL>_VERSION_FILE points to the marker file for the installed version.

make/test-upgrade.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ init: $(AKASH_INIT) $(COSMOVISOR)
3535
genesis: $(GENESIS_DEST)
3636

3737
.PHONY: test
38-
test: $(COSMOVISOR) init
38+
test: #$(COSMOVISOR) init
3939
$(GO_TEST) -run "^\QTestUpgrade\E$$" -tags e2e.upgrade -timeout 180m -v -args \
4040
-cosmovisor=$(COSMOVISOR) \
4141
-workdir=$(AP_RUN_DIR)/validators \

script/upgrades.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ UPGRADE_FROM=${UTEST_UPGRADE_FROM:=}
3434
UPGRADE_TO=${UTEST_UPGRADE_TO:=}
3535
CONFIG_FILE=${UTEST_CONFIG_FILE:=}
3636
CHAIN_METADATA_URL=https://raw.githubusercontent.com/akash-network/net/master/mainnet/meta.json
37-
SNAPSHOT_URL=https://snapshots.akash.network/akashnet-2/akashnet-2_22825219.tar.lz4
37+
SNAPSHOT_URL=https://snapshots.akash.network/akashnet-2/latest
3838
STATE_CONFIG=
3939

4040
short_opts=h
@@ -436,10 +436,11 @@ function prepare_state() {
436436
popd
437437

438438
$AKASH testnetify --home="$valdir" --testnet-rootdir="$validators_dir" --testnet-config="${STATE_CONFIG}" --yes || true
439-
440439
else
441440
pushd "$(pwd)"
442441
cd "${valdir}"
442+
443+
cp -r "${validators_dir}/.akash0/config" ./
443444
cp -r "${validators_dir}/.akash0/data" ./
444445

445446
pushd "$(pwd)"
@@ -481,6 +482,7 @@ function clean() {
481482
rm -rf "$cosmovisor_dir/upgrades/${UPGRADE_TO}/upgrade-info.json"
482483
rm -rf "$cosmovisor_dir/upgrades/${UPGRADE_TO}/bin/akash"
483484

485+
mkdir -p "$valdir/data"
484486
echo '{"height":"0","round": 0,"step": 0}' | jq > "$valdir/data/priv_validator_state.json"
485487

486488
((cnt++)) || true

tests/upgrade/test-cases.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
],
4444
"cert": [
4545
{
46-
"from": "2",
47-
"to": "3"
46+
"from": "3",
47+
"to": "4"
4848
}
4949
],
5050
"deployment": [
5151
{
52-
"from": "3",
53-
"to": "4"
52+
"from": "4",
53+
"to": "5"
5454
}
5555
],
5656
"distribution": [
@@ -107,6 +107,20 @@
107107
{
108108
"from": "5",
109109
"to": "6"
110+
},
111+
{
112+
"from": "6",
113+
"to": "7"
114+
},
115+
{
116+
"from": "7",
117+
"to": "8"
118+
}
119+
],
120+
"market": [
121+
{
122+
"from": "6",
123+
"to": "7"
110124
}
111125
],
112126
"mint": [
@@ -162,6 +176,10 @@
162176
{
163177
"from": "4",
164178
"to": "5"
179+
},
180+
{
181+
"from": "5",
182+
"to": "6"
165183
}
166184
],
167185
"upgrade": [

tests/upgrade/upgrade_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const (
5252
nodeEventStart nodeEvent = iota
5353
nodeEventReplayBlocksStart
5454
nodeEventReplayBlocksDone
55-
nodeEventBlockIndexed
55+
nodeEventBlockCommited
5656
nodeEventUpgradeDetected
5757
nodeEventAddedModule
5858
nodeEventRemovedModule
@@ -1027,7 +1027,7 @@ loop:
10271027
l.t.Logf("[%s][%s]: node done replaying blocks", l.params.name, nodeTestStageMapStr[stage])
10281028
wdCtrl(l.ctx, watchdogCtrlStart)
10291029
replayDone = true
1030-
case nodeEventBlockIndexed:
1030+
case nodeEventBlockCommited:
10311031
// ignore index events until replay done
10321032
if !replayDone {
10331033
break
@@ -1263,6 +1263,7 @@ func (l *validator) scanner(stdout io.Reader, p publisher) error {
12631263
replayBlocksStart := "INF ABCI Replay Blocks appHeight"
12641264
replayBlocksDone := "INF Replay: Done module=consensus"
12651265
executedBlock := "INF indexed block "
1266+
executedBlock2 := "INF committed state block_app_hash="
12661267
upgradeNeeded := fmt.Sprintf(`ERR UPGRADE "%s" NEEDED at height:`, l.params.upgradeName)
12671268
addingNewModule := "INF adding a new module: "
12681269
migratingModule := "INF migrating module "
@@ -1291,8 +1292,8 @@ scan:
12911292
evt.id = nodeEventReplayBlocksStart
12921293
} else if strings.Contains(line, replayBlocksDone) {
12931294
evt.id = nodeEventReplayBlocksDone
1294-
} else if strings.Contains(line, executedBlock) {
1295-
evt.id = nodeEventBlockIndexed
1295+
} else if strings.Contains(line, executedBlock) || strings.Contains(line, executedBlock2) {
1296+
evt.id = nodeEventBlockCommited
12961297
} else if strings.Contains(line, addingNewModule) {
12971298
evt.id = nodeEventAddedModule
12981299
res := rNewModule.FindAllStringSubmatch(line, -1)

upgrades/software/v1.0.0/escrow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (m escrowMigrations) handler(ctx sdk.Context) error {
8383
for ; iter.Valid(); iter.Next() {
8484
key := append(migrate.PaymentV1beta3Prefix(), iter.Key()...)
8585

86-
nVal := migrate.PaymentFromV1beta3(cdc, iter.Key(), iter.Value())
86+
nVal := migrate.PaymentFromV1beta3(cdc, key, iter.Value())
8787
bz := cdc.MustMarshal(&nVal)
8888

8989
switch nVal.State.State {

upgrades/software/v1.0.0/upgrade.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (up *upgrade) patchDepositAuthorizations(ctx sdk.Context) error {
294294
msgUrlOld := "/akash.deployment.v1beta3.MsgDepositDeployment"
295295

296296
var err error
297-
up.log.Info(fmt.Sprintf("migrating \"%s\" to \"%s\"", msgUrlOld, (&dv1beta3.DepositDeploymentAuthorization{}).MsgTypeURL()))
297+
up.log.Info(fmt.Sprintf("migrating \"%s\" to \"%s\"", msgUrlOld, (&ev1.DepositAuthorization{}).MsgTypeURL()))
298298
up.Keepers.Cosmos.Authz.IterateGrants(ctx, func(granterAddr sdk.AccAddress, granteeAddr sdk.AccAddress, grant authz.Grant) bool {
299299
var authorization authz.Authorization
300300
authorization, err = grant.GetAuthorization()
@@ -313,15 +313,14 @@ func (up *upgrade) patchDepositAuthorizations(ctx sdk.Context) error {
313313
return false
314314
}
315315
nAuthz = ev1.NewDepositAuthorization(ev1.DepositAuthorizationScopes{ev1.DepositScopeDeployment}, authzOld.SpendLimit)
316-
317316
default:
318317
return false
319318
}
320319

321320
err = up.Keepers.Cosmos.Authz.DeleteGrant(ctx, granteeAddr, granterAddr, authorization.MsgTypeURL())
322321
if err != nil {
323322
up.log.Error(fmt.Sprintf("unable to delete autorization. err=%s", err.Error()))
324-
return true
323+
return false
325324
}
326325

327326
err = up.Keepers.Cosmos.Authz.SaveGrant(ctx, granteeAddr, granterAddr, nAuthz, grant.Expiration)

x/cert/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
160160

161161
// ConsensusVersion implements module.AppModule#ConsensusVersion
162162
func (am AppModule) ConsensusVersion() uint64 {
163-
return 3
163+
return 4
164164
}
165165

166166
// AppModuleSimulation functions

0 commit comments

Comments
 (0)