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

chore: remove baseapp from x/accounts #23355

Merged
merged 56 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
dab4f61
header service
Dec 20, 2024
ccdbad4
update
Dec 20, 2024
ef438eb
basic env
Dec 20, 2024
9dfae05
transaction service
Dec 20, 2024
779bd84
refit
Dec 20, 2024
2e7ca6d
register
Dec 20, 2024
6161b6a
utd
Dec 20, 2024
7355259
Merge branch 'main' into feat/services-helpers
Dec 20, 2024
46a30d3
bank
Dec 20, 2024
89e5b26
no more sdk.context
Dec 20, 2024
05a8577
working
Dec 20, 2024
f827e73
lint fixes
Dec 20, 2024
6c7dc2a
format
Dec 20, 2024
ed63aca
Merge branch 'main' into feat/services-helpers
Jan 3, 2025
c8b7460
Merge branch 'main' into feat/services-helpers
Jan 3, 2025
4956083
lint
Jan 3, 2025
b5703d4
Merge branch 'main' into feat/services-helpers
Jan 3, 2025
c7bc69d
tidy all
Jan 3, 2025
1442dc2
Merge branch 'main' into feat/services-helpers
Jan 6, 2025
9d98953
Merge branch 'main' into feat/services-helpers
Jan 6, 2025
d29ed65
Merge branch 'main' into feat/services-helpers
Jan 6, 2025
d42ac1f
clean
Jan 6, 2025
a6ffa04
use mocked query client
Jan 6, 2025
fb55664
clean up
Jan 6, 2025
87fb4f9
lint
Jan 6, 2025
e18d809
server check
Jan 6, 2025
4f56126
Merge branch 'main' into feat/services-helpers
Jan 7, 2025
f67b33f
lint-fix
Jan 7, 2025
997bf85
Merge branch 'main' into feat/services-helpers
Jan 7, 2025
ed61ace
Merge branch 'main' into feat/services-helpers
Jan 7, 2025
47a681e
init test
Jan 8, 2025
9f54324
rm
Jan 8, 2025
0cea6dd
Merge branch 'main' into feat/services-helpers
Jan 8, 2025
1838bbf
Update testutil/queryclient/queryclient.go
Jan 9, 2025
31198b6
Merge branch 'main' into feat/services-helpers
Jan 9, 2025
e932ea5
q
Jan 9, 2025
d17569e
Merge branch 'main' into feat/services-helpers
Jan 9, 2025
71ad965
Merge branch 'main' into feat/services-helpers
Jan 9, 2025
4069c71
Merge branch 'main' into feat/services-helpers
Jan 13, 2025
d759e14
move out of intrgration
Jan 13, 2025
d8b3ac6
rearrange
Jan 13, 2025
150df47
lint fix
Jan 13, 2025
86269ec
clean
Jan 13, 2025
ffde8e3
clean
Jan 13, 2025
6574b36
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 14, 2025
b5cf3af
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 14, 2025
1138fc9
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 14, 2025
6caaa63
refactgor into coretesting
Jan 14, 2025
d444dd7
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 14, 2025
1b9b8f7
refactor
Jan 14, 2025
eda6e7f
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 15, 2025
47bdcde
clean
Jan 15, 2025
5d14883
fix
Jan 15, 2025
615d930
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 15, 2025
f88a742
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 15, 2025
a913205
Merge branch 'main' into chore/remove-baseapp-accounts
Jan 16, 2025
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
Prev Previous commit
Next Next commit
refactor
aljo242 committed Jan 14, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 1b9b8f7633e56fd5d49d4993d615c6eec449826e
28 changes: 0 additions & 28 deletions core/testing/go.mod
Original file line number Diff line number Diff line change
@@ -7,47 +7,19 @@ toolchain go1.23.4
require (
cosmossdk.io/core v1.0.0
github.com/cometbft/cometbft/api v1.0.0
Copy link
Member

Choose a reason for hiding this comment

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

can we not add this dep however? even if it is the api only, we should try to have core/testing have no dep on cometbft whatsoever.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

github.com/cosmos/cosmos-sdk v0.50.11
github.com/cosmos/gogoproto v1.7.0
github.com/tidwall/btree v1.7.0
go.uber.org/mock v0.5.0
google.golang.org/grpc v1.69.4
)

