Release/v0.19.5pull/1602/head
@ -0,0 +1,71 @@ | |||
# Security | |||
As part of our [Coordinated Vulnerability Disclosure | |||
Policy](https://tendermint.com/security), we operate a bug bounty. | |||
See the policy for more details on submissions and rewards. | |||
Here is a list of examples of the kinds of bugs we're most interested in: | |||
## Specification | |||
- Conceptual flaws | |||
- Ambiguities, inconsistencies, or incorrect statements | |||
- Mis-match between specification and implementation of any component | |||
## Consensus | |||
Assuming less than 1/3 of the voting power is Byzantine (malicious): | |||
- Validation of blockchain data structures, including blocks, block parts, | |||
votes, and so on | |||
- Execution of blocks | |||
- Validator set changes | |||
- Proposer round robin | |||
- Two nodes committing conflicting blocks for the same height (safety failure) | |||
- A correct node signing conflicting votes | |||
- A node halting (liveness failure) | |||
- Syncing new and old nodes | |||
## Networking | |||
- Authenticated encryption (MITM, information leakage) | |||
- Eclipse attacks | |||
- Sybil attacks | |||
- Long-range attacks | |||
- Denial-of-Service | |||
## RPC | |||
- Write-access to anything besides sending transactions | |||
- Denial-of-Service | |||
- Leakage of secrets | |||
## Denial-of-Service | |||
Attacks may come through the P2P network or the RPC: | |||
- Amplification attacks | |||
- Resource abuse | |||
- Deadlocks and race conditions | |||
- Panics and unhandled errors | |||
## Libraries | |||
- Serialization (Amino) | |||
- Reading/Writing files and databases | |||
- Logging and monitoring | |||
## Cryptography | |||
- Elliptic curves for validator signatures | |||
- Hash algorithms and Merkle trees for block validation | |||
- Authenticated encryption for P2P connections | |||
## Light Client | |||
- Validation of blockchain data structures | |||
- Correctly validating an incorrect proof | |||
- Incorrectly validating a correct proof | |||
- Syncing validator set changes | |||
@ -1 +1 @@ | |||
Spec moved to [docs/spec](./docs/spec). | |||
Spec moved to [docs/spec](/docs/spec). |
@ -0,0 +1,27 @@ | |||
Transactional Semantics | |||
======================= | |||
In `Using | |||
Tendermint <./using-tendermint.html#broadcast-api>`__ we | |||
discussed different API endpoints for sending transactions and | |||
differences between them. | |||
What we have not yet covered is transactional semantics. | |||
When you send a transaction using one of the available methods, it | |||
first goes to the mempool. Currently, it does not provide strong | |||
guarantees like "if the transaction were accepted, it would be | |||
eventually included in a block (given CheckTx passes)." | |||
For instance a tx could enter the mempool, but before it can be sent | |||
to peers the node crashes. | |||
We are planning to provide such guarantees by using a WAL and | |||
replaying transactions (See | |||
`GH#248 <https://github.com/tendermint/tendermint/issues/248>`__), but | |||
it's non-trivial to do this all efficiently. | |||
The temporary solution is for clients to monitor the node and resubmit | |||
transaction(s) or/and send them to more nodes at once, so the | |||
probability of all of them crashing at the same time and losing the | |||
msg decreases substantially. |
@ -0,0 +1,79 @@ | |||
# Local Cluster with Docker Compose | |||
## Requirements | |||
- [Install tendermint](/docs/install.rst) | |||
- [Install docker](https://docs.docker.com/engine/installation/) | |||
- [Install docker-compose](https://docs.docker.com/compose/install/) | |||
## Build | |||
Build the `tendermint` binary and the `tendermint/localnode` docker image. | |||
Note the binary will be mounted into the container so it can be updated without | |||
rebuilding the image. | |||
``` | |||
cd $GOPATH/src/github.com/tendermint/tendermint | |||
# Build the linux binary in ./build | |||
make build-linux | |||
# Build tendermint/localnode image | |||
make build-docker-localnode | |||
``` | |||
## Run a testnet | |||
To start a 4 node testnet run: | |||
``` | |||
make localnet-start | |||
``` | |||
The nodes bind their RPC servers to ports 46657, 46660, 46662, and 46664 on the host. | |||
This file creates a 4-node network using the localnode image. | |||
The nodes of the network expose their P2P and RPC endpoints to the host machine on ports 46656-46657, 46659-46660, 46661-46662, and 46663-46664 respectively. | |||
To update the binary, just rebuild it and restart the nodes: | |||
``` | |||
make build-linux | |||
make localnet-stop | |||
make localnet-start | |||
``` | |||
## Configuration | |||
The `make localnet-start` creates files for a 4-node testnet in `./build` by calling the `tendermint testnet` command. | |||
The `./build` directory is mounted to the `/tendermint` mount point to attach the binary and config files to the container. | |||
For instance, to create a single node testnet: | |||
``` | |||
cd $GOPATH/src/github.com/tendermint/tendermint | |||
# Clear the build folder | |||
rm -rf ./build | |||
# Build binary | |||
make build-linux | |||
# Create configuration | |||
docker run -e LOG="stdout" -v `pwd`/build:/tendermint tendermint/localnode testnet --o . --v 1 | |||
#Run the node | |||
docker run -v `pwd`/build:/tendermint tendermint/localnode | |||
``` | |||
## Logging | |||
Log is saved under the attached volume, in the `tendermint.log` file. If the `LOG` environment variable is set to `stdout` at start, the log is not saved, but printed on the screen. | |||
## Special binaries | |||
If you have multiple binaries with different names, you can specify which one to run with the BINARY environment variable. The path of the binary is relative to the attached volume. | |||
@ -1,40 +0,0 @@ | |||
localnode | |||
========= | |||
It is assumed that you have already `setup docker <https://docs.docker.com/engine/installation/>`__. | |||
Description | |||
----------- | |||
Image for local testnets. | |||
Add the tendermint binary to the image by attaching it in a folder to the `/tendermint` mount point. | |||
It assumes that the configuration was created by the `tendermint testnet` command and it is also attached to the `/tendermint` mount point. | |||
Example: | |||
This example builds a linux tendermint binary under the `build/` folder, creates tendermint configuration for a single-node validator and runs the node: | |||
``` | |||
cd $GOPATH/src/github.com/tendermint/tendermint | |||
#Build binary | |||
make build-linux | |||
#Create configuration | |||
docker run -e LOG="stdout" -v `pwd`/build:/tendermint tendermint/localnode testnet --o . --v 1 | |||
#Run the node | |||
docker run -v `pwd`/build:/tendermint tendermint/localnode | |||
``` | |||
Logging | |||
------- | |||
Log is saved under the attached volume, in the `tendermint.log` file. If the `LOG` environment variable is set to `stdout` at start, the log is not saved, but printed on the screen. | |||
Special binaries | |||
---------------- | |||
If you have multiple binaries with different names, you can specify which one to run with the BINARY environment variable. The path of the binary is relative to the attached volume. | |||
docker-compose.yml | |||
================== | |||
This file creates a 4-node network using the localnode image. The nodes of the network are exposed to the host machine on ports 46656-46657, 46659-46660, 46661-46662, 46663-46664 respectively. | |||
@ -0,0 +1 @@ | |||
# Remote Cluster with Terraform and Ansible |
@ -0,0 +1,67 @@ | |||
package core | |||
import ( | |||
"fmt" | |||
"testing" | |||
"github.com/stretchr/testify/assert" | |||
) | |||
func TestPaginationPage(t *testing.T) { | |||
cases := []struct { | |||
totalCount int | |||
perPage int | |||
page int | |||
newPage int | |||
}{ | |||
{0, 10, 0, 1}, | |||
{0, 10, 1, 1}, | |||
{0, 10, 2, 1}, | |||
{5, 10, -1, 1}, | |||
{5, 10, 0, 1}, | |||
{5, 10, 1, 1}, | |||
{5, 10, 2, 1}, | |||
{5, 10, 2, 1}, | |||
{5, 5, 1, 1}, | |||
{5, 5, 2, 1}, | |||
{5, 5, 3, 1}, | |||
{5, 3, 2, 2}, | |||
{5, 3, 3, 2}, | |||
{5, 2, 2, 2}, | |||
{5, 2, 3, 3}, | |||
{5, 2, 4, 3}, | |||
} | |||
for _, c := range cases { | |||
p := validatePage(c.page, c.perPage, c.totalCount) | |||
assert.Equal(t, c.newPage, p, fmt.Sprintf("%v", c)) | |||
} | |||
} | |||
func TestPaginationPerPage(t *testing.T) { | |||
cases := []struct { | |||
totalCount int | |||
perPage int | |||
newPerPage int | |||
}{ | |||
{5, 0, defaultPerPage}, | |||
{5, 1, 1}, | |||
{5, 2, 2}, | |||
{5, defaultPerPage, defaultPerPage}, | |||
{5, maxPerPage - 1, maxPerPage - 1}, | |||
{5, maxPerPage, maxPerPage}, | |||
{5, maxPerPage + 1, defaultPerPage}, | |||
} | |||
for _, c := range cases { | |||
p := validatePerPage(c.perPage) | |||
assert.Equal(t, c.newPerPage, p, fmt.Sprintf("%v", c)) | |||
} | |||
} |
@ -1,9 +0,0 @@ | |||
#! /bin/bash | |||
# update the `tester` image by copying in the latest tendermint binary | |||
docker run --name builder tester true | |||
docker cp $GOPATH/bin/tendermint builder:/go/bin/tendermint | |||
docker commit builder tester | |||
docker rm -vf builder | |||
@ -1,5 +0,0 @@ | |||
#! /bin/bash | |||
# clean everything | |||
docker rm -vf $(docker ps -aq) | |||
docker network rm local_testnet |