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

Apply Tendermint v0.33.5 #99

Merged
merged 33 commits into from
Jul 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8f4080e
abci/server: print panic & stack trace to STDERR if logger is not set
melekes Apr 22, 2020
ea2d3f4
test: fix p2p test build breakage caused by Debian testing (#4880)
erikgrinaker May 26, 2020
4ddf549
types: implement Header#ValidateBasic (#4638)
alexanderbez Apr 24, 2020
9550e8a
lite2: fix TestVerifyAdjacentHeaders (#4884)
melekes May 26, 2020
24c39aa
Makefile: parse TENDERMINT_BUILD_OPTIONS (#4738) (#4883)
erikgrinaker May 26, 2020
642dcd4
lite: fix HTTP provider error handling (#4882)
erikgrinaker May 26, 2020
e080280
privval: remove deprecated `OldFilePV` (#4889)
melekes May 26, 2020
901ce19
blockchain/v2: backport fixes (#4887)
erikgrinaker May 26, 2020
e1b3903
types: return an error if voting power overflows
melekes May 4, 2020
2903598
rpc: handle panics during panic handling (#4888)
erikgrinaker May 27, 2020
62018d9
mempool: allow ReapX and CheckTx functions to run in parallel
melekes May 8, 2020
e4e4bf6
pex: use highwayhash for pex bucket
melekes May 8, 2020
cba2438
privval: retry GetPubKey/SignVote/SignProposal N times before
melekes May 11, 2020
7772cdc
rpc: use a struct to wrap all the global objects
melekes May 13, 2020
e8b4226
rpc: refactor lib folder (#4836)
melekes May 13, 2020
69b6e0e
rpc/core: do not lock ConsensusState mutex
melekes May 15, 2020
e406025
p2p: return masked IP (not the actual IP) in addrbook#groupKey
melekes May 19, 2020
64c7771
lite2: fix pivot height during bisection
cmwaters May 27, 2020
d9c2f01
proto: add proto files for ibc unblock (#4853) (#4906)
tac0turtle May 27, 2020
e22acc0
prepare v0.33.5 RC2
tessr May 27, 2020
8fb9317
Merge tag 'v0.33.5'
zemyblue Jun 25, 2020
1d0d5e3
add `GenerateVRFProof` function for `RetrySignerClient`
zemyblue Jun 25, 2020
813628b
Merge commit '0c3a7c93a6b3792c0b00e72b131da22edae87aa4' into apply_v0…
zemyblue Jun 26, 2020
bb9e944
fix lint warning.
zemyblue Jun 26, 2020
067632a
Remove `CGO_ENABLED` in Makefile.
zemyblue Jun 26, 2020
0701253
fix contract_test error in circleCI
zemyblue Jun 26, 2020
715d10c
fix contract_test error in circleCI
zemyblue Jun 29, 2020
5855d44
fix contract_test error in circleCI
zemyblue Jun 29, 2020
abcaf24
types: return an error if voting power overflows in VerifyCommitTrus…
zemyblue Jun 29, 2020
60bf694
Add `VoterSet` protobuf and set to State message
zemyblue Jul 1, 2020
a76cf5d
Add `VoterParams` protobuf and set to State message
zemyblue Jul 1, 2020
e971c73
Fix type error
zemyblue Jul 1, 2020
b131d02
Apply the PR review feedback
zemyblue Jul 2, 2020
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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ jobs:
parallelism: 1
steps:
- checkout_with_submodules
- setup_bls_library_build
- run:
name: Test RPC endpoints against swagger documentation
command: |
Expand Down
58 changes: 58 additions & 0 deletions CHANGELOG_OF_TENDERMINT.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Changelog

## v.0.33.5

Special thanks to our external contributor on this release: @tau3

Friendly reminder: We have a [bug bounty program](https://hackerone.com/tendermint).

### BREAKING CHANGES:

- Go API

- [privval] [\#4744](https://github.com/tendermint/tendermint/pull/4744) Remove deprecated `OldFilePV` (@melekes)
- [mempool] [\#4759](https://github.com/tendermint/tendermint/pull/4759) Modify `Mempool#InitWAL` to return an error (@melekes)
- [node] [\#4832](https://github.com/tendermint/tendermint/pull/4832) `ConfigureRPC` returns an error (@melekes)
- [rpc] [\#4836](https://github.com/tendermint/tendermint/pull/4836) Overhaul `lib` folder (@melekes)
Move lib/ folder to jsonrpc/.
Rename:
rpc package -> jsonrpc package
rpcclient package -> client package
rpcserver package -> server package
JSONRPCClient to Client
JSONRPCRequestBatch to RequestBatch
JSONRPCCaller to Caller
StartHTTPServer to Serve
StartHTTPAndTLSServer to ServeTLS
NewURIClient to NewURI
NewJSONRPCClient to New
NewJSONRPCClientWithHTTPClient to NewWithHTTPClient
NewWSClient to NewWS
Unexpose ResponseWriterWrapper
Remove unused http_params.go


### FEATURES:

- [pex] [\#4439](https://github.com/tendermint/tendermint/pull/4439) Use highwayhash for pex buckets (@tau3)

### IMPROVEMENTS:

- [abci/server] [\#4719](https://github.com/tendermint/tendermint/pull/4719) Print panic & stack trace to STDERR if logger is not set (@melekes)
- [types] [\#4638](https://github.com/tendermint/tendermint/pull/4638) Implement `Header#ValidateBasic` (@alexanderbez)
- [buildsystem] [\#4378](https://github.com/tendermint/tendermint/pull/4738) Replace build_c and install_c with TENDERMINT_BUILD_OPTIONS parsing. The following options are available:
- nostrip: don't strip debugging symbols nor DWARF tables.
- cleveldb: use cleveldb as db backend instead of goleveldb.
- race: pass -race to go build and enable data race detection.
- [mempool] [\#4759](https://github.com/tendermint/tendermint/pull/4759) Allow ReapX and CheckTx functions to run in parallel (@melekes)
- [rpc/core] [\#4844](https://github.com/tendermint/tendermint/pull/4844) Do not lock consensus state in `/validators`, `/consensus_params` and `/status` (@melekes)

### BUG FIXES:

- [blockchain/v2] [\#4761](https://github.com/tendermint/tendermint/pull/4761) Fix excessive CPU usage caused by spinning on closed channels (@erikgrinaker)
- [blockchain/v2] Respect `fast_sync` option (@erikgrinaker)
- [light] [\#4741](https://github.com/tendermint/tendermint/pull/4741) Correctly return `ErrSignedHeaderNotFound` and `ErrValidatorSetNotFound` on corresponding RPC errors (@erikgrinaker)
- [rpc] [\#4805](https://github.com/tendermint/tendermint/issues/4805) Attempt to handle panics during panic recovery (@erikgrinaker)
- [types] [\#4764](https://github.com/tendermint/tendermint/pull/4764) Return an error if voting power overflows in `VerifyCommitTrusting` (@melekes)
- [privval] [\#4812](https://github.com/tendermint/tendermint/pull/4812) Retry `GetPubKey/SignVote/SignProposal` a few times before returning an error (@melekes)
- [p2p] [\#4847](https://github.com/tendermint/tendermint/pull/4847) Return masked IP (not the actual IP) in addrbook#groupKey (@melekes)


## v0.33.4

- Nodes are no longer guaranteed to contain all blocks up to the latest height. The ABCI app can now control which blocks to retain through the ABCI field `ResponseCommit.retain_height`, all blocks and associated data below this height will be removed.
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

- Go API

- Blockchain Protocol

### FEATURES:
- [BLS] [\#81](https://github.com/line/tendermint/issues/81) Modify to generate at the same time as Ed25519 key generation

Expand Down
2 changes: 1 addition & 1 deletion DOCKER/Dockerfile.build_c-amazonlinux
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ ENV GOPATH=/go/src
RUN mkdir -p /tendermint
WORKDIR /tendermint

CMD ["/usr/bin/make", "build_c"]
CMD ["/usr/bin/make", "build", "TENDERMINT_BUILD_OPTIONS=cleveldb"]

57 changes: 31 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ PACKAGES=$(shell go list ./...)
SRCPATH=$(shell pwd)
OUTPUT?=build/tendermint

BUILD_TAGS?='tendermint'
CGO_OPTPTION=0
BUILD_TAGS?=tendermint
LIBSODIUM_TARGET=
PREPARE_LIBSODIUM_TARGET=
ifeq ($(LIBSODIUM), 1)
BUILD_TAGS='libsodium tendermint'
CGO_OPTPTION=1
LIBSODIUM_TARGET=libsodium
ifneq ($(OS), Windows_NT)
ifeq ($(shell uname -s), Linux)
Expand All @@ -22,7 +20,26 @@ BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
HTTPS_GIT := https://github.com/tendermint/tendermint.git
DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuild/buf

all: check build test install
# handle nostrip
ifeq (,$(findstring nostrip,$(TENDERMINT_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
LD_FLAGS += -s -w
endif

# handle race
ifeq (race,$(findstring race,$(TENDERMINT_BUILD_OPTIONS)))
BUILD_FLAGS += -race
endif

# handle cleveldb
ifeq (cleveldb,$(findstring cleveldb,$(TENDERMINT_BUILD_OPTIONS)))
BUILD_TAGS += cleveldb
endif

# allow users to pass additional flags via the conventional LDFLAGS variable
LD_FLAGS += $(LDFLAGS)

all: check $(LIBSODIUM_TARGET) build test install
.PHONY: all

# The below include contains the tools.
Expand All @@ -34,25 +51,13 @@ include tests.mk
###############################################################################

build: $(LIBSODIUM_TARGET)
CGO_ENABLED=$(CGO_OPTION) go build $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint/
CGO_ENABLED=1 go build $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o $(OUTPUT) ./cmd/tendermint/
.PHONY: build

build_c: $(LIBSODIUM_TARGET)
CGO_ENABLED=$(CGO_OPTION) go build $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" -o $(OUTPUT) ./cmd/tendermint/
.PHONY: build_c

build_race: $(LIBSODIUM_TARGET)
CGO_ENABLED=$(CGO_OPTION) go build -race $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint
.PHONY: build_race

install:
CGO_ENABLED=$(CGO_OPTION) go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
CGO_ENABLED=1 go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
.PHONY: install

install_c:
CGO_ENABLED=$(CGO_OPTION) go install $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" ./cmd/tendermint
.PHONY: install_c

###############################################################################
### Protobuf ###
###############################################################################
Expand Down Expand Up @@ -156,15 +161,15 @@ gen_certs: clean_certs
certstrap init --common-name "tendermint.com" --passphrase ""
certstrap request-cert --common-name "server" -ip "127.0.0.1" --passphrase ""
certstrap sign "server" --CA "tendermint.com" --passphrase ""
mv out/server.crt rpc/lib/server/test.crt
mv out/server.key rpc/lib/server/test.key
mv out/server.crt rpc/jsonrpc/server/test.crt
mv out/server.key rpc/jsonrpc/server/test.key
rm -rf out
.PHONY: gen_certs

# deletes generated certificates
clean_certs:
rm -f rpc/lib/server/test.crt
rm -f rpc/lib/server/test.key
rm -f rpc/jsonrpc/server/test.crt
rm -f rpc/jsonrpc/server/test.key
.PHONY: clean_certs

###############################################################################
Expand Down Expand Up @@ -230,9 +235,9 @@ build-docker-localnode:
@cd networks/local && make
.PHONY: build-docker-localnode

# Runs `make build_c` from within an Amazon Linux (v2)-based Docker build
# container in order to build an Amazon Linux-compatible binary. Produces a
# compatible binary at ./build/tendermint
# Runs `make build TENDERMINT_BUILD_OPTIONS=cleveldb` from within an Amazon
# Linux (v2)-based Docker build container in order to build an Amazon
# Linux-compatible binary. Produces a compatible binary at ./build/tendermint
build_c-amazonlinux:
$(MAKE) -C ./DOCKER build_amazonlinux_buildimage
docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux
Expand Down Expand Up @@ -263,6 +268,6 @@ endif
# prerequisits: build-contract-tests-hooks build-linux
# the two build commands were not added to let this command run from generic containers or machines.
# The binaries should be built beforehand
contract-tests:
contract-tests: build-docker-localnode
dredd
.PHONY: contract-tests
13 changes: 6 additions & 7 deletions abci/server/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,24 @@ func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) service.Se
return s
}

// OnStart starts the gRPC service
// OnStart starts the gRPC service.
func (s *GRPCServer) OnStart() error {
if err := s.BaseService.OnStart(); err != nil {
return err
}
ln, err := net.Listen(s.proto, s.addr)
if err != nil {
return err
}
s.Logger.Info("Listening", "proto", s.proto, "addr", s.addr)

s.listener = ln
s.server = grpc.NewServer()
types.RegisterABCIApplicationServer(s.server, s.app)

s.Logger.Info("Listening", "proto", s.proto, "addr", s.addr)
go s.server.Serve(s.listener)

return nil
}

// OnStop stops the gRPC server
// OnStop stops the gRPC server.
func (s *GRPCServer) OnStop() {
s.BaseService.OnStop()
s.server.Stop()
}
38 changes: 26 additions & 12 deletions abci/server/socket_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import (
"fmt"
"io"
"net"
"os"
"runtime"
"sync"

"github.com/tendermint/tendermint/abci/types"
tmlog "github.com/tendermint/tendermint/libs/log"
tmnet "github.com/tendermint/tendermint/libs/net"
"github.com/tendermint/tendermint/libs/service"
)
Expand All @@ -16,6 +19,7 @@ import (

type SocketServer struct {
service.BaseService
isLoggerSet bool

proto string
addr string
Expand All @@ -42,21 +46,24 @@ func NewSocketServer(protoAddr string, app types.Application) service.Service {
return s
}

func (s *SocketServer) SetLogger(l tmlog.Logger) {
s.BaseService.SetLogger(l)
s.isLoggerSet = true
}

func (s *SocketServer) OnStart() error {
if err := s.BaseService.OnStart(); err != nil {
return err
}
ln, err := net.Listen(s.proto, s.addr)
if err != nil {
return err
}

s.listener = ln
go s.acceptConnectionsRoutine()

return nil
}

func (s *SocketServer) OnStop() {
s.BaseService.OnStop()
if err := s.listener.Close(); err != nil {
s.Logger.Error("Error closing listener", "err", err)
}
Expand Down Expand Up @@ -105,7 +112,7 @@ func (s *SocketServer) acceptConnectionsRoutine() {
if !s.IsRunning() {
return // Ignore error from listener closing.
}
s.Logger.Error("Failed to accept connection: " + err.Error())
s.Logger.Error("Failed to accept connection", "err", err)
continue
}

Expand All @@ -132,15 +139,15 @@ func (s *SocketServer) waitForClose(closeConn chan error, connID int) {
case err == io.EOF:
s.Logger.Error("Connection was closed by client")
case err != nil:
s.Logger.Error("Connection error", "error", err)
s.Logger.Error("Connection error", "err", err)
default:
// never happens
s.Logger.Error("Connection was closed.")
s.Logger.Error("Connection was closed")
}

// Close the connection
if err := s.rmConn(connID); err != nil {
s.Logger.Error("Error in closing connection", "error", err)
s.Logger.Error("Error closing connection", "err", err)
}
}

Expand All @@ -153,7 +160,14 @@ func (s *SocketServer) handleRequests(closeConn chan error, conn io.Reader, resp
// make sure to recover from any app-related panics to allow proper socket cleanup
r := recover()
if r != nil {
closeConn <- fmt.Errorf("recovered from panic: %v", r)
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
err := fmt.Errorf("recovered from panic: %v\n%s", r, buf)
if !s.isLoggerSet {
fmt.Fprintln(os.Stderr, err)
}
closeConn <- err
s.appMtx.Unlock()
}
}()
Expand All @@ -166,7 +180,7 @@ func (s *SocketServer) handleRequests(closeConn chan error, conn io.Reader, resp
if err == io.EOF {
closeConn <- err
} else {
closeConn <- fmt.Errorf("error reading message: %v", err)
closeConn <- fmt.Errorf("error reading message: %w", err)
}
return
}
Expand Down Expand Up @@ -223,13 +237,13 @@ func (s *SocketServer) handleResponses(closeConn chan error, conn io.Writer, res
var res = <-responses
err := types.WriteMessage(res, bufWriter)
if err != nil {
closeConn <- fmt.Errorf("error writing message: %v", err.Error())
closeConn <- fmt.Errorf("error writing message: %w", err)
return
}
if _, ok := res.Value.(*types.Response_Flush); ok {
err = bufWriter.Flush()
if err != nil {
closeConn <- fmt.Errorf("error flushing write buffer: %v", err.Error())
closeConn <- fmt.Errorf("error flushing write buffer: %w", err)
return
}
}
Expand Down
Loading