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: consensus spinout #20010

Merged
merged 22 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1284,3 +1284,34 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: x/epochs/

test-x-consensus:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
cache: true
cache-dependency-path: x/consensus/go.sum
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
x/consensus/**/*.go
x/consensus/go.mod
x/consensus/go.sum
- name: tests
if: env.GIT_DIFF
run: |
cd x/consensus
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/consensus/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* Additionally, to reflect this change, the module manager does not take a codec either.
* (runtime) [#19747](https://github.com/cosmos/cosmos-sdk/pull/19747) `runtime.ValidatorAddressCodec` and `runtime.ConsensusAddressCodec` have been moved to `core`.
* (baseapp) [#19993](https://github.com/cosmos/cosmos-sdk/pull/19993) Indicate pruning with error code "not found" rather than "invalid request".
* (x/consensus) [#20010](https://github.com/cosmos/cosmos-sdk/pull/20010) Move consensus module to be its own go.mod
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
* (server) [#20140](https://github.com/cosmos/cosmos-sdk/pull/20140) Remove embedded grpc-web proxy in favor of standalone grpc-web proxy. [Envoy Proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start)

### Client Breaking Changes
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ COPY x/auth/go.mod x/auth/go.sum ./x/auth/
COPY x/authz/go.mod x/authz/go.sum ./x/authz/
COPY x/bank/go.mod x/bank/go.sum ./x/bank/
COPY x/mint/go.mod x/mint/go.sum ./x/mint/
COPY x/consensus/go.mod x/consensus/go.sum ./x/consensus/
COPY depinject/go.mod depinject/go.sum ./depinject/
RUN go mod download

Expand Down
3 changes: 2 additions & 1 deletion client/v2/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module cosmossdk.io/client/v2

go 1.21.0
go 1.22.2

require (
cosmossdk.io/api v0.7.4
Expand Down Expand Up @@ -176,6 +176,7 @@ replace (
cosmossdk.io/x/accounts => ./../../x/accounts
cosmossdk.io/x/auth => ./../../x/auth
cosmossdk.io/x/bank => ./../../x/bank
cosmossdk.io/x/consensus => ./../../x/consensus
cosmossdk.io/x/distribution => ./../../x/distribution
cosmossdk.io/x/gov => ./../../x/gov
cosmossdk.io/x/mint => ./../../x/mint
Expand Down
1 change: 1 addition & 0 deletions contrib/images/simd-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ COPY x/auth/go.mod x/auth/go.sum /work/x/auth/
COPY x/authz/go.mod x/authz/go.sum /work/x/authz/
COPY x/bank/go.mod x/bank/go.sum /work/x/bank/
COPY x/mint/go.mod x/mint/go.sum /work/x/mint/
COPY x/consensus/go.mod x/consensus/go.sum /work/x/consensus/
COPY x/accounts/go.mod x/accounts/go.sum /work/x/accounts/
RUN go mod download

Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.21.0
go 1.22.2

module github.com/cosmos/cosmos-sdk

Expand All @@ -14,6 +14,7 @@ require (
cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91
cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91
cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000
cosmossdk.io/x/tx v0.13.3
github.com/99designs/keyring v1.2.2
Expand All @@ -31,7 +32,6 @@ require (
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/google/go-cmp v0.6.0
github.com/google/gofuzz v1.2.0
github.com/gorilla/handlers v1.5.2
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
Expand Down Expand Up @@ -184,6 +184,7 @@ replace (
cosmossdk.io/x/accounts => ./x/accounts
cosmossdk.io/x/auth => ./x/auth
cosmossdk.io/x/bank => ./x/bank
cosmossdk.io/x/consensus => ./x/consensus
cosmossdk.io/x/staking => ./x/staking
)

Expand Down
2 changes: 1 addition & 1 deletion proto/cosmos/consensus/v1/consensus.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import "tendermint/types/params.proto";

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

Check failure on line 7 in proto/cosmos/consensus/v1/consensus.proto

View workflow job for this annotation

GitHub Actions / break-check

File option "go_package" changed from "github.com/cosmos/cosmos-sdk/x/consensus/types" to "cosmossdk.io/x/consensus/types".

// ConsensusMsgParams is the Msg/Params request type. This is a consensus message that is sent from cometbft.
message ConsensusMsgParams {
Expand Down
6 changes: 3 additions & 3 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ import (
"cosmossdk.io/x/circuit"
circuitkeeper "cosmossdk.io/x/circuit/keeper"
circuittypes "cosmossdk.io/x/circuit/types"
"cosmossdk.io/x/consensus"
consensusparamkeeper "cosmossdk.io/x/consensus/keeper"
consensusparamtypes "cosmossdk.io/x/consensus/types"
distr "cosmossdk.io/x/distribution"
distrkeeper "cosmossdk.io/x/distribution/keeper"
distrtypes "cosmossdk.io/x/distribution/types"
Expand Down Expand Up @@ -107,9 +110,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/msgservice"
sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
)
Expand Down
4 changes: 2 additions & 2 deletions simapp/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import (
banktypes "cosmossdk.io/x/bank/types"
_ "cosmossdk.io/x/circuit" // import for side-effects
circuittypes "cosmossdk.io/x/circuit/types"
_ "cosmossdk.io/x/consensus" // import for side-effects
consensustypes "cosmossdk.io/x/consensus/types"
_ "cosmossdk.io/x/distribution" // import for side-effects
distrtypes "cosmossdk.io/x/distribution/types"
_ "cosmossdk.io/x/epochs" // import for side-effects
Expand All @@ -67,8 +69,6 @@ import (
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/runtime"
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
)

Expand Down
2 changes: 1 addition & 1 deletion simapp/app_di.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
authzkeeper "cosmossdk.io/x/authz/keeper"
bankkeeper "cosmossdk.io/x/bank/keeper"
circuitkeeper "cosmossdk.io/x/circuit/keeper"
consensuskeeper "cosmossdk.io/x/consensus/keeper"
distrkeeper "cosmossdk.io/x/distribution/keeper"
epochskeeper "cosmossdk.io/x/epochs/keeper"
evidencekeeper "cosmossdk.io/x/evidence/keeper"
Expand All @@ -51,7 +52,6 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb"
"github.com/cosmos/cosmos-sdk/types/module"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
)

// DefaultNodeHome default home directories for the application daemon
Expand Down
5 changes: 4 additions & 1 deletion simapp/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module cosmossdk.io/simapp

go 1.22
go 1.22.2

require (
cosmossdk.io/api v0.7.4
Expand Down Expand Up @@ -45,6 +45,8 @@ require (
google.golang.org/protobuf v1.33.0
)

require cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000

require (
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.32.0-20240130113600-88ef6483f90f.1 // indirect
buf.build/gen/go/tendermint/tendermint/protocolbuffers/go v1.32.0-20231117195010-33ed361a9051.1 // indirect
Expand Down Expand Up @@ -242,6 +244,7 @@ replace (
cosmossdk.io/x/authz => ../x/authz
cosmossdk.io/x/bank => ../x/bank
cosmossdk.io/x/circuit => ../x/circuit
cosmossdk.io/x/consensus => ../x/consensus
cosmossdk.io/x/distribution => ../x/distribution
cosmossdk.io/x/epochs => ../x/epochs
cosmossdk.io/x/evidence => ../x/evidence
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/baseapp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
authtypes "cosmossdk.io/x/auth/types"
_ "cosmossdk.io/x/bank"
banktypes "cosmossdk.io/x/bank/types"
_ "cosmossdk.io/x/consensus"
_ "cosmossdk.io/x/staking"

"github.com/cosmos/cosmos-sdk/codec"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/mock"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
)

// GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts
Expand Down
7 changes: 4 additions & 3 deletions tests/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/cosmos/cosmos-sdk/tests

go 1.22

toolchain go1.22.0
go 1.22.2

require (
cosmossdk.io/api v0.7.4
Expand Down Expand Up @@ -41,13 +39,15 @@ require (
cosmossdk.io/x/auth v0.0.0-20240226161501-23359a0b6d91
cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91
cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000
cosmossdk.io/x/distribution v0.0.0-20240227221813-a248d05f70f4
cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a
cosmossdk.io/x/group v0.0.0-00010101000000-000000000000
cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000
cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000
cosmossdk.io/x/staking v0.0.0-20240226161501-23359a0b6d91
github.com/google/go-cmp v0.6.0
github.com/google/gofuzz v1.2.0
github.com/jhump/protoreflect v1.16.0
)

Expand Down Expand Up @@ -239,6 +239,7 @@ replace (
cosmossdk.io/x/authz => ../x/authz
cosmossdk.io/x/bank => ../x/bank
cosmossdk.io/x/circuit => ../x/circuit
cosmossdk.io/x/consensus => ../x/consensus
cosmossdk.io/x/distribution => ../x/distribution
cosmossdk.io/x/epochs => ../x/epochs
cosmossdk.io/x/evidence => ../x/evidence
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/bank/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
bankkeeper "cosmossdk.io/x/bank/keeper"
"cosmossdk.io/x/bank/testutil"
"cosmossdk.io/x/bank/types"
_ "cosmossdk.io/x/consensus"
_ "cosmossdk.io/x/distribution"
distrkeeper "cosmossdk.io/x/distribution/keeper"
_ "cosmossdk.io/x/gov"
Expand All @@ -35,7 +36,6 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/bank/keeper/deterministic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"cosmossdk.io/x/bank/keeper"
banktestutil "cosmossdk.io/x/bank/testutil"
banktypes "cosmossdk.io/x/bank/types"
_ "cosmossdk.io/x/consensus"
minttypes "cosmossdk.io/x/mint/types"
_ "cosmossdk.io/x/staking"

Expand All @@ -31,7 +32,6 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/distribution/appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
_ "cosmossdk.io/x/auth" // import as blank for app wiring
_ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring
_ "cosmossdk.io/x/bank" // import as blank for app wiring
_ "cosmossdk.io/x/consensus" // import as blank for app wiring
_ "cosmossdk.io/x/distribution" // import as blank for app wiring
_ "cosmossdk.io/x/mint" // import as blank for app wiring
_ "cosmossdk.io/x/protocolpool" // import as blank for app wiring
_ "cosmossdk.io/x/staking" // import as blank for app wiring

"github.com/cosmos/cosmos-sdk/testutil/configurator"
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
)

var AppConfig = configurator.NewAppConfig(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/evidence/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
_ "cosmossdk.io/x/auth" // import as blank for app wiring
_ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring
_ "cosmossdk.io/x/bank" // import as blank for app wiring
_ "cosmossdk.io/x/consensus" // import as blank for app wiring
_ "cosmossdk.io/x/evidence" // import as blank for app wiring
_ "cosmossdk.io/x/slashing" // import as blank for app wiring
_ "cosmossdk.io/x/staking" // import as blank for app wiring

"github.com/cosmos/cosmos-sdk/testutil/configurator"
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
)

var AppConfig = configurator.NewAppConfig(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/evidence/keeper/infraction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"cosmossdk.io/x/bank"
bankkeeper "cosmossdk.io/x/bank/keeper"
banktypes "cosmossdk.io/x/bank/types"
consensusparamtypes "cosmossdk.io/x/consensus/types"
"cosmossdk.io/x/evidence"
"cosmossdk.io/x/evidence/exported"
"cosmossdk.io/x/evidence/keeper"
Expand All @@ -51,7 +52,6 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/gov/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
_ "cosmossdk.io/x/auth"
authtypes "cosmossdk.io/x/auth/types"
_ "cosmossdk.io/x/bank"
_ "cosmossdk.io/x/consensus"
"cosmossdk.io/x/gov/types"
v1 "cosmossdk.io/x/gov/types/v1"
"cosmossdk.io/x/gov/types/v1beta1"
Expand All @@ -28,7 +29,6 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/configurator"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/gov/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
_ "cosmossdk.io/x/bank"
bankkeeper "cosmossdk.io/x/bank/keeper"
banktypes "cosmossdk.io/x/bank/types"
_ "cosmossdk.io/x/consensus"
"cosmossdk.io/x/gov"
"cosmossdk.io/x/gov/keeper"
"cosmossdk.io/x/gov/types"
Expand All @@ -33,7 +34,6 @@ import (
"github.com/cosmos/cosmos-sdk/testutil/configurator"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/x/consensus"
)

type suite struct {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/mint/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
_ "cosmossdk.io/x/auth" // import as blank for app wiring
_ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring
_ "cosmossdk.io/x/bank" // import as blank for app wiring
_ "cosmossdk.io/x/consensus" // import as blank for app wiring
_ "cosmossdk.io/x/mint" // import as blank for app wiring
_ "cosmossdk.io/x/staking" // import as blank for app wiring

"github.com/cosmos/cosmos-sdk/testutil/configurator"
_ "github.com/cosmos/cosmos-sdk/x/consensus" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
)

var AppConfig = configurator.NewAppConfig(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/rapidgen/rapidgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
vestingtypes "cosmossdk.io/x/auth/vesting/types"
authztypes "cosmossdk.io/x/authz"
banktypes "cosmossdk.io/x/bank/types"
consensustypes "cosmossdk.io/x/consensus/types"
disttypes "cosmossdk.io/x/distribution/types"
evidencetypes "cosmossdk.io/x/evidence/types"
feegranttypes "cosmossdk.io/x/feegrant"
Expand All @@ -45,7 +46,6 @@ import (
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
)

type GeneratedType struct {
Expand Down
Loading
Loading