Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: x/upgrade to standalone module #14764

Merged
merged 22 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,10 @@ updates:
labels:
- "A:automerge"
- dependencies
- package-ecosystem: gomod
directory: "x/upgrade"
schedule:
interval: weekly
labels:
- "A:automerge"
- dependencies
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -707,3 +707,32 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: x/evidence/
test-x-upgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19.4
cache: true
cache-dependency-path: x/upgrade/go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
x/upgrade/**/*.go
x/upgrade/go.mod
x/upgrade/go.sum
- name: tests
if: env.GIT_DIFF
run: |
cd x/upgrade
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./...
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: x/upgrade/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking Changes

* (x/upgrade) [14764](https://github.com/cosmos/cosmos-sdk/pull/14764) The `x/upgrade` module is extracted to have a separate go.mod file which allows it be a standalone module.
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
* (x/simulation) [#14751](https://github.com/cosmos/cosmos-sdk/pull/14751) Remove the `MsgType` field from `simulation.OperationInput` struct.
* (crypto/keyring) [#13734](https://github.com/cosmos/cosmos-sdk/pull/13834) The keyring's `Sign` method now takes a new `signMode` argument. It is only used if the signing key is a Ledger hardware device. You can set it to 0 in all other cases.
* (x/evidence) [14724](https://github.com/cosmos/cosmos-sdk/pull/14724) Extract Evidence in its own go.mod and rename the package to `cosmossdk.io/x/evidence`.
Expand Down
8 changes: 7 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,20 @@ By default, the new `ProposalCancelRatio` parameter is set to 0.5 during migrati
##### Extract evidence to a standalone module

The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module.
All the evidence imports are now renamed to use `cosmossdk.io/evidence` instead of `github.com/cosmos/cosmos-sdk/x/evidence` across the SDK.
All the evidence imports are now renamed to use `cosmossdk.io/x/evidence` instead of `github.com/cosmos/cosmos-sdk/x/evidence` across the SDK.

#### `x/nft`

##### Extract nft to a standalone module

The `x/nft` module is extracted to have a separate go.mod file which allows it be a standalone module.

#### `x/upgrade`

##### Extract upgrade to a standalone module

The `x/upgrade` module is extracted to have a separate go.mod file which allows it be a standalone module.
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
All the upgrade imports are now renamed to use `cosmossdk.io/x/upgrade` instead of `github.com/cosmos/cosmos-sdk/x/upgrade` across the SDK.

## [v0.47.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0)

Expand Down
2 changes: 1 addition & 1 deletion api/cosmos/staking/v1beta1/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions api/cosmos/upgrade/module/v1/module.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
cosmossdk.io/errors v1.0.0-beta.7
cosmossdk.io/math v1.0.0-beta.4
cosmossdk.io/x/tx v0.1.0
cosmossdk.io/x/upgrade v0.0.0-20230125092026-51624ecc54d1
github.com/99designs/keyring v1.2.1
github.com/armon/go-metrics v0.4.1
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816
Expand All @@ -33,7 +34,6 @@ require (
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/hashicorp/go-getter v1.6.2
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3
github.com/huandu/skiplist v1.2.0
Expand Down Expand Up @@ -120,6 +120,7 @@ require (
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.6.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
Expand Down Expand Up @@ -176,6 +177,9 @@ require (
)

replace (
// // TODO tag all extracted modules after SDK refactor
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
// cosmossdk.io/x/upgrade => ./x/upgrade

github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
// TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ cosmossdk.io/math v1.0.0-beta.4 h1:JtKedVLGzA0vv84xjYmZ75RKG35Kf2WwcFu8IjRkIIw=
cosmossdk.io/math v1.0.0-beta.4/go.mod h1:An0MllWJY6PxibUpnwGk8jOm+a/qIxlKmL5Zyp9NnaM=
cosmossdk.io/x/tx v0.1.0 h1:uyyYVjG22B+jf54N803Z99Y1uPvfuNP3K1YShoCHYL8=
cosmossdk.io/x/tx v0.1.0/go.mod h1:qsDv7e1fSftkF16kpSAk+7ROOojyj+SC0Mz3ukI52EQ=
cosmossdk.io/x/upgrade v0.0.0-20230125092026-51624ecc54d1 h1:BorCOh0Snt1U0UAYV9DDluuH6tLnl6e065aW5QQ81jQ=
cosmossdk.io/x/upgrade v0.0.0-20230125092026-51624ecc54d1/go.mod h1:H+VCBqiCBedKNSYuUEhIeq0lgRQunTOHmGa0u+DLLDY=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
Expand Down
1 change: 1 addition & 0 deletions go.work.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ use (
./x/nft
./x/circuit
./x/evidence
./x/upgrade
)
2 changes: 1 addition & 1 deletion proto/cosmos/upgrade/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "cosmos/app/v1alpha1/module.proto";
// Module is the config object of the upgrade module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/x/upgrade"
go_import: "cosmossdk.io/x/upgrade"
};

// authority defines the custom module authority. If not set, defaults to the governance module.
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/upgrade/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package cosmos.upgrade.v1beta1;
import "google/api/annotations.proto";
import "cosmos/upgrade/v1beta1/upgrade.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types";
option go_package = "cosmossdk.io/x/upgrade/types";

// Query defines the gRPC upgrade querier service.
service Query {
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/upgrade/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "cosmos/upgrade/v1beta1/upgrade.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types";
option go_package = "cosmossdk.io/x/upgrade/types";

// Msg defines the upgrade Msg service.
service Msg {
Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/upgrade/v1beta1/upgrade.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";
import "amino/amino.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/upgrade/types";
option go_package = "cosmossdk.io/x/upgrade/types";
option (gogoproto.goproto_getters_all) = false;

// Plan specifies information about a planned upgrade and when it should occur.
Expand Down
9 changes: 5 additions & 4 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ import (
nftkeeper "cosmossdk.io/x/nft/keeper"
nftmodule "cosmossdk.io/x/nft/module"

"cosmossdk.io/x/upgrade"
upgradeclient "cosmossdk.io/x/upgrade/client"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -99,10 +104,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

const appName = "SimApp"
Expand Down
4 changes: 2 additions & 2 deletions simapp/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import (
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/core/appconfig"
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/nft"
upgradetypes "cosmossdk.io/x/upgrade/types"
"google.golang.org/protobuf/types/known/durationpb"

"cosmossdk.io/x/nft"
"github.com/cosmos/cosmos-sdk/runtime"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
Expand All @@ -47,7 +48,6 @@ import (
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion simapp/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

"cosmossdk.io/x/evidence"
"cosmossdk.io/x/upgrade"
dbm "github.com/cosmos/cosmos-db"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -35,7 +36,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/upgrade"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions simapp/app_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import (
nftkeeper "cosmossdk.io/x/nft/keeper"
nftmodule "cosmossdk.io/x/nft/module"

"cosmossdk.io/x/upgrade"
upgradeclient "cosmossdk.io/x/upgrade/client"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -67,9 +71,6 @@ import (
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
)

var (
Expand Down
7 changes: 6 additions & 1 deletion simapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
cosmossdk.io/tools/rosetta v0.2.0
cosmossdk.io/x/evidence v0.1.0
cosmossdk.io/x/nft v0.0.0-20230113085233-fae3332d62fc
cosmossdk.io/x/upgrade v0.1.0
github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32
// this version is not used as it is always replaced by the latest cosmos-sdk version
github.com/cosmos/cosmos-sdk v0.47.0-rc1
Expand Down Expand Up @@ -183,10 +184,14 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

// TODO tag all extracted modules after SDK refactor
replace (
cosmossdk.io/x/evidence => ../x/evidence
// TODO tag all extracted modules after SDK refactor
cosmossdk.io/x/nft => ../x/nft
cosmossdk.io/x/upgrade => ../x/upgrade
)

replace (
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// Simapp always use the latest version of the cosmos-sdk
Expand Down
3 changes: 2 additions & 1 deletion simapp/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package simapp

import (
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/baseapp"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

// UpgradeName defines the on-chain upgrade name for the sample SimApp upgrade
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/upgrade/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (

"github.com/stretchr/testify/suite"

"cosmossdk.io/x/upgrade/client/cli"
"cosmossdk.io/x/upgrade/keeper"
"cosmossdk.io/x/upgrade/types"

clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/upgrade/client/cli"
"github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func NewE2ETestSuite(cfg network.Config, keeper *keeper.Keeper, ctx sdk.Context) *E2ETestSuite {
Expand Down
11 changes: 8 additions & 3 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
cosmossdk.io/simapp v0.0.0-00010101000000-000000000000
cosmossdk.io/x/evidence v0.1.0
cosmossdk.io/x/nft v0.0.0-20230113085233-fae3332d62fc
cosmossdk.io/x/upgrade v0.1.0
github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32
// this version is not used as it is always replaced by the latest cosmos-sdk version
github.com/cosmos/cosmos-sdk v0.47.0-rc1
Expand Down Expand Up @@ -177,12 +178,16 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

// TODO tag all extracted modules after SDK refactor
replace (
// We always want to test against the latest version of the simapp.
cosmossdk.io/simapp => ../simapp
cosmossdk.io/x/evidence => ../x/evidence
// TODO tag all extracted modules after SDK refactor
cosmossdk.io/x/nft => ../x/nft
cosmossdk.io/x/upgrade => ../x/upgrade
)

replace (
// We always want to test against the latest version of the simapp.
cosmossdk.io/simapp => ../simapp
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// We always want to test against the latest version of the SDK.
github.com/cosmos/cosmos-sdk => ../.
Expand Down
4 changes: 2 additions & 2 deletions tools/cosmovisor/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

cverrors "cosmossdk.io/tools/cosmovisor/errors"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/rs/zerolog"
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
)

Expand Down
Loading