Skip to content

Commit

Permalink
refactor(x/auth): spin out go.mod
Browse files Browse the repository at this point in the history
A Go module for x/auth at cosmossdk.io/x/auth

Updates #11899
  • Loading branch information
odeke-em committed Nov 3, 2023
1 parent 32c8ab9 commit 93a6e68
Show file tree
Hide file tree
Showing 252 changed files with 555 additions and 1,161 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,37 @@ jobs:
with:
projectBaseDir: x/staking/

test-x-auth:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
cache: true
cache-dependency-path: x/auth/go.sum
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
x/auth/**/*.go
x/auth/go.mod
x/auth/go.sum
- name: tests
if: env.GIT_DIFF
run: |
cd x/auth
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./...
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: x/auth/

test-x-authz:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/consensus) [#18041](https://github.com/cosmos/cosmos-sdk/pull/18041) `ToProtoConsensusParams()` returns an error
* (x/slashing) [#18115](https://github.com/cosmos/cosmos-sdk/pull/18115) `NewValidatorSigningInfo` takes strings instead of `sdk.AccAddress`
* (types) [#18268](https://github.com/cosmos/cosmos-sdk/pull/18268) Remove global setting of basedenom. Use the staking module parameter instead
* (x/auth) [#18351](https://github.com/cosmos/cosmos-sdk/pull/18351) Auth module was moved to its own go.mod `cosmossdk.io/x/auth`

### CLI Breaking Changes

Expand Down
5 changes: 5 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ Most of Cosmos SDK modules have migrated to [collections](https://docs.cosmos.ne
Many functions have been removed due to this changes as the API can be smaller thanks to collections.
For modules that have migrated, verify you are checking against `collections.ErrNotFound` when applicable.

#### `x/auth`

Auth was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/auth`


#### `x/authz`

Authz was spun out into its own `go.mod`. To import it use `cosmossdk.io/x/authz`
Expand Down
2 changes: 1 addition & 1 deletion baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"cosmossdk.io/store/snapshots"
snapshottypes "cosmossdk.io/store/snapshots/types"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/x/auth/signing"

"github.com/cosmos/cosmos-sdk/baseapp"
baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil"
Expand All @@ -40,7 +41,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/mempool"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion baseapp/abci_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/stretchr/testify/suite"

"cosmossdk.io/log"
authtx "cosmossdk.io/x/auth/tx"

"github.com/cosmos/cosmos-sdk/baseapp"
baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil"
Expand All @@ -23,7 +24,6 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/mempool"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"cosmossdk.io/store/snapshots"
snapshottypes "cosmossdk.io/store/snapshots/types"
storetypes "cosmossdk.io/store/types"
authtx "cosmossdk.io/x/auth/tx"

"github.com/cosmos/cosmos-sdk/baseapp"
baseapptestutil "github.com/cosmos/cosmos-sdk/baseapp/testutil"
Expand All @@ -30,7 +31,6 @@ import (
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions baseapp/block_gas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"cosmossdk.io/log"
sdkmath "cosmossdk.io/math"
store "cosmossdk.io/store/types"
authkeeper "cosmossdk.io/x/auth/keeper"
xauthsigning "cosmossdk.io/x/auth/signing"
bankkeeper "cosmossdk.io/x/bank/keeper"
banktypes "cosmossdk.io/x/bank/types"

Expand All @@ -31,8 +33,6 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
)

const mintModuleName = "mint"
Expand Down
4 changes: 2 additions & 2 deletions baseapp/msg_service_router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (

"cosmossdk.io/depinject"
"cosmossdk.io/log"
authsigning "cosmossdk.io/x/auth/signing"
authtx "cosmossdk.io/x/auth/tx"

"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
)

func TestRegisterMsgService(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions baseapp/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import (
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"
_ "cosmossdk.io/x/auth"
"cosmossdk.io/x/auth/signing"
_ "cosmossdk.io/x/auth/tx/config"
authtypes "cosmossdk.io/x/auth/types"
_ "cosmossdk.io/x/bank"
banktypes "cosmossdk.io/x/bank/types"
_ "cosmossdk.io/x/staking"
Expand All @@ -44,10 +48,6 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/mempool"
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
_ "github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
)

Expand Down
3 changes: 2 additions & 1 deletion client/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import (
gogogrpc "github.com/cosmos/gogoproto/grpc"
"github.com/spf13/pflag"

authsigning "cosmossdk.io/x/auth/signing"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/input"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
)

// GenerateOrBroadcastTxCLI will either generate and print an unsigned transaction
Expand Down
7 changes: 4 additions & 3 deletions client/tx/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/grpc"

ante "cosmossdk.io/x/auth/ante"
"cosmossdk.io/x/auth/signing"
authtx "cosmossdk.io/x/auth/tx"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/codec"
Expand All @@ -21,9 +25,6 @@ import (
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
txtypes "github.com/cosmos/cosmos-sdk/types/tx"
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
ante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
countertypes "github.com/cosmos/cosmos-sdk/x/counter/types"
)

Expand Down
2 changes: 1 addition & 1 deletion client/tx_config.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package client

import (
"cosmossdk.io/x/auth/signing"
txsigning "cosmossdk.io/x/tx/signing"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx"
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion client/v2/autocli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
"cosmossdk.io/client/v2/autocli/keyring"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/depinject"
"cosmossdk.io/x/auth/tx"

"github.com/cosmos/cosmos-sdk/client"
sdkflags "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
)

// AppOptions are autocli options for an app. These options can be built via depinject based on an app config. Ex:
Expand Down
2 changes: 1 addition & 1 deletion client/v2/autocli/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"cosmossdk.io/client/v2/autocli/flag"
"cosmossdk.io/client/v2/autocli/keyring"
authtx "cosmossdk.io/x/auth/tx"

"github.com/cosmos/cosmos-sdk/client"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
)

// Builder manages options for building CLI commands.
Expand Down
4 changes: 2 additions & 2 deletions client/v2/autocli/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
"cosmossdk.io/client/v2/autocli/flag"
authtx "cosmossdk.io/x/auth/tx"
authtxconfig "cosmossdk.io/x/auth/tx/config"

"github.com/cosmos/cosmos-sdk/client"
clienttx "github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
)

// BuildMsgCommand builds the msg commands for all the provided modules. If a custom command is provided for a
Expand Down
12 changes: 6 additions & 6 deletions collections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "cosmossdk.io/x/auth/types"
)

var AccountsPrefix = collections.NewPrefix(0)
Expand Down Expand Up @@ -257,7 +257,7 @@ import (
"fmt"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "cosmossdk.io/x/auth/types"
)

var AccountsPrefix = collections.NewPrefix(0)
Expand Down Expand Up @@ -508,7 +508,7 @@ import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "cosmossdk.io/x/auth/types"
)

var AccountsPrefix = collections.NewPrefix(0)
Expand Down Expand Up @@ -926,7 +926,7 @@ import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "cosmossdk.io/x/auth/types"
)

var AccountsNumberIndexPrefix = collections.NewPrefix(1)
Expand Down Expand Up @@ -985,7 +985,7 @@ import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "cosmossdk.io/x/auth/types"
)

var AccountsNumberIndexPrefix = collections.NewPrefix(1)
Expand Down Expand Up @@ -1093,7 +1093,7 @@ import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "cosmossdk.io/x/auth/types"
)

var AccountsPrefix = collections.NewPrefix(0)
Expand Down
2 changes: 1 addition & 1 deletion core/appmodule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import "cosmos/app/v1alpha1/module.proto";
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/x/auth"
go_import: "cosmossdk.io/x/auth"
};
string bech32_prefix = 1;
repeated ModuleAccountPermission module_account_permissions = 2;
Expand Down
2 changes: 1 addition & 1 deletion crypto/keyring/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package keyring

import (
signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1"
authsigning "cosmossdk.io/x/auth/signing"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
)

// autoCLIKeyring represents the keyring interface used by the AutoCLI.
Expand Down
2 changes: 1 addition & 1 deletion crypto/keys/multisig/multisig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"cosmossdk.io/core/address"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"cosmossdk.io/x/auth/migrations/legacytx"

"github.com/cosmos/cosmos-sdk/codec"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
Expand All @@ -22,7 +23,6 @@ import (
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
)

func TestNewMultiSig(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-011-generalize-genesis-accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The `auth` codec must have all custom account types registered to marshal them.
An example custom account definition:

```go
import authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
import authtypes "cosmossdk.io/x/auth/types"

// Register the module account type with the auth module codec so it can decode module accounts stored in a genesis file
func init() {
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-057-app-wiring.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ package main
import (
// Each go package which registers a module must be imported just for side-effects
// so that module implementations are registered.
_ "github.com/cosmos/cosmos-sdk/x/auth/module"
_ "cosmossdk.io/x/auth/module"
_ "cosmossdk.io/x/bank/module"
_ "cosmossdk.io/x/staking/module"
"github.com/cosmos/cosmos-sdk/core/app"
Expand Down
6 changes: 4 additions & 2 deletions docs/user/run-node/03-txs.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ In the current `TxBuilder`'s API, both steps are done using the same method: `Se

```go
import (
xauthsigning "cosmossdk.io/x/auth/signing"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
xauthsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
)

func sendTx() error {
Expand Down Expand Up @@ -322,9 +323,10 @@ import (
"fmt"
"testing"

authtx "cosmossdk.io/x/auth/tx"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/types/tx"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
)

func simulateTx() error {
Expand Down
Loading

0 comments on commit 93a6e68

Please sign in to comment.