Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ 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 }})
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
5 changes: 3 additions & 2 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 @@ -67,6 +67,7 @@ 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 {

Check failure on line 13 in tests/upgrade/sdktypes.go

View workflow job for this annotation

GitHub Actions / lint-go

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

type votingParams struct {

Check failure on line 20 in tests/upgrade/sdktypes.go

View workflow job for this annotation

GitHub Actions / lint-go

type votingParams is unused (unused)
VotingPeriod string `json:"voting_period"`
}

type depositParams struct {

Check failure on line 24 in tests/upgrade/sdktypes.go

View workflow job for this annotation

GitHub Actions / lint-go

type depositParams is unused (unused)
MinDeposit sdk.Coins `json:"min_deposit"`
}

type govParams struct {

Check failure on line 28 in tests/upgrade/sdktypes.go

View workflow job for this annotation

GitHub Actions / lint-go

type govParams is unused (unused)
VotingParams votingParams `json:"voting_params"`
DepositParams depositParams `json:"deposit_params"`
}

type proposalResp struct {

Check failure on line 33 in tests/upgrade/sdktypes.go

View workflow job for this annotation

GitHub Actions / lint-go

type proposalResp is unused (unused)
ID string `json:"id"`
Title string `json:"title"`
}

type proposalsResp struct {

Check failure on line 38 in tests/upgrade/sdktypes.go

View workflow job for this annotation

GitHub Actions / lint-go

type proposalsResp is unused (unused)
Proposals []proposalResp `json:"proposals"`
}
Comment on lines +13 to +40
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Clean up unused internal types flagged by golangci-lint

nodeStatus, votingParams, depositParams, govParams, proposalResp, and proposalsResp are defined but unused, and golangci-lint reports them as errors. Either wire them into tests or remove them for now to keep the test package clean.

If they’re not needed yet, you can safely delete them:

-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"`
-}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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"`
}
🧰 Tools
🪛 golangci-lint (2.5.0)

[error] 13-13: type nodeStatus is unused

(unused)


[error] 20-20: type votingParams is unused

(unused)


[error] 24-24: type depositParams is unused

(unused)


[error] 28-28: type govParams is unused

(unused)


[error] 33-33: type proposalResp is unused

(unused)


[error] 38-38: type proposalsResp is unused

(unused)

🤖 Prompt for AI Agents
In tests/upgrade/sdktypes.go around lines 13 to 40, several types (nodeStatus,
votingParams, depositParams, govParams, proposalResp, proposalsResp) are
declared but unused and causing golangci-lint errors; remove these unused type
definitions from the file (or alternatively, if they are intended for future
use, reference them in tests to avoid lint failures) — the quick fix is to
delete the whole block of those type declarations so the test package no longer
contains unused internal types.


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