Skip to content

Commit

Permalink
Merge branch 'bez/fix-sqlite-ss-prune' of github.com:cosmos/cosmos-sd…
Browse files Browse the repository at this point in the history
…k into bez/fix-sqlite-ss-prune
  • Loading branch information
alexanderbez committed Nov 16, 2023
2 parents b65a4c1 + 930dbd4 commit cb6aa04
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/cosmos/projects/26
# add all issues opened to the issue board for triage and assignment
github-token: ${{ secrets.PERSONAL_TOKEN }}
labeled: T:Sprint,needs-triage
44 changes: 18 additions & 26 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,32 @@ jobs:
check-latest: true
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
Makefile
**/Makefile
.golangci.yml
- name: run linting (long)
if: env.GIT_DIFF
id: lint_long
run: |
nix develop -c make lint
env:
NIX: 1
- uses: technote-space/get-diff-action@v6.1.2
if: steps.lint_long.outcome == 'skipped'
with:
PATTERNS: |
**/*.go
go.mod
go.sum
**/go.mod
**/go.sum
# with:
# PATTERNS: |
# Makefile
# **/Makefile
# .golangci.yml
- name: run linting (long)
# if: env.GIT_DIFF
# id: lint_long
- name: run linting (short)
if: steps.lint_long.outcome == 'skipped' && env.GIT_DIFF
run: |
nix develop -c make lint
env:
GIT_DIFF: ${{ env.GIT_DIFF }}
LINT_DIFF: 1
NIX: 1
# - uses: technote-space/get-diff-action@v6.1.2
# if: steps.lint_long.outcome == 'skipped'
# id: git_diff_all
# with:
# PATTERNS: |
# **/*.go
# go.mod
# go.sum
# **/go.mod
# **/go.sum
# - name: run linting (short)
# if: steps.lint_long.outcome == 'skipped' && env.GIT_DIFF
# run: |
# nix develop -c make lint
# env:
# GIT_DIFF: ${{ env.GIT_DIFF }}
# LINT_DIFF: 1
# NIX: 1
26 changes: 0 additions & 26 deletions .github/workflows/pr-reviews.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/proto-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.28.0
- uses: bufbuild/buf-setup-action@v1.28.1
- uses: bufbuild/buf-push-action@v1
with:
input: "proto"
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.28.0
- uses: bufbuild/buf-setup-action@v1.28.1
- 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.28.0
- uses: bufbuild/buf-setup-action@v1.28.1
- uses: bufbuild/buf-breaking-action@v1
with:
input: "proto"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (baseapp) [#18486](https://github.com/cosmos/cosmos-sdk/pull/18486) Fixed FinalizeBlock calls not being passed to ABCIListeners
* (baseapp) [#18383](https://github.com/cosmos/cosmos-sdk/pull/18383) Fixed a data race inside BaseApp.getContext, found by end-to-end (e2e) tests.
* (client/server) [#18345](https://github.com/cosmos/cosmos-sdk/pull/18345) Consistently set viper prefix in client and server. It defaults for the binary name for both client and server.
* (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test.
Expand Down
8 changes: 8 additions & 0 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,14 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons
if res != nil {
res.AppHash = app.workingHash()
}

// call the streaming service hooks with the FinalizeBlock messages
for _, streamingListener := range app.streamingManager.ABCIListeners {
if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil {
app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err)
}
}

return res, err
}

Expand Down
2 changes: 1 addition & 1 deletion client/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ It is possible to use `AutoCLI` for non module commands. The trick is still to i
For example, here is how the SDK does it for `cometbft` gRPC commands:

```go reference
https://github.com/cosmos/cosmos-sdk/blob/julien/autocli-comet/client/grpc/cmtservice/autocli.go#L52-L71
https://github.com/cosmos/cosmos-sdk/blob/main/client/grpc/cmtservice/autocli.go#L52-L71
```

## Summary
Expand Down
14 changes: 11 additions & 3 deletions docs/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
## Create modules pages
for D in ../x/*; do
if [ -d "${D}" ]; then
MODDOC=build/modules/$(echo $D | awk -F/ '{print $NF}')
rm -rf $MODDOC
mkdir -p $MODDOC && cp -r $D/README.md "$_"
DIR_NAME=$(basename "$D")

# Skip specific directories
if [[ "$DIR_NAME" != "counter" ]]; then
MODULE_DIRECTORY=build/modules/$DIR_NAME
rm -rf "$MODULE_DIRECTORY"
mkdir -p "$MODULE_DIRECTORY"
if [ -f "$D"/README.md ]; then
cp -r "$D"/README.md "$MODULE_DIRECTORY"
fi
fi
fi
done

Expand Down
49 changes: 28 additions & 21 deletions scripts/go-lint-all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ set -e -o pipefail
REPO_ROOT="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )"
export REPO_ROOT

LINT_TAGS="e2e,ledger,test_ledger_mock"
if [[ ! -z "${NIX:-}" ]]; then
LINT_TAGS+=",rocksdb"
fi
export LINT_TAGS

lint_module() {
local root="$1"
shift
cd "$(dirname "$root")" &&
echo "linting $(grep "^module" go.mod) [$(date -Iseconds -u)]" &&
if [[ -z "${NIX:-}" ]]; then
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=e2e,ledger,test_ledger_mock
if [ -f $root ]; then
cd "$(dirname "$root")"
else
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=rocksdb,e2e,ledger,test_ledger_mock
cd "$REPO_ROOT/$root"
fi
echo "linting $(grep "^module" go.mod) [$(date -Iseconds -u)]"
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=${LINT_TAGS}

# always lint simapp with app_v1 build tag, otherwise it never gets linted
if [[ "$(grep "^module" go.mod)" == "module cosmossdk.io/simapp" ]]; then
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=app_v1
Expand All @@ -24,31 +31,31 @@ export -f lint_module

# if LINT_DIFF env is set, only lint the files in the current commit otherwise lint all files
if [[ -z "${LINT_DIFF:-}" ]]; then
find "${REPO_ROOT}" -type f -name go.mod -print0 |
xargs -0 -I{} bash -c 'lint_module "$@"' _ {} "$@"
find "${REPO_ROOT}" -type f -name go.mod -print0 | xargs -0 -I{} bash -c 'lint_module "$@"' _ {} "$@"
else
if [[ -z $GIT_DIFF ]]; then
GIT_DIFF=$(git diff --name-only --diff-filter=d | grep \.go$ | grep -v \.pb\.go$) || true
GIT_DIFF=$(git diff --name-only) || true
fi

if [[ -z "$GIT_DIFF" ]]; then
echo "no files to lint"
exit 0
fi

for f in $(dirname $(echo "$GIT_DIFF" | tr -d "'") | uniq); do
echo "linting $f [$(date -Iseconds -u)]" &&
cd $f &&
if [[ (-z "${NIX:-}" && $f != store) || $f == "tools/"* ]]; then
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=e2e,ledger,test_ledger_mock
else
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=rocksdb,e2e,ledger,test_ledger_mock
fi
GIT_DIFF=$(echo $GIT_DIFF | tr -d "'" | tr ' ' '\n' | grep '\.go$' | grep -v '\.pb\.go$' | grep -Eo '^[^/]+\/[^/]+' | uniq)

if [[ $f == simapp || $f == simapp/simd/cmd ]]; then
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=app_v1
lint_sdk=false
for dir in ${GIT_DIFF[@]}; do
if [[ ! -f "$REPO_ROOT/$dir/go.mod" ]]; then
lint_sdk=true
else
lint_module $dir "$@"
fi

cd $REPO_ROOT
done
fi

if [[ $lint_sdk ]]; then
cd "$REPO_ROOT"
echo "linting github.com/cosmos/cosmos-sdk [$(date -Iseconds -u)]"
golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --build-tags=${LINT_TAGS}
fi
fi
12 changes: 9 additions & 3 deletions x/auth/client/cli/tx_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {

// sign the txs
from, _ := cmd.Flags().GetString(flags.FlagFrom)
sigTxOrMultisig(clientCtx, txBuilder, txFactory, from, multisigKey)
err := sigTxOrMultisig(clientCtx, txBuilder, txFactory, from, multisigKey)
if err != nil {
return err
}

sigOnly, _ := cmd.Flags().GetBool(flagSigOnly)
json, err := marshalSignatureJSON(txCfg, txBuilder.GetTx(), sigOnly)
Expand All @@ -170,7 +173,10 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {

// sign the txs
from, _ := cmd.Flags().GetString(flags.FlagFrom)
sigTxOrMultisig(clientCtx, txBuilder, txFactory, from, multisigKey)
err = sigTxOrMultisig(clientCtx, txBuilder, txFactory, from, multisigKey)
if err != nil {
return err
}

printSigOnly, _ := cmd.Flags().GetBool(flagSigOnly)
json, err := marshalSignatureJSON(txCfg, txBuilder.GetTx(), printSigOnly)
Expand All @@ -185,7 +191,7 @@ func makeSignBatchCmd() func(cmd *cobra.Command, args []string) error {
}
}

func sigTxOrMultisig(clientCtx client.Context, txBuilder client.TxBuilder, txFactory tx.Factory, from string, multisigKey string) (err error) {
func sigTxOrMultisig(clientCtx client.Context, txBuilder client.TxBuilder, txFactory tx.Factory, from, multisigKey string) (err error) {
if multisigKey == "" {
err = sign(clientCtx, txBuilder, txFactory, from)
} else {
Expand Down
7 changes: 3 additions & 4 deletions x/gov/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import (
// SubmitProposal creates a new proposal given an array of messages
func (keeper Keeper) SubmitProposal(ctx context.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress, expedited bool) (v1.Proposal, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)


// This method checks that all message metadata, summary and title
// has te expected length defined in the module configuration.
// This method checks that all message metadata, summary and title
// has te expected length defined in the module configuration.
if err := keeper.validateProposalLengths(metadata, title, summary); err != nil {
return v1.Proposal{}, err
return v1.Proposal{}, err
}

// Will hold a string slice of all Msg type URLs.
Expand Down
1 change: 1 addition & 0 deletions x/mint/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
mintv1beta1 "cosmossdk.io/api/cosmos/mint/v1beta1"

"github.com/cosmos/cosmos-sdk/version"
)

Expand Down
1 change: 0 additions & 1 deletion x/staking/keeper/cons_pubkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func (k Keeper) setConsPubKeyRotationHistory(
ctx context.Context, valAddr sdk.ValAddress,
oldPubKey, newPubKey *codectypes.Any, fee sdk.Coin,
) error {

sdkCtx := sdk.UnwrapSDKContext(ctx)
height := uint64(sdkCtx.BlockHeight())
history := types.ConsPubKeyRotationHistory{
Expand Down

0 comments on commit cb6aa04

Please sign in to comment.