Skip to content

Commit

Permalink
Merge branch 'main' into alex/sims2
Browse files Browse the repository at this point in the history
* main: (48 commits)
  build(deps): add missing replaces and remove unnecessary ones (#21033)
  build(deps): Bump bufbuild/buf-setup-action from 1.34.0 to 1.35.0 (#21028)
  chore: fix some comments for struct field (#21027)
  chore(x): replace `fmt.Errorf` without parameters with `errors.New` (#21032)
  chore: fix errors reported by running `make lint` (#21015)
  ci: skip spelling check in go.mod/go.sum (#21021)
  chore(all)!: use gogoproto/any instead of codec/types/any (#21013)
  chore(server/v2/cometbft): ensure consistent dash-case in app.toml (#21018)
  docs(server): wrong function comments (#21017)
  refactor(storev2): update snapshot manager and migration manager tests (#20441)
  feat(server/v2/cometbft): config (#20989)
  refactor: set `help` as default target of Makefile (#21011)
  fix(simapp): duplicated import (#21014)
  chore(docs): fix functions and struct comments (#21010)
  fix(simapp/v2): panic with testnet init-files command (#21012)
  fix: make help won't work (#21005)
  fix: NewIntegrationApp does not write default genesis to state (#21006)
  chore(x/staking,x/upgrade): replace `fmt.Errorf` without parameters with `errors.New` (#21004)
  chore: prepare depinject 1.0.0 (#21001)
  docs: Fix typos in RFC Creation Process (#20998)
  ...
  • Loading branch information
alpe committed Jul 23, 2024
2 parents 97179f5 + 544623f commit a4c7014
Show file tree
Hide file tree
Showing 463 changed files with 9,483 additions and 2,044 deletions.
3 changes: 2 additions & 1 deletion .github/.codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ pullrequest
keypair
pastTime
hasTables
Nam
Nam
EyT
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ updates:
labels:
- "A:automerge"
- dependencies
- package-ecosystem: gomod
directory: "/indexer/postgres"
schedule:
interval: weekly
day: wednesday
time: "01:53"
labels:
- "A:automerge"
- dependencies
- package-ecosystem: gomod
directory: "/indexer/postgres/tests"
schedule:
interval: weekly
day: wednesday
time: "01:53"
labels:
- "A:automerge"
- dependencies
- package-ecosystem: gomod
directory: "/schema"
schedule:
Expand Down
12 changes: 12 additions & 0 deletions .github/pr_labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
- orm/**/*
"C:schema":
- schema/**/*
"C:indexer/postgres":
- indexer/postgres/**/*
"C:x/accounts":
- x/accounts/**/*
"C:x/accounts/multisig":
Expand Down Expand Up @@ -72,6 +74,16 @@
- x/upgrade/**/*
"C:x/epochs":
- x/epochs/**/*
"C:server/v2":
- server/v2/**/*
"C:server/v2 stf":
- server/v2/stf/**/*
"C:server/v2 appmanager":
- server/v2/appmanager/**/*
"C:server/v2 cometbft":
- server/v2/cometbft/**/*
"C:server/v2 api":
- server/v2/api/**/*
"Type: ADR":
- docs/architecture/**/*
"Type: Build":
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/misspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
continue-on-error: true
run: |
sudo apt-get install codespell -y
codespell -w --skip="*.pulsar.go,*.pb.go,*.pb.gw.go,*.cosmos_orm.go,*.json,*.git,*.js,crypto/keys,fuzz,*.h,proto/tendermint,*.bin" --ignore-words=.github/.codespellignore
codespell -w --skip="*.pulsar.go,*.pb.go,*.pb.gw.go,*.cosmos_orm.go,*.json,*.git,*.js,crypto/keys,fuzz,*.h,proto/tendermint,*.bin,go.sum,go.mod" --ignore-words=.github/.codespellignore
- uses: peter-evans/create-pull-request@v6
if: github.event_name != 'pull_request'
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.34.0
- uses: bufbuild/buf-setup-action@v1.35.0
- uses: bufbuild/buf-lint-action@v1
with:
input: "proto"
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.34.0
- uses: bufbuild/buf-setup-action@v1.35.0
- uses: bufbuild/buf-breaking-action@v1
with:
input: "proto"
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,42 @@ jobs:
with:
projectBaseDir: schema/

test-indexer-postgres:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: true
cache-dependency-path: indexer/postgres/tests/go.sum
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
indexer/postgres/**/*.go
indexer/postgres/go.mod
indexer/postgres/go.sum
indexer/postgres/tests/go.mod
indexer/postgres/tests/go.sum
- name: tests
if: env.GIT_DIFF
run: |
cd indexer/postgres
go test -mod=readonly -timeout 30m -coverprofile=cov.out -covermode=atomic ./...
cd tests
go test -mod=readonly -timeout 30m -coverprofile=cov.out -covermode=atomic -coverpkg=cosmossdk.io/indexer/postgres ./...
cd ..
go run github.com/dylandreimerink/gocovmerge/cmd/gocovmerge@latest cov.out tests/cov.out > coverage.out
- 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: indexer/postgres/

test-simapp:
runs-on: ubuntu-latest
steps:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/v2-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ concurrency:
cancel-in-progress: true

jobs:
server-v2:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
server/v2/*.go
server/v2/go.mod
server/v2/go.sum
server/v2/testdata/*.toml
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
cd server/v2 && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock'
stf:
runs-on: ubuntu-latest
strategy:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (baseapp) [#20208](https://github.com/cosmos/cosmos-sdk/pull/20208) Skip running validateBasic for rechecking txs.
* (baseapp) [#20380](https://github.com/cosmos/cosmos-sdk/pull/20380) Enhanced OfferSnapshot documentation.
* (client) [#20771](https://github.com/cosmos/cosmos-sdk/pull/20771) Remove `ReadDefaultValuesFromDefaultClientConfig` from `client` package. (It was introduced in `v0.50.6` as a quick fix).
* (grpcserver) [#20945](https://github.com/cosmos/cosmos-sdk/pull/20945) Adds error handling for out-of-gas panics in grpc query handlers.

### Bug Fixes

Expand All @@ -115,9 +116,14 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* [#19833](https://github.com/cosmos/cosmos-sdk/pull/19833) Fix some places in which we call Remove inside a Walk.
* [#19851](https://github.com/cosmos/cosmos-sdk/pull/19851) Fix some places in which we call Remove inside a Walk (x/staking and x/gov).
* [#20939](https://github.com/cosmos/cosmos-sdk/pull/20939) Fix collection reverse iterator to include `pagination.key` in the result.
* (client/grpc) [#20969](https://github.com/cosmos/cosmos-sdk/pull/20969) Fix `node.NewQueryServer` method not setting `cfg`.
* (testutil/integration) [#21006](https://github.com/cosmos/cosmos-sdk/pull/21006) Fix `NewIntegrationApp` method not writing default genesis to state

### API Breaking Changes

* (client) [#20976](https://github.com/cosmos/cosmos-sdk/pull/20976) Simplified command initialization by removing unnecessary parameters such as `txConfig` and `addressCodec`.
* Remove parameter `txConfig` from `genutilcli.Commands`,`genutilcli.CommandsWithCustomMigrationMap`,`genutilcli.GenTxCmd`.
* Remove parameter `addressCodec` from `genutilcli.GenTxCmd`,`genutilcli.AddGenesisAccountCmd`,`stakingcli.BuildCreateValidatorMsg`.
* (x/genutil) [#20740](https://github.com/cosmos/cosmos-sdk/pull/20740) Update `genutilcli.Commands` and `genutilcli.CommandsWithCustomMigrationMap` to take the genesis module and abstract the module manager.
* (server) [#20422](https://github.com/cosmos/cosmos-sdk/pull/20422) Deprecated `ServerContext`. To get `cmtcfg.Config` from cmd, use `client.GetCometConfigFromCmd(cmd)` instead of `server.GetServerContextFromCmd(cmd).Config`
* (types)[#20369](https://github.com/cosmos/cosmos-sdk/pull/20369) The signature of `HasAminoCodec` has changed to accept a `core/legacy.Amino` interface instead of `codec.LegacyAmino`.
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ include scripts/build/testing.mk
include scripts/build/documentation.mk
include scripts/build/build.mk

.DEFAULT_GOAL := help

###############################################################################
### Tools & Dependencies ###
###############################################################################
Expand Down
4 changes: 3 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ There is no longer a need for the Cosmos SDK to host these protos for itself and
That package containing proto v2 generated code, but the SDK now uses [buf generated go SDK instead](https://buf.build/docs/bsr/generated-sdks/go).
If you were depending on `cosmossdk.io/api/tendermint`, please use the buf generated go SDK instead, or ask CometBFT host the generated proto v2 code.

The `codectypes.Any` has moved to `github.com/cosmos/gogoproto/types/any`. Module developers can update the `buf.gen.gogo.yaml` configuration files by adjusting the corresponding `opt` option to `Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any` for directly mapping the`Any` type to its new location. This change is optional as `codectypes.Any` is aliased to `gogoproto.Any` in the SDK.
The `codectypes.Any` has moved to `github.com/cosmos/gogoproto/types/any`. Module developers need to update the `buf.gen.gogo.yaml` configuration files by adjusting the corresponding `opt` option to `Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any` for directly mapping the`Any` type to its new location. This change is optional, but recommended, as `codectypes.Any` is aliased to `gogoproto.Any` in the SDK.

Also, any usages of the interfaces `AnyUnpacker` and `UnpackInterfacesMessage` must be replaced with the interfaces of the same name in the `github.com/cosmos/gogoproto/types/any` package.

### Modules

Expand Down
4 changes: 2 additions & 2 deletions api/cosmos/base/node/v1beta1/query.pulsar.go

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

2 changes: 1 addition & 1 deletion api/cosmos/circuit/v1/query.pulsar.go

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

4 changes: 2 additions & 2 deletions api/cosmos/circuit/v1/query_grpc.pb.go

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

2 changes: 1 addition & 1 deletion api/cosmos/nft/v1beta1/query.pulsar.go

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

4 changes: 2 additions & 2 deletions api/cosmos/nft/v1beta1/query_grpc.pb.go

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

2 changes: 1 addition & 1 deletion baseapp/abci_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func validateExtendedCommitAgainstLastCommit(ec abci.ExtendedCommitInfo, lc come
}
return -int(vote1.Validator.Power - vote2.Validator.Power) // vp sorted in descending order
}) {
return fmt.Errorf("extended commit votes are not sorted by voting power")
return errors.New("extended commit votes are not sorted by voting power")
}

addressCache := make(map[string]struct{}, len(ec.Votes))
Expand Down
17 changes: 0 additions & 17 deletions baseapp/expected_keepers.go

This file was deleted.

13 changes: 13 additions & 0 deletions baseapp/grpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"google.golang.org/grpc/status"

errorsmod "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -67,6 +68,18 @@ func (app *BaseApp) RegisterGRPCServer(server gogogrpc.Server) {

app.logger.Debug("gRPC query received of type: " + fmt.Sprintf("%#v", req))

// Catch an OutOfGasPanic caused in the query handlers
defer func() {
if r := recover(); r != nil {
switch rType := r.(type) {
case storetypes.ErrorOutOfGas:
err = errorsmod.Wrapf(sdkerrors.ErrOutOfGas, "Query gas limit exceeded: %v, out of gas in location: %v", sdkCtx.GasMeter().Limit(), rType.Descriptor)
default:
panic(r)
}
}
}()

return handler(grpcCtx, req)
}

Expand Down
4 changes: 2 additions & 2 deletions baseapp/oe/optimistic_execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
"github.com/stretchr/testify/assert"

"cosmossdk.io/core/log"
coretesting "cosmossdk.io/core/testing"
)

func testFinalizeBlock(_ context.Context, _ *abci.FinalizeBlockRequest) (*abci.FinalizeBlockResponse, error) {
return nil, errors.New("test error")
}

func TestOptimisticExecution(t *testing.T) {
oe := NewOptimisticExecution(log.NewNopLogger(), testFinalizeBlock)
oe := NewOptimisticExecution(coretesting.NewNopLogger(), testFinalizeBlock)
assert.True(t, oe.Enabled())
oe.Execute(&abci.ProcessProposalRequest{
Hash: []byte("test"),
Expand Down
3 changes: 2 additions & 1 deletion client/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

import (
"crypto/tls"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -68,7 +69,7 @@ func CreateClientConfig(ctx client.Context, customClientTemplate string, customC
}

if (customClientTemplate != "" && customConfig == nil) || (customClientTemplate == "" && customConfig != nil) {
return ctx, fmt.Errorf("customClientTemplate and customConfig should be both nil or not nil")
return ctx, errors.New("customClientTemplate and customConfig should be both nil or not nil")
}

if customClientTemplate != "" {
Expand Down
2 changes: 1 addition & 1 deletion client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29831,7 +29831,7 @@ paths:
/cosmos/nft/v1beta1/balance:
get:
summary: >-
BalancebyQueryString queries the number of NFTs of a given class owned
BalanceByQueryString queries the number of NFTs of a given class owned
by the owner, same as balanceOf in ERC721
operationId: BalanceByQueryString
responses:
Expand Down
Loading

0 comments on commit a4c7014

Please sign in to comment.