mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 22:32:15 +00:00
small fixes to spec & http_server & Vagrantfile (#2859)
* Vagrantfile: install dev_tools Follow-up on https://github.com/tendermint/tendermint/pull/2824 * update consensus params spec * fix test name * rpc_test: panic if failed to start listener also - remove http_server#MustListen - align StartHTTPServer and StartHTTPAndTLSServer functions * dep: allow minor releases for grpc
This commit is contained in:
parent
d8ab8509de
commit
e6a0d098e8
@ -65,7 +65,7 @@
|
||||
|
||||
[[constraint]]
|
||||
name = "google.golang.org/grpc"
|
||||
version = "~1.13.0"
|
||||
version = "^1.13.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/fortytw2/leaktest"
|
||||
|
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@ -53,6 +53,6 @@ Vagrant.configure("2") do |config|
|
||||
|
||||
# get all deps and tools, ready to install/test
|
||||
su - vagrant -c 'source /home/vagrant/.bash_profile'
|
||||
su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_tools && make get_vendor_deps'
|
||||
su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_tools && make get_dev_tools && make get_vendor_deps'
|
||||
SHELL
|
||||
end
|
||||
|
@ -79,31 +79,25 @@ func TotalVotingPower(vals []Validators) int64{
|
||||
ConsensusParams define various limits for blockchain data structures.
|
||||
Like validator sets, they are set during genesis and can be updated by the application through ABCI.
|
||||
|
||||
```
|
||||
```go
|
||||
type ConsensusParams struct {
|
||||
BlockSize
|
||||
TxSize
|
||||
BlockGossip
|
||||
EvidenceParams
|
||||
Evidence
|
||||
Validator
|
||||
}
|
||||
|
||||
type BlockSize struct {
|
||||
MaxBytes int
|
||||
MaxBytes int64
|
||||
MaxGas int64
|
||||
}
|
||||
|
||||
type TxSize struct {
|
||||
MaxBytes int
|
||||
MaxGas int64
|
||||
}
|
||||
|
||||
type BlockGossip struct {
|
||||
BlockPartSizeBytes int
|
||||
}
|
||||
|
||||
type EvidenceParams struct {
|
||||
type Evidence struct {
|
||||
MaxAge int64
|
||||
}
|
||||
|
||||
type Validator struct {
|
||||
PubKeyTypes []string
|
||||
}
|
||||
```
|
||||
|
||||
#### BlockSize
|
||||
@ -115,20 +109,15 @@ otherwise.
|
||||
Blocks should additionally be limited by the amount of "gas" consumed by the
|
||||
transactions in the block, though this is not yet implemented.
|
||||
|
||||
#### TxSize
|
||||
|
||||
These parameters are not yet enforced and may disappear. See [issue
|
||||
#2347](https://github.com/tendermint/tendermint/issues/2347).
|
||||
|
||||
#### BlockGossip
|
||||
|
||||
When gossipping blocks in the consensus, they are first split into parts. The
|
||||
size of each part is `ConsensusParams.BlockGossip.BlockPartSizeBytes`.
|
||||
|
||||
#### EvidenceParams
|
||||
#### Evidence
|
||||
|
||||
For evidence in a block to be valid, it must satisfy:
|
||||
|
||||
```
|
||||
block.Header.Height - evidence.Height < ConsensusParams.EvidenceParams.MaxAge
|
||||
block.Header.Height - evidence.Height < ConsensusParams.Evidence.MaxAge
|
||||
```
|
||||
|
||||
#### Validator
|
||||
|
||||
Validators from genesis file and `ResponseEndBlock` must have pubkeys of type ∈
|
||||
`ConsensusParams.Validator.PubKeyTypes`.
|
||||
|
@ -134,6 +134,9 @@ func setup() {
|
||||
wm.SetLogger(unixLogger)
|
||||
mux2.HandleFunc(websocketEndpoint, wm.WebsocketHandler)
|
||||
listener2, err := server.Listen(unixAddr, server.Config{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
go server.StartHTTPServer(listener2, mux2, unixLogger)
|
||||
|
||||
// wait for servers to start
|
||||
|
@ -33,12 +33,12 @@ const (
|
||||
// It wraps handler with RecoverAndLogHandler.
|
||||
// NOTE: This function blocks - you may want to call it in a go-routine.
|
||||
func StartHTTPServer(listener net.Listener, handler http.Handler, logger log.Logger) error {
|
||||
logger.Info(fmt.Sprintf("Starting RPC HTTP server on %s", listener.Addr()))
|
||||
err := http.Serve(
|
||||
listener,
|
||||
RecoverAndLogHandler(maxBytesHandler{h: handler, n: maxBodyBytes}, logger),
|
||||
)
|
||||
logger.Info("RPC HTTP server stopped", "err", err)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@ -51,24 +51,16 @@ func StartHTTPAndTLSServer(
|
||||
certFile, keyFile string,
|
||||
logger log.Logger,
|
||||
) error {
|
||||
logger.Info(
|
||||
fmt.Sprintf(
|
||||
"Starting RPC HTTPS server on %s (cert: %q, key: %q)",
|
||||
listener.Addr(),
|
||||
certFile,
|
||||
keyFile,
|
||||
),
|
||||
)
|
||||
if err := http.ServeTLS(
|
||||
logger.Info(fmt.Sprintf("Starting RPC HTTPS server on %s (cert: %q, key: %q)",
|
||||
listener.Addr(), certFile, keyFile))
|
||||
err := http.ServeTLS(
|
||||
listener,
|
||||
RecoverAndLogHandler(maxBytesHandler{h: handler, n: maxBodyBytes}, logger),
|
||||
certFile,
|
||||
keyFile,
|
||||
); err != nil {
|
||||
logger.Error("RPC HTTPS server stopped", "err", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
)
|
||||
logger.Info("RPC HTTPS server stopped", "err", err)
|
||||
return err
|
||||
}
|
||||
|
||||
func WriteRPCResponseHTTPError(
|
||||
@ -170,16 +162,6 @@ func (h maxBytesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
h.h.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
// MustListen starts a new net.Listener on the given address.
|
||||
// It panics in case of error.
|
||||
func MustListen(addr string, config Config) net.Listener {
|
||||
l, err := Listen(addr, config)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("Listen() failed: %v", err))
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
// Listen starts a new net.Listener on the given address.
|
||||
// It returns an error if the address is invalid or the call to Listen() fails.
|
||||
func Listen(addr string, config Config) (listener net.Listener, err error) {
|
||||
|
@ -84,8 +84,7 @@ func TestWrongProof(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPartSetHeaderSetValidateBasic(t *testing.T) {
|
||||
|
||||
func TestPartSetHeaderValidateBasic(t *testing.T) {
|
||||
testCases := []struct {
|
||||
testName string
|
||||
malleatePartSetHeader func(*PartSetHeader)
|
||||
@ -107,7 +106,6 @@ func TestPartSetHeaderSetValidateBasic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPartValidateBasic(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
testName string
|
||||
malleatePart func(*Part)
|
||||
|
Loading…
x
Reference in New Issue
Block a user