Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,37 @@ jobs:
uses: ./.github/actions/setup-ubuntu
- name: Setup docker user
run: |
DOCKER_USER=$(id -u)
DOCKER_GROUP=$(id -g)
echo "DOCKER_USER=$DOCKER_USER" >> $GITHUB_ENV
echo "DOCKER_GROUP=$DOCKER_GROUP" >> $GITHUB_ENV
DOCKER_IDU=$(id -u)
DOCKER_IDG=$(id -g)
echo "DOCKER_IDU=$DOCKER_IDU" >> $GITHUB_ENV
echo "DOCKER_IDG=$DOCKER_IDG" >> $GITHUB_ENV
- name: configure variables
run: |
test_required=$(./script/upgrades.sh test-required ${{ github.ref }})
#snapshot_source=$(./script/upgrades.sh snapshot-source ${{ github.ref }})
echo "TEST_REQUIRED=$test_required" >> $GITHUB_ENV
#echo "SNAPSHOT_SOURCE=$snapshot_source" >> $GITHUB_ENV
- name: Fix Go module cache permissions
if: env.TEST_REQUIRED != ''
run: |
# Fix permissions on Go module cache to prevent permission denied errors
# This is needed because sudo cleanup may have affected cache permissions
if [ -d "$HOME/go/pkg/mod" ]; then
sudo chown -R $(id -u):$(id -g) "$HOME/go/pkg/mod" 2>/dev/null || true
fi
# Ensure Go cache directories exist with correct permissions
mkdir -p "$HOME/go/pkg/mod/cache/download"
chmod -R u+w "$HOME/go/pkg/mod" 2>/dev/null || true
- name: run test
id: test
if: env.TEST_REQUIRED != ''
env:
TEST_CONFIG: test-config-gha.json
GOMODCACHE: ${{ runner.temp }}/go-mod-cache
GOCACHE: ${{ runner.temp }}/go-build-cache
run: |
# Ensure cache directories exist with correct permissions
mkdir -p "$GOMODCACHE" "$GOCACHE"
cd tests/upgrade
make test
- name: upload validator(s) stdout/stderr
Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func NewApp(
app := &AkashApp{
BaseApp: bapp,
App: &apptypes.App{
Cdc: appCodec,
Log: logger,
},
aminoCdc: aminoCdc,
Expand Down
5 changes: 5 additions & 0 deletions app/types/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ type AppKeepers struct {
}

type App struct {
Cdc codec.Codec
Keepers AppKeepers
Configurator module.Configurator
MM *module.Manager
Expand Down Expand Up @@ -192,6 +193,10 @@ func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
return app.memKeys[storeKey]
}

func (app *App) GetCodec() codec.Codec {
return app.Cdc
}

// InitSpecialKeepers initiates special keepers (crisis appkeeper, upgradekeeper, params keeper)
func (app *App) InitSpecialKeepers(
cdc codec.Codec,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ require (
google.golang.org/grpc v1.75.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.2
pkg.akt.dev/go v0.1.5
pkg.akt.dev/go v0.1.6
pkg.akt.dev/go/cli v0.1.4
pkg.akt.dev/go/sdl v0.1.1
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3284,8 +3284,8 @@ nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0=
nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=
pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA=
pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
pkg.akt.dev/go v0.1.5 h1:UdhU70YOzfJzzd1mT6dpnK7/5RWwV7N1zr1HRNmqtaw=
pkg.akt.dev/go v0.1.5/go.mod h1:67LZ0QbZMoCipadLNIR8HzMFcL4A4My7h9aMo516SGk=
pkg.akt.dev/go v0.1.6 h1:3wkDfEMWwe4ziUfNq6wUxRFSgYsL/uYF/uZgVfdet/U=
pkg.akt.dev/go v0.1.6/go.mod h1:GUDt3iohVNbt8yW4P5Q0D05zoMs2NXaojF2ZBZgfWUQ=
pkg.akt.dev/go/cli v0.1.4 h1:wFPegnPwimWHi0v5LN6AnWZnwtwpnD6mb7Dp1HSuzlw=
pkg.akt.dev/go/cli v0.1.4/go.mod h1:ZLqHZcq+D/8a27WTPYhmfCm2iGbNicWV1AwOhdspJ4Y=
pkg.akt.dev/go/sdl v0.1.1 h1:3CcAqWeKouFlvUSjQMktWLDqftOjn4cBX37TRFT7BRM=
Expand Down
7 changes: 4 additions & 3 deletions make/test-upgrade.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UPGRADE_FROM := $(shell cat $(ROOT_DIR)/meta.json | jq -r --arg name
GENESIS_BINARY_VERSION := $(shell cat $(ROOT_DIR)/meta.json | jq -r --arg name $(UPGRADE_TO) '.upgrades[$$name].from_binary' | tr -d '\n')
UPGRADE_BINARY_VERSION ?= local

SNAPSHOT_SOURCE ?= sandbox1
SNAPSHOT_SOURCE ?= mainnet

ifeq ($(SNAPSHOT_SOURCE),mainnet)
SNAPSHOT_NETWORK := akashnet-2
Expand Down Expand Up @@ -63,10 +63,11 @@ init: $(COSMOVISOR) $(AKASH_INIT)
genesis: $(GENESIS_DEST)

.PHONY: test
test: init
test: #init
$(GO_TEST) -run "^\QTestUpgrade\E$$" -tags e2e.upgrade -timeout 180m -v -args \
-cosmovisor=$(COSMOVISOR) \
-workdir=$(AP_RUN_DIR)/validators \
-sourcesdir=$(AKASH_ROOT) \
-config=$(TEST_CONFIG) \
-upgrade-name=$(UPGRADE_TO) \
-upgrade-version="$(UPGRADE_BINARY_VERSION)" \
Expand All @@ -75,7 +76,7 @@ test: init
.PHONY: test-reset
test-reset:
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --chain-meta=$(CHAIN_METADATA_URL) --max-validators=$(MAX_VALIDATORS) clean
#$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --gbv=$(GENESIS_BINARY_VERSION) --chain-meta=$(CHAIN_METADATA_URL) bins
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --gbv=$(GENESIS_BINARY_VERSION) --chain-meta=$(CHAIN_METADATA_URL) bins
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) --snapshot-url=$(SNAPSHOT_URL) --chain-meta=$(CHAIN_METADATA_URL) keys
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --state-config=$(STATE_CONFIG) --snapshot-url=$(SNAPSHOT_URL) --chain-meta=$(CHAIN_METADATA_URL) --max-validators=$(MAX_VALIDATORS) prepare-state

Expand Down
5 changes: 5 additions & 0 deletions meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
"skipped": false,
"from_binary": "v0.38.6-rc2",
"from_version": "v0.38.0"
},
"v1.1.0": {
"skipped": false,
"from_binary": "v1.0.4",
"from_version": "v1.0.0"
}
}
}
56 changes: 56 additions & 0 deletions tests/upgrade/sdktypes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package upgrade

import (
"encoding/json"

upgradetypes "cosmossdk.io/x/upgrade/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

// These files defines sdk specific types necessary to perform upgrade simulation.
// we're not using SDK generated types to prevent import of different types of cosmos sdk

type nodeStatus struct {
SyncInfo struct {
LatestBlockHeight string `json:"latest_block_height"`
CatchingUp bool `json:"catching_up"`
} `json:"sync_info"`
}

type votingParams struct {
VotingPeriod string `json:"voting_period"`
}

type depositParams struct {
MinDeposit sdk.Coins `json:"min_deposit"`
}

type govParams struct {
VotingParams votingParams `json:"voting_params"`
DepositParams depositParams `json:"deposit_params"`
}

type proposalResp struct {
ID string `json:"id"`
Title string `json:"title"`
}

type proposalsResp struct {
Proposals []proposalResp `json:"proposals"`
}

type SoftwareUpgradeProposal struct {
Type string `json:"@type"`
Authority string `json:"authority"`
Plan upgradetypes.Plan `json:"plan"`
}

type ProposalMsg struct {
// Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys.
Messages []json.RawMessage `json:"messages,omitempty"`
Metadata string `json:"metadata"`
Deposit string `json:"deposit"`
Title string `json:"title"`
Summary string `json:"summary"`
Expedited bool `json:"expedited"`
}
12 changes: 10 additions & 2 deletions tests/upgrade/test-cases.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"v1.1.0": {
"modules": {
},
"migrations": {
}
},
"v1.0.0": {
"modules": {
"added": [
Expand All @@ -15,7 +21,8 @@
{
"from": "3",
"to": "4"
}, {
},
{
"from": "4",
"to": "5"
}
Expand Down Expand Up @@ -164,7 +171,8 @@
{
"from": "2",
"to": "3"
}, {
},
{
"from": "3",
"to": "4"
},
Expand Down
3 changes: 1 addition & 2 deletions tests/upgrade/test-config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"chain-id": "localakash",
"validators": [
".akash0",
".akash1"
".akash0"
],
"work": {
"home": ".akash0",
Expand Down
1 change: 1 addition & 0 deletions tests/upgrade/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
type TestParams struct {
Home string
Node string
SourceDir string
ChainID string
KeyringBackend string
From string
Expand Down
Loading
Loading