Skip to content

Commit

Permalink
Merge branch 'main' into feature/pbts
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-mena committed Mar 1, 2024
2 parents 3b9f2e1 + f128c62 commit 1bfc364
Show file tree
Hide file tree
Showing 177 changed files with 5,028 additions and 3,502 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[state/store]` go-API breaking change in `PruneABCIResponses`: added parameter to force compaction. ([\#1972](https://github.com/cometbft/cometbft/pull/1972))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[state/store]` go-API breaking change in `PruneStates`: added parameter to pass the number of pruned states and return pruned entries in current pruning iteration. ([\#1972](https://github.com/cometbft/cometbft/pull/1972))
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- `[proto]` Remove stateful block data retrieval methods from the
data companion gRPC API as per
[RFC 106](https://github.com/cometbft/cometbft/blob/main/docs/references/rfc/rfc-106-separate-stateful-methods.md)
([\#2230](https://github.com/cometbft/cometbft/issues/2230)):
* `GetLatest` from `cometbft.services.block.v1.BlockService`;
* `GetLatestBlockResults` from `cometbft.services.block_results.v1.BlockResultsService`.
- `[rpc/grpc]` Remove support for stateful block data retrieval methods from the
data companion APIs as per [RFC 106](https://github.com/cometbft/cometbft/blob/main/docs/references/rfc/rfc-106-separate-stateful-methods.md)
* `GetLatestBlock` method removed from the `BlockServiceClient` interface.
* `GetLatestBlockResults` method removed from the `BlockResultServiceClient` interface.
* `GetLatest` endpoint is no longer served by `BlockServiceServer` instances.
* `GetLatestBlockResults` endpoint is no longer served by `BlockResultServiceServer` instances.
3 changes: 3 additions & 0 deletions .changelog/unreleased/breaking-changes/2246-p2p-peerset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `[p2p]` Rename `IPeerSet#List` to `Copy`, add `Random`, `ForEach` methods.
Rename `PeerSet#List` to `Copy`, add `Random`, `ForEach` methods.
([\#2246](https://github.com/cometbft/cometbft/pull/2246))
1 change: 1 addition & 0 deletions .changelog/unreleased/bug-fixes/2010-p2p-pex-shutdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[p2p/pex]` gracefully shutdown Reactor ([\#2010](https://github.com/cometbft/cometbft/pull/2010))
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/2136-fix-state-rollback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[state]` Fix rollback to a specific height
([\#2136](https://github.com/cometbft/cometbft/pull/2136))
1 change: 1 addition & 0 deletions .changelog/unreleased/features/1972-compaction-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[config]` Add configuration parameters to tweak forced compaction. ([\#1972](https://github.com/cometbft/cometbft/pull/1972))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[store]` When pruning force compaction of the database. ([\#1972](https://github.com/cometbft/cometbft/pull/1972))
1 change: 1 addition & 0 deletions .changelog/unreleased/features/1974-statestore-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[metrics]` Added metrics to monitor state store access. ([\#1974](https://github.com/cometbft/cometbft/pull/1974))
1 change: 1 addition & 0 deletions .changelog/unreleased/features/1974-store-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[metrics]` Added metrics to monitor block store access. ([\#1974](https://github.com/cometbft/cometbft/pull/1974))
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/2362-e2e-block-max-bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[e2e]` Add `block_max_bytes` option to the manifest file.
([\#2362](https://github.com/cometbft/cometbft/pull/2362))
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/2433-e2e-testnet-dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[e2e]` Add new `--testnet-dir` parameter to set a custom directory for the generated testnet files.
([\#2433](https://github.com/cometbft/cometbft/pull/2433))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[state]` avoid double-saving `FinalizeBlockResponse` for performance reasons
([\#2017](https://github.com/cometbft/cometbft/pull/2017))
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/2142-psql-optimization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Optimized the PSQL indexer
([\#2142](https://github.com/cometbft/cometbft/pull/2142)) thanks to external contributor @k0marov !
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[p2p]` make `PeerSet.Remove` more efficient (Author: @odeke-em) [\#2246](https://github.com/cometbft/cometbft/pull/2246)
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/2328-e2e-log-sent-txs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[e2e]` Log the number of transactions that were sent successfully or failed.
([\#2328](https://github.com/cometbft/cometbft/pull/2328))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `[jsonrpc]` enable HTTP basic auth in websocket client ([#2434](https://github.com/cometbft/cometbft/pull/2434))
16 changes: 9 additions & 7 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
contents: read

jobs:
check-mocks:
check-mocks-metrics:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
Expand All @@ -22,17 +22,18 @@ jobs:

- uses: actions/checkout@v4

- name: "Check generated mocks"
- name: "Check generated mocks and metrics"
run: |
set -euo pipefail
make mockery
make mockery metrics
if ! git diff --stat --exit-code ; then
git add .
if ! git diff HEAD --stat --exit-code ; then
echo ">> ERROR:"
echo ">>"
echo ">> Generated mocks require update (either Mockery or source files may have changed)."
echo ">> Ensure your tools are up-to-date, re-run 'make mockery' and update this PR."
echo ">> Generated mocks and/or metrics require update (either Mockery or source files may have changed)."
echo ">> Ensure your tools are up-to-date, re-run 'make mockery metrics' and update this PR."
echo ">>"
git diff
exit 1
Expand All @@ -55,7 +56,8 @@ jobs:
make proto-gen
if ! git diff --stat --exit-code ; then
git add .
if ! git diff HEAD --stat --exit-code ; then
echo ">> ERROR:"
echo ">>"
echo ">> Protobuf generated code requires update (either tools or .proto files may have changed)."
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: pre-commit/[email protected]
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- uses: actions/checkout@v4
- uses: pre-commit/[email protected]
5 changes: 1 addition & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ linters:
- goerr113
- golint
- gomnd
- gomoddirectives
- ifshort
- interfacebloat
- interfacer
Expand All @@ -44,9 +43,7 @@ linters:
- scopelint
- structcheck
- tagliatelle
- typecheck
# Prefer unparam over revive's unused param. It is more thorough in its checking.
- unparam
- testifylint
- varcheck
- varnamelen
- wrapcheck
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ repos:

# golangci-lint
- repo: https://github.com/golangci/golangci-lint
rev: v1.55.2
rev: v1.56.0
hooks:
- id: golangci-lint
args: [--timeout, 5m] # for CI
- id: golangci-lint-full
args: [--timeout, 10m] # for CI

# gofumpt (does not have .pre-commmit-hooks.yaml)
- repo: local
Expand Down
26 changes: 21 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,28 @@ means that you shouldn't update someone else's branch for them; even if it seems
like you're doing them a favor, you may be interfering with their git flow in
some way!)

### Formatting
### Formatting & Linting

Make sure to format your code with [gofumpt](https://github.com/mvdan/gofumpt).
To install a Git pre-commit hook, run `make gofumpt-pre-commit`. The hook
automatically applies `gofumpt` to the staged Go files, so you don't need to do
anything.
When submitting a change, please make sure to:

1. Format the code using [gofumpt](https://github.com/mvdan/gofumpt)
2. Lint the code using [golangci-lint](https://golangci-lint.run/)
3. Check the code and docs for spelling errors using [codespell](https://github.com/codespell-project/codespell).

It's recommended to install a Git pre-commit hook: `make pre-commit`. The hook will
automatically run the above steps for you every time you commit something. You
can also do this manually with `make lint`.

The pre-commit hook uses [the pre-commit framework](https://pre-commit.com/).
If you have Python 3 installed, you don't need to do anything else. Otherwise,
please refer to [the installation guide](https://pre-commit.com/#install).

In rare cases, you may want to skip the pre-commit hook. You can do so by adding
`-n` (or `--no-verify`) flag to `git commit`:

```bash
git commit -n -m "add X"
```

#### Merging Pull Requests

Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ testdata-metrics:
#? mockery: Generate test mocks
mockery:
go generate -run="./scripts/mockery_generate.sh" ./...
@go run mvdan.cc/gofumpt@latest -l -w .
.PHONY: mockery

###############################################################################
Expand All @@ -121,8 +120,8 @@ mockery:

#? check-proto-deps: Check protobuf deps
check-proto-deps:
ifeq (,$(shell which protoc-gen-gogofaster))
@go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest
ifeq (,$(shell which protoc-gen-gocosmos))
@go install github.com/cosmos/gogoproto/protoc-gen-gocosmos@latest
endif
.PHONY: check-proto-deps

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ See the [install guide](docs/tutorials/install.md).
### Quick Start

- [Single node](docs/tutorials/quick-start.md)
- [Local cluster using docker-compose](./docs/networks/docker-compose.md)
- [Local cluster using docker-compose](./docs/guides/networks/docker-compose.md)

## Contributing

Expand Down Expand Up @@ -147,15 +147,14 @@ Currently supported versions include:
### Applications

- [Cosmos Hub](https://hub.cosmos.network/)
- [Terra](https://www.terra.money/)
- [Celestia](https://celestia.org/)
- [Anoma](https://anoma.network/)
- [Vocdoni](https://developer.vocdoni.io/)

### Research

Below are links to the original Tendermint consensus algorithm and relevant
whitepapers which CometBFT will continue to build on.
whitepapers, which CometBFT will continue to build on.

- [The latest gossip on BFT consensus](https://arxiv.org/abs/1807.04938)
- [Master's Thesis on Tendermint](https://atrium.lib.uoguelph.ca/xmlui/handle/10214/9769)
Expand Down
2 changes: 1 addition & 1 deletion abci/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type ErrUnknownAbciTransport struct {
}

func (e ErrUnknownAbciTransport) Error() string {
return fmt.Sprintf("unknown abci transport: %s", e.Transport)
return "unknown abci transport: " + e.Transport
}

type ErrUnexpectedResponse struct {
Expand Down
10 changes: 5 additions & 5 deletions abci/example/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,11 @@ func parseValidatorTx(tx []byte) (string, []byte, int64, error) {
tx = tx[len(ValidatorPrefix):]

// get the pubkey and power
typeKeyAndPower := strings.Split(string(tx), "!")
if len(typeKeyAndPower) != 3 {
return "", nil, 0, fmt.Errorf("expected 'pubkeytype!pubkey!power'. Got %v", typeKeyAndPower)
typePubKeyAndPower := strings.Split(string(tx), "!")
if len(typePubKeyAndPower) != 3 {
return "", nil, 0, fmt.Errorf("expected 'pubkeytype!pubkey!power'. Got %v", typePubKeyAndPower)
}
keytype, pubkeyS, powerS := typeKeyAndPower[0], typeKeyAndPower[1], typeKeyAndPower[2]
keyType, pubkeyS, powerS := typePubKeyAndPower[0], typePubKeyAndPower[1], typePubKeyAndPower[2]

// decode the pubkey
pubkey, err := base64.StdEncoding.DecodeString(pubkeyS)
Expand All @@ -441,7 +441,7 @@ func parseValidatorTx(tx []byte) (string, []byte, int64, error) {
return "", nil, 0, fmt.Errorf("power can not be less than 0, got %d", power)
}

return keytype, pubkey, power, nil
return keyType, pubkey, power, nil
}

// add, update, or remove a validator.
Expand Down
2 changes: 1 addition & 1 deletion abci/server/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type ErrUnknownServerType struct {
}

func (e ErrUnknownServerType) Error() string {
return fmt.Sprintf("unknown server type %s", e.ServerType)
return "unknown server type " + e.ServerType
}

// ErrConnectionDoesNotExist is returned when trying to access non-existent network connection.
Expand Down
Loading

0 comments on commit 1bfc364

Please sign in to comment.