require (
cosmossdk.io/api v0.7.6 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/math v1.4.0 // indirect
cosmossdk.io/schema v1.0.0 // indirect
cosmossdk.io/x/tx v0.13.7 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/cometbft/cometbft v0.38.12 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/net v0.30.0 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: Update golang.org/x/net to patch security vulnerability

The current version (v0.30.0) of golang.org/x/net has a high severity vulnerability (GHSA-w32m-9786-jp63) related to non-linear parsing of case-insensitive content in the html package.

Please update to a patched version of golang.org/x/net.

🧰 Tools
🪛 GitHub Actions: Dependency Review

[high] Vulnerable dependency: golang.org/x/[email protected] has a high severity vulnerability related to non-linear parsing of case-insensitive content in golang.org/x/net/html (GHSA-w32m-9786-jp63)

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: Update golang.org/x/net to patch security vulnerability.

The current version (0.30.0) of golang.org/x/net contains a high severity vulnerability (GHSA-w32m-9786-jp63) related to non-linear parsing of case-insensitive content in the HTML package.

Update to the latest patched version:

-	golang.org/x/net v0.30.0 // indirect
+	golang.org/x/net v0.31.0 // indirect
📝 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
golang.org/x/net v0.30.0 // indirect
golang.org/x/net v0.31.0 // indirect
🧰 Tools
🪛 GitHub Actions: Dependency Review

[high] Vulnerable dependency: golang.org/x/[email protected] has a high severity vulnerability related to non-linear parsing of case-insensitive content in golang.org/x/net/html (GHSA-w32m-9786-jp63)

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Security: Update golang.org/x/net to patch vulnerability.

The current version (v0.30.0) of golang.org/x/net has a high severity vulnerability (GHSA-w32m-9786-jp63) related to non-linear parsing of case-insensitive content in the html package.

Please update to a patched version when available. In the meantime, if the html package is not used, this vulnerability may not affect your application.

🧰 Tools
🪛 GitHub Actions: Dependency Review

[high] Vulnerable dependency: golang.org/x/[email protected] has a high severity vulnerability related to non-linear parsing of case-insensitive content in golang.org/x/net/html (GHSA-w32m-9786-jp63)

golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
352 changes: 0 additions & 352 deletions core/testing/go.sum

Large diffs are not rendered by default.

21 changes: 5 additions & 16 deletions core/testing/queryclient/queryclient.go
Original file line number Diff line number Diff line change
@@ -8,36 +8,29 @@ import (
gogogrpc "github.com/cosmos/gogoproto/grpc"
"google.golang.org/grpc"
"google.golang.org/grpc/encoding"

"github.com/cosmos/cosmos-sdk/client/grpc/reflection"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
)

var (
_ gogogrpc.ClientConn = &QueryHelper{}
_ gogogrpc.Server = &QueryHelper{}
)

// GRPCQueryHandler defines a function type which handles ABCI Query requests
// using gRPC
type GRPCQueryHandler = func(ctx context.Context, req *abci.QueryRequest) (*abci.QueryResponse, error)

// QueryHelper is a test utility for building a query client from a proto interface registry.
type QueryHelper struct {
cdc encoding.Codec
routes map[string]GRPCQueryHandler
}

func NewQueryHelper(interfaceRegistry codectypes.InterfaceRegistry) *QueryHelper {
// instantiate the codec
cdc := codec.NewProtoCodec(interfaceRegistry).GRPCCodec()
// Once we have an interface registry, we can register the interface
// registry reflection gRPC service.

func NewQueryHelper(cdc encoding.Codec) *QueryHelper {
qh := &QueryHelper{
cdc: cdc,
routes: map[string]GRPCQueryHandler{},
}

reflection.RegisterReflectionServiceServer(qh, reflection.NewReflectionServiceServer(interfaceRegistry))

return qh
}

@@ -70,10 +63,6 @@ func (q *QueryHelper) NewStream(context.Context, *grpc.StreamDesc, string, ...gr
panic("not implemented")
}

// GRPCQueryHandler defines a function type which handles ABCI Query requests
// using gRPC
type GRPCQueryHandler = func(ctx context.Context, req *abci.QueryRequest) (*abci.QueryResponse, error)

// Route returns the GRPCQueryHandler for a given query route path or nil
// if not found
func (q *QueryHelper) Route(path string) GRPCQueryHandler {
2 changes: 1 addition & 1 deletion tests/integration/v2/accounts/fixture_test.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"

"cosmossdk.io/core/router"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
@@ -25,7 +26,6 @@ import (
minttypes "cosmossdk.io/x/mint/types"
_ "cosmossdk.io/x/staking" // import as blank for app wirings

"cosmossdk.io/core/testing/msgrouter"
"github.com/cosmos/cosmos-sdk/codec"
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
"github.com/cosmos/cosmos-sdk/tests/integration/v2"
2 changes: 1 addition & 1 deletion tests/integration/v2/accounts/lockup/utils.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/suite"

"cosmossdk.io/core/router"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
@@ -28,7 +29,6 @@ import (
stakingkeeper "cosmossdk.io/x/staking/keeper"
stakingtypes "cosmossdk.io/x/staking/types"

"cosmossdk.io/core/testing/msgrouter"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/tests/integration/v2"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
2 changes: 1 addition & 1 deletion tests/integration/v2/accounts/multisig/test_suite.go
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/suite"

"cosmossdk.io/core/router"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
@@ -26,7 +27,6 @@ import (
_ "cosmossdk.io/x/staking" // import as blank for app wiring
stakingkeeper "cosmossdk.io/x/staking/keeper"

"cosmossdk.io/core/testing/msgrouter"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/tests/integration/v2"
2 changes: 1 addition & 1 deletion tests/integration/v2/auth/app_test.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"

"cosmossdk.io/core/router"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
@@ -22,7 +23,6 @@ import (
_ "cosmossdk.io/x/consensus" // import as blank for app wiring
_ "cosmossdk.io/x/staking" // import as blank for app wirings

"cosmossdk.io/core/testing/msgrouter"
"github.com/cosmos/cosmos-sdk/tests/integration/v2"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
_ "github.com/cosmos/cosmos-sdk/x/auth" // import as blank for app wiring
2 changes: 1 addition & 1 deletion tests/integration/v2/distribution/fixture_test.go
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import (
"cosmossdk.io/core/comet"
corecontext "cosmossdk.io/core/context"
"cosmossdk.io/core/router"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
@@ -26,7 +27,6 @@ import (
_ "cosmossdk.io/x/staking" // import as blank for app wiring
stakingkeeper "cosmossdk.io/x/staking/keeper"

"cosmossdk.io/core/testing/msgrouter"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/tests/integration/v2"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
2 changes: 1 addition & 1 deletion tests/integration/v2/gov/common_test.go
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ import (
"gotest.tools/v3/assert"

"cosmossdk.io/core/router"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/depinject"
sdklog "cosmossdk.io/log"
@@ -32,7 +33,6 @@ import (
stakingkeeper "cosmossdk.io/x/staking/keeper"
stakingtypes "cosmossdk.io/x/staking/types"

"cosmossdk.io/core/testing/msgrouter"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
2 changes: 1 addition & 1 deletion tests/integration/v2/gov/keeper/fixture_test.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"

"cosmossdk.io/core/router"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
@@ -23,7 +24,6 @@ import (
_ "cosmossdk.io/x/staking"
stakingkeeper "cosmossdk.io/x/staking/keeper"

"cosmossdk.io/core/testing/msgrouter"
"github.com/cosmos/cosmos-sdk/tests/integration/v2"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
_ "github.com/cosmos/cosmos-sdk/x/auth"
2 changes: 1 addition & 1 deletion x/accounts/utils_test.go
Original file line number Diff line number Diff line change
@@ -11,13 +11,13 @@ import (
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
"cosmossdk.io/core/address"
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/core/testing/msgrouter"
"cosmossdk.io/core/transaction"
"cosmossdk.io/math"
"cosmossdk.io/x/accounts/internal/implementation"
banktypes "cosmossdk.io/x/bank/types"
"cosmossdk.io/x/tx/signing"

"cosmossdk.io/core/testing/msgrouter"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
7 changes: 5 additions & 2 deletions x/bank/keeper/keeper_test.go
Original file line number Diff line number Diff line change
@@ -10,13 +10,16 @@ import (
"testing"
"time"

"github.com/cosmos/cosmos-sdk/codec"

"github.com/stretchr/testify/suite"
"go.uber.org/mock/gomock"

"cosmossdk.io/core/address"
coreevent "cosmossdk.io/core/event"
"cosmossdk.io/core/header"
coretesting "cosmossdk.io/core/testing"
"cosmossdk.io/core/testing/queryclient"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
"cosmossdk.io/math"
@@ -25,7 +28,7 @@ import (
banktestutil "cosmossdk.io/x/bank/testutil"
banktypes "cosmossdk.io/x/bank/types"

"cosmossdk.io/core/testing/queryclient"
"github.com/cosmos/cosmos-sdk/codec"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove duplicate import of codec package.

The codec package is already imported on line 13. This duplicate import is causing the pipeline failures.

-	"github.com/cosmos/cosmos-sdk/codec"
🧰 Tools
🪛 GitHub Actions: Lint

[error] 31-31: Variable 'codec' redeclared in this block

🪛 GitHub Actions: Tests / Code Coverage

[error] 31-31: Variable 'codec' redeclared in this block

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix duplicate import of 'codec' package.

The 'codec' package is imported twice (lines 13 and 31), causing build failures. Remove the duplicate import.

-	"github.com/cosmos/cosmos-sdk/codec"

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: Lint

[error] 31-31: Variable 'codec' redeclared in this block

🪛 GitHub Actions: Tests / Code Coverage

[error] 31-31: Variable 'codec' redeclared in this block

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove duplicate codec import.

The github.com/cosmos/cosmos-sdk/codec package is already imported at line 13. This duplicate import causes a compilation error.

-	"github.com/cosmos/cosmos-sdk/codec"
🧰 Tools
🪛 GitHub Actions: Lint

[error] 31-31: Variable 'codec' redeclared in this block

🪛 GitHub Actions: Tests / Code Coverage

[error] 31-31: Variable 'codec' redeclared in this block

codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
"github.com/cosmos/cosmos-sdk/runtime"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -186,7 +189,7 @@ func (suite *KeeperTestSuite) SetupTest() {
DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled,
}))

queryHelper := queryclient.NewQueryHelper(encCfg.InterfaceRegistry)
queryHelper := queryclient.NewQueryHelper(codec.NewProtoCodec(encCfg.InterfaceRegistry).GRPCCodec())
banktypes.RegisterQueryServer(queryHelper, suite.bankKeeper)
banktypes.RegisterInterfaces(encCfg.InterfaceRegistry)