diff --git a/CHANGELOG.md b/CHANGELOG.md index 29d753a6d..5d8864201 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 0.23.1 + +*July 27th, 2018* + +BUG FIXES + * [tendermint] Update to v0.22.8 + - [consensus, blockchain] Register the Evidence interface so it can be + marshalled/unmarshalled by the blockchain and consensus reactors + +## 0.23.0 + +*July 25th, 2018* + +BREAKING CHANGES +* [x/stake] Fixed the period check for the inflation calculation + +IMPROVEMENTS +* [cli] Improve error messages for all txs when the account doesn't exist +* [tendermint] Update to v0.22.6 + - Updates the crypto imports/API (#1966) +* [x/stake] Add revoked to human-readable validator + +BUG FIXES +* [tendermint] Update to v0.22.6 + - Fixes some security vulnerabilities reported in the [Bug Bounty](https://hackerone.com/tendermint) +* \#1797 Fix off-by-one error in slashing for downtime +* \#1787 Fixed bug where Tally fails due to revoked/unbonding validator +* \#1666 Add intra-tx counter to the genesis validators + ## 0.22.0 *July 16th, 2018* diff --git a/Gopkg.lock b/Gopkg.lock index c69af1c2e..145716a47 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -34,7 +34,7 @@ [[projects]] branch = "master" - digest = "1:6aabc1566d6351115d561d038da82a4c19b46c3b6e17f4a0a2fa60260663dc79" + digest = "1:2c00f064ba355903866cbfbf3f7f4c0fe64af6638cc7d1b8bdcf3181bc67f1d8" name = "github.com/btcsuite/btcd" packages = ["btcec"] pruneopts = "UT" @@ -71,7 +71,7 @@ version = "v1.4.7" [[projects]] - digest = "1:fa30c0652956e159cdb97dcb2ef8b8db63ed668c02a5c3a40961c8f0641252fe" + digest = "1:fdf5169073fb0ad6dc12a70c249145e30f4058647bea25f0abd48b6d9f228a11" name = "github.com/go-kit/kit" packages = [ "log", @@ -103,7 +103,7 @@ version = "v1.7.0" [[projects]] - digest = "1:212285efb97b9ec2e20550d81f0446cb7897e57cbdfd7301b1363ab113d8be45" + digest = "1:35621fe20f140f05a0c4ef662c26c0ab4ee50bca78aa30fe87d33120bd28165e" name = "github.com/gogo/protobuf" packages = [ "gogoproto", @@ -118,7 +118,7 @@ version = "v1.1.1" [[projects]] - digest = "1:cb22af0ed7c72d495d8be1106233ee553898950f15fd3f5404406d44c2e86888" + digest = "1:17fe264ee908afc795734e8c4e63db2accabaf57326dbf21763a7d6b86096260" name = "github.com/golang/protobuf" packages = [ "proto", @@ -165,13 +165,12 @@ [[projects]] branch = "master" - digest = "1:ac64f01acc5eeea9dde40e326de6b6471e501392ec06524c3b51033aa50789bc" + digest = "1:12247a2e99a060cc692f6680e5272c8adf0b8f572e6bce0d7095e624c958a240" name = "github.com/hashicorp/hcl" packages = [ ".", "hcl/ast", "hcl/parser", - "hcl/printer", "hcl/scanner", "hcl/strconv", "hcl/token", @@ -263,7 +262,7 @@ version = "v1.0.0" [[projects]] - digest = "1:98225904b7abff96c052b669b25788f18225a36673fba022fb93514bb9a2a64e" + digest = "1:c1a04665f9613e082e1209cf288bf64f4068dcd6c87a64bf1c4ff006ad422ba0" name = "github.com/prometheus/client_golang" packages = [ "prometheus", @@ -274,7 +273,7 @@ [[projects]] branch = "master" - digest = "1:0f37e09b3e92aaeda5991581311f8dbf38944b36a3edec61cc2d1991f527554a" + digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4" name = "github.com/prometheus/client_model" packages = ["go"] pruneopts = "UT" @@ -282,7 +281,7 @@ [[projects]] branch = "master" - digest = "1:dad2e5a2153ee7a6c9ab8fc13673a16ee4fb64434a7da980965a3741b0c981a3" + digest = "1:63b68062b8968092eb86bedc4e68894bd096ea6b24920faca8b9dcf451f54bb5" name = "github.com/prometheus/common" packages = [ "expfmt", @@ -294,7 +293,7 @@ [[projects]] branch = "master" - digest = "1:a37c98f4b7a66bb5c539c0539f0915a74ef1c8e0b3b6f45735289d94cae92bfd" + digest = "1:8c49953a1414305f2ff5465147ee576dd705487c35b15918fcd4efdc0cb7a290" name = "github.com/prometheus/procfs" packages = [ ".", @@ -313,7 +312,7 @@ revision = "e2704e165165ec55d062f5919b4b29494e9fa790" [[projects]] - digest = "1:37ace7f35375adec11634126944bdc45a673415e2fcc07382d03b75ec76ea94c" + digest = "1:bd1ae00087d17c5a748660b8e89e1043e1e5479d0fea743352cda2f8dd8c4f84" name = "github.com/spf13/afero" packages = [ ".", @@ -332,7 +331,7 @@ version = "v1.2.0" [[projects]] - digest = "1:627ab2f549a6a55c44f46fa24a4307f4d0da81bfc7934ed0473bf38b24051d26" + digest = "1:7ffc0983035bc7e297da3688d9fe19d60a420e9c38bef23f845c53788ed6a05e" name = "github.com/spf13/cobra" packages = ["."] pruneopts = "UT" @@ -364,7 +363,7 @@ version = "v1.0.0" [[projects]] - digest = "1:73697231b93fb74a73ebd8384b68b9a60c57ea6b13c56d2425414566a72c8e6d" + digest = "1:7e8d267900c7fa7f35129a2a37596e38ed0f11ca746d6d9ba727980ee138f9f6" name = "github.com/stretchr/testify" packages = [ "assert", @@ -376,7 +375,7 @@ [[projects]] branch = "master" - digest = "1:922191411ad8f61bcd8018ac127589bb489712c1d1a0ab2497aca4b16de417d2" + digest = "1:b3cfb8d82b1601a846417c3f31c03a7961862cb2c98dcf0959c473843e6d9a2b" name = "github.com/syndtr/goleveldb" packages = [ "leveldb", @@ -397,7 +396,7 @@ [[projects]] branch = "master" - digest = "1:203b409c21115233a576f99e8f13d8e07ad82b25500491f7e1cca12588fb3232" + digest = "1:087aaa7920e5d0bf79586feb57ce01c35c830396ab4392798112e8aae8c47722" name = "github.com/tendermint/ed25519" packages = [ ".", @@ -424,7 +423,7 @@ version = "v0.9.2" [[projects]] - digest = "1:049c779b867a182cea567c65d7c81e3b9e4e4a7eece4c35a19639f75d2aa7da9" + digest = "1:eb0f8bee357e6c28c9ad5fa074545b5085d0dcf580ba0e7024ab8c3285a5c815" name = "github.com/tendermint/tendermint" packages = [ "abci/client", @@ -487,8 +486,8 @@ "version", ] pruneopts = "UT" - revision = "5fdbcd70df57b71ffba71e1ff5f00d617852a9c0" - version = "v0.22.6" + revision = "d542d2c3945116697f60451e6a407082c41c3cc9" + version = "v0.22.8" [[projects]] digest = "1:5bd938386bd1f61a581bf8cd6ff2b7b2f79c542929176db4ceb44965440dae07" @@ -499,7 +498,7 @@ [[projects]] branch = "master" - digest = "1:e8206c1653e050116ec8c9a823a86413fc9f9ee3c2f3ae977c96d6a1747f7325" + digest = "1:65a21a9e051d54eb6a3f70c659a765f706a998d9287c302269f4ed8054b2a852" name = "golang.org/x/crypto" packages = [ "blowfish", @@ -518,7 +517,7 @@ revision = "f027049dab0ad238e394a753dba2d14753473a04" [[projects]] - digest = "1:04dda8391c3e2397daf254ac68003f30141c069b228d06baec8324a5f81dc1e9" + digest = "1:d36f55a999540d29b6ea3c2ea29d71c76b1d9853fdcd3e5c5cb4836f2ba118f1" name = "golang.org/x/net" packages = [ "context", @@ -542,7 +541,7 @@ revision = "acbc56fc7007d2a01796d5bde54f39e3b3e95945" [[projects]] - digest = "1:7509ba4347d1f8de6ae9be8818b0cd1abc3deeffe28aeaf4be6d4b6b5178d9ca" + digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18" name = "golang.org/x/text" packages = [ "collate", @@ -573,7 +572,7 @@ revision = "daca94659cb50e9f37c1b834680f2e46358f10b0" [[projects]] - digest = "1:4515e3030c440845b046354fd5d57671238428b820deebce2e9dabb5cd3c51ac" + digest = "1:2dab32a43451e320e49608ff4542fdfc653c95dcc35d0065ec9c6c3dd540ed74" name = "google.golang.org/grpc" packages = [ ".", diff --git a/Gopkg.toml b/Gopkg.toml index cab580e05..10c992351 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -57,7 +57,7 @@ [[override]] name = "github.com/tendermint/tendermint" - version = "=v0.22.6" + version = "=v0.22.8" [[constraint]] name = "github.com/bartekn/go-bip39" diff --git a/README.md b/README.md index cf8e7d3b8..75761f5f4 100644 --- a/README.md +++ b/README.md @@ -12,37 +12,33 @@ [![riot.im](https://img.shields.io/badge/riot.im-JOIN%20CHAT-green.svg)](https://riot.im/app/#/room/#cosmos-sdk:matrix.org) The Cosmos-SDK is a framework for building blockchain applications in Golang. -It is being used to build `Gaia`, the first implementation of the [Cosmos Hub](https://cosmos.network), +It is being used to build `Gaia`, the first implementation of the [Cosmos Hub](https://cosmos.network/docs/), **WARNING**: The SDK has mostly stabilized, but we are still making some breaking changes. -**Note**: The `master` branch is an active development branch. For the latest -release, see the [release page](https://github.com/cosmos/cosmos-sdk/releases). - **Note**: Requires [Go 1.10+](https://golang.org/dl/) ## Gaia Testnet -For more information on connecting to the testnet, see -[cmd/gaia/testnets](/cmd/gaia/testnets) +To join the latest testnet, follow +[the guide](https://cosmos.network/docs/getting-started/full-node.html#setting-up-a-new-node). -For the latest status of the testnet, see the [status -file](/cmd/gaia/testnets/STATUS.md). +For status updates and genesis files, see the +[testnets repo](https://github.com/cosmos/testnets). ## Install -See the [install instructions](/docs/install.md) +See the +[install instructions](https://cosmos.network/docs/getting-started/installation.html). ## Quick Start -- [Documentation](https://cosmos.network/docs/) -- [Examples](/examples) -- [Cosmos Hub Specification](https://cosmos.network/docs/spec/) - +See the [Cosmos Docs](https://cosmos.network/docs/) + +- [Getting started with the SDK](https://cosmos.network/docs/sdk/core/intro.html) +- [SDK Examples](/examples) +- [Join the testnet](https://cosmos.network/docs/getting-started/full-node.html#run-a-full-node) ## Disambiguation diff --git a/cmd/gaia/testnets/README.md b/cmd/gaia/testnets/README.md index ddfeef54c..e64db9f7d 100644 --- a/cmd/gaia/testnets/README.md +++ b/cmd/gaia/testnets/README.md @@ -1,498 +1,7 @@ -# Connect to the `gaia-7001` Testnet +# DEPRECATED -_**NOTE:**_ We are aware this documentation is a work in progress. We are actively -working to improve the tooling and the documentation to make this process as painless as -possible. In the meantime, join the [Validator Chat](https://riot.im/app/#/room/#cosmos_validators:matrix.org) -for technical support, and [open issues](https://github.com/cosmos/cosmos-sdk) if you run into any! Thanks very much for your patience and support. :) +The content of this file was moved to the `/docs` folder and is hosted on the +[website](https://cosmos.network/docs/getting-started/full-node.html#run-a-full-node). -## Setting Up a New Node - -These instructions are for setting up a brand new full node from scratch. If you ran a full node on a previous testnet you will need to start from scratch due to some breaking changes in key format. - -### Install Go - -Install `go` by following the [official docs](https://golang.org/doc/install). -**Go 1.10+** is required for the Cosmos SDK. Remember to properly setup your `$GOPATH`, `$GOBIN`, and `$PATH` variables, for example: - -```bash -mkdir -p $HOME/go/bin -echo "export GOPATH=$HOME/go" >> ~/.bash_profile -echo "export GOBIN=$GOPATH/bin" >> ~/.bash_profile -echo "export PATH=$PATH:$GOBIN" >> ~/.bash_profile -``` - -### Install Cosmos SDK - -Next, let's install the testnet's version of the Cosmos SDK. - -```bash -mkdir -p $GOPATH/src/github.com/cosmos -cd $GOPATH/src/github.com/cosmos -git clone https://github.com/cosmos/cosmos-sdk -cd cosmos-sdk && git checkout v0.22.0 -make get_tools && make get_vendor_deps && make install -``` - -That will install the `gaiad` and `gaiacli` binaries. Verify that everything is OK: - -```bash -$ gaiad version -0.22.0 - -$ gaiacli version -0.22.0 -``` - -### Node Setup - -Create the required configuration files, and initialize the node: - -```bash -gaiad init --name -``` - -> *NOTE:* Note that only ASCII characters are supported for the `--name`. Using Unicode renders your node unreachable. - -You can also edit this `moniker` in the `~/.gaiad/config/config.toml` file: - -```toml -# A custom human readable name for this node -moniker = "" -``` - -Your full node has been initialized! - -## Upgrading From Previous Testnet - -These instructions are for full nodes that have ran on previous testnets and -would like to upgrade to the latest testnet. - -### Reset Data - -First, remove the outdated files and reset the data. - -```bash -rm $HOME/.gaiad/config/addrbook.json $HOME/.gaiad/config/genesis.json -gaiad unsafe_reset_all -``` - -Your node is now in a pristine state while keeping the original `priv_validator.json` and `config.toml`. -If you had any sentry nodes or full nodes setup before, your node will still try to connect to them, -but may fail if they haven't also been upgraded. - -**WARNING:** Make sure that every node has a unique `priv_validator.json`. -Do not copy the `priv_validator.json` from an old node to multiple new nodes. -Running two nodes with the same `priv_validator.json` will cause you to double sign. - -NOTE: key formats changed between gaia-6002 and gaia-7000. If you're trying to upgrade from gaia-6002, -you will also need to delete your `priv_validator.json`: - -``` -rm $HOME/.gaiad/config/priv_validator.json -``` - -### Software Upgrade - -Now it is time to upgrade the software: - -```bash -cd $GOPATH/src/github.com/cosmos/cosmos-sdk -git fetch --all && git checkout v0.22.0 -make update_tools && make get_vendor_deps && make install -``` - -Your full node has been cleanly upgraded! - -## Genesis & Seeds - -### Copy the Genesis File - -Fetch the testnet's `genesis.json` file and place it in `gaiad`'s config directory. - -```bash -mkdir -p $HOME/.gaiad/config -curl https://gist.githubusercontent.com/cwgoes/311da6ba05be6e113185a716538a44c3/raw/7b6e784cf29761b5781488006313bd69d164aa6c/chris-final.json > $HOME/.gaiad/config/genesis.json -``` - -### Add Seed Nodes - -Your node needs to know how to find peers. You'll need to add healthy seed nodes to `$HOME/.gaiad/config/config.toml`. Here are some seed nodes you can use: - -```toml -# Comma separated list of seed nodes to connect to -seeds = "718145d422a823fd2a4e1e36e91b92bb0c4ddf8e@gaia-7000.coinculture.net:26656,5922bf29b48a18c2300b85cc53f424fce23927ab@67.207.73.206:26656,7c8b8fd03577cd4817f5be1f03d506f879df98d8@gaia-7000-seed1.interblock.io:26656,a28737ff02391a6e00a1d3b79befd57e68e8264c@gaia-7000-seed2.interblock.io:26656,987ffd26640cd03d08ed7e53b24dfaa7956e612d@gaia-7000-seed3.interblock.io:26656" -``` - -If those seeds aren't working, you can find more seeds and persistent peers on the [Cosmos Explorer](https://explorecosmos.network/nodes). Open the the `Full Nodes` pane and select nodes that do not have private (`10.x.x.x`) or [local IP addresses](https://en.wikipedia.org/wiki/Private_network). The `Persistent Peer` field contains the connection string. For best results use 4-6. - -For more information on seeds and peers, [read this](https://github.com/tendermint/tendermint/blob/develop/docs/using-tendermint.md#peers). - -## Run a Full Node - -Start the full node with this command: - -```bash -gaiad start -``` - -Check that everything is running smoothly: - -```bash -gaiacli status -``` - -View the status of the network with the [Cosmos Explorer](https://explorecosmos.network). Once your full node syncs up to the current block height, you should see it appear on the [list of full nodes](https://explorecosmos.network/validators). If it doesn't show up, that's ok--the Explorer does not connect to every node. - -## Generating Keys - -### A Note on Keys in Cosmos: - -There are three types of key representations that are used in this tutorial: - -- `cosmosaccaddr` - * Derived from account keys generated by `gaiacli keys add` - * Used to receive funds - * e.g. `cosmosaccaddr15h6vd5f0wqps26zjlwrc6chah08ryu4hzzdwhc` - -- `cosmosaccpub` - * Derived from account keys generated by `gaiacli keys add` - * e.g. `cosmosaccpub1zcjduc3q7fu03jnlu2xpl75s2nkt7krm6grh4cc5aqth73v0zwmea25wj2hsqhlqzm` - -- `cosmosvalpub` - * Generated when the node is created with `gaiad init`. - * Get this value with `gaiad tendermint show_validator` - * e.g. `cosmosvalpub1zcjduc3qcyj09qc03elte23zwshdx92jm6ce88fgc90rtqhjx8v0608qh5ssp0w94c` - -### Key Generation - -You'll need an account private and public key pair \(a.k.a. `sk, pk` respectively\) to be able to receive funds, send txs, bond tx, etc. - -To generate a new key \(default _ed25519_ elliptic curve\): - -```bash -gaiacli keys add -``` - -Next, you will have to create a passphrase to protect the key on disk. The output of the above command will contain a _seed phrase_. Save the _seed phrase_ in a safe place in case you forget the password! - -If you check your private keys, you'll now see ``: - -```bash -gaiacli keys show -``` - -You can see all your available keys by typing: - -```bash -gaiacli keys list -``` - -View the validator pubkey for your node by typing: - -```bash -gaiad tendermint show_validator -``` - -**WARNING:** We strongly recommend NOT using the same passphrase for multiple keys. The Tendermint team and the Interchain Foundation will not be responsible for the loss of funds. This is not as important on the testnets, but is good security practice and should be followed. - -## Fund your account - -The best way to get tokens is from the [Cosmos Testnet Faucet](https://faucetcosmos.network). If the faucet is not working for you, try asking [#cosmos-validators](https://riot.im/app/#/room/#cosmos-validators:matrix.org). The faucet needs the `cosmosaccaddr` from the account you wish to use for staking. - -After receiving tokens to your address, you can view your account's balance by typing: - -```bash -gaiacli account -``` - -> _*Note:*_ When you query an account balance with zero tokens, you will get this error: `No account with address was found in the state.` This can also happen if you fund the account before your node has fully synced with the chain. These are both normal. Also, we're working on improving our error messages! - -## Run a Validator Node - -[Validators](https://cosmos.network/validators) are responsible for committing new blocks to the blockchain through voting. A validator's stake is slashed if they become unavailable, double sign a transaction, or don't cast their votes. If you only want to run a full node, a VM in the cloud is fine. However, if you are want to become a validator for the Hub's `mainnet`, you should research hardened setups. Please read [Sentry Node Architecture](https://forum.cosmos.network/t/sentry-node-architecture-overview/454) to protect your node from DDOS and ensure high-availability. Also see the [technical requirements](https://github.com/cosmos/cosmos/blob/master/VALIDATORS_FAQ.md#technical-requirements)). There's also more info on our [website](https://cosmos.network/validators). - -### Create Your Validator - -Your `cosmosvalpub` can be used to create a new validator by staking tokens. You can find your validator pubkey by running: - -```bash -gaiad tendermint show_validator -``` - -Next, craft your `gaiacli stake create-validator` command: - -> _*NOTE:*_ Don't use more `steak` thank you have! You can always get more by using the [Faucet](https://faucetcosmos.network/)! - -```bash -gaiacli stake create-validator \ - --amount=5steak \ - --pubkey=$(gaiad tendermint show_validator) \ - --address-validator= - --moniker="choose a moniker" \ - --chain-id=gaia-7001 \ - --from= -``` - -### Edit Validator Description - -You can edit your validator's public description. This info is to identify your validator, and will be relied on by delegators to decide which validators to stake to. Make sure to provide input for every flag below, otherwise the field will default to empty (`--moniker` defaults to the machine name). - -The `--identity` can be used as to verify identity with systems like Keybase or UPort. When using with Keybase `--identity` should be populated with a 16-digit string that is generated with a [keybase.io](https://keybase.io) account. It's a cryptographically secure method of verifying your identity across multiple online networks. The Keybase API allows us to retrieve your Keybase avatar. This is how you can add a logo to your validator profile. - -```bash -gaiacli stake edit-validator - --address-validator= - --moniker="choose a moniker" \ - --website="https://cosmos.network" \ - --identity=6A0D65E29A4CBC8E - --details="To infinity and beyond!" - --chain-id=gaia-7001 \ - --from= -``` - -### View Validator Description -View the validator's information with this command: - -```bash -gaiacli stake validator \ - --address-validator= \ - --chain-id=gaia-7001 -``` - -Your validator is active if the following command returns anything: - -```bash -gaiacli advanced tendermint validator-set | grep "$(gaiad tendermint show_validator)" -``` - -You should also be able to see your validator on the [Explorer](https://explorecosmos.network/validators). You are looking for the `bech32` encoded `address` in the `~/.gaiad/config/priv_validator.json` file. - -> _*Note:*_ To be in the validator set, you need to have more total voting power than the 100th validator. This is not normally an issue. - -### Problem #1: My validator has `voting_power: 0` - -Your validator has become auto-unbonded. In `gaia-7001`, we unbond validators if they do not vote on `50` of the last `100` blocks. Since blocks are proposed every ~2 seconds, a validator unresponsive for ~100 seconds will become unbonded. This usually happens when your `gaiad` process crashes. - -Here's how you can return the voting power back to your validator. First, if `gaiad` is not running, start it up again: - -```bash -gaiad start -``` - -Wait for your full node to catch up to the latest block. Next, run the following command. Note that `` is the address of your validator account, and `` is the name of the validator account. You can find this info by running `gaiacli keys list`. - -```bash -gaiacli stake unrevoke --chain-id=gaia-7001 --from= -``` - -**WARNING:** If you don't wait for `gaiad` to sync before running `unrevoke`, you will receive an error message telling you your validator is still jailed. - -Lastly, check your validator again to see if your voting power is back. - -```bash -gaiacli status -``` - -You may notice that your voting power is less than it used to be. That's because you got slashed for downtime! - -### Problem #2: My `gaiad` crashes because of `too many open files` - -The default number of files Linux can open (per-process) is `1024`. `gaiad` is known to open more than `1024` files. This causes the process to crash. A quick fix is to run `ulimit -n 4096` (increase the number of open files allowed) and then restart the process with `gaiad start`. If you are using `systemd` or another process manager to launch `gaiad` this may require some configuration at that level. A sample `systemd` file to fix this issue is below: - -```toml -# /etc/systemd/system/gaiad.service -[Unit] -Description=Cosmos Gaia Node -After=network.target - -[Service] -Type=simple -User=ubuntu -WorkingDirectory=/home/ubuntu -ExecStart=/home/ubuntu/go/bin/gaiad start -Restart=on-failure -RestartSec=3 -LimitNOFILE=4096 - -[Install] -WantedBy=multi-user.target -``` - -## Delegating to a Validator - -On the upcoming mainnet, you can delegate `Atom` to a validator. These [delegators](https://cosmos.network/resources/delegators) can receive part of the validator's fee revenue. Read more about the [Cosmos Token Model](https://github.com/cosmos/cosmos/raw/master/Cosmos_Token_Model.pdf). - -### Bond Tokens - -On the testnet, we delegate `steak` instead of `Atom`. Here's how you can bond tokens to a testnet validator: - -```bash -gaiacli stake delegate \ - --amount=10steak \ - --address-delegator= \ - --address-validator= \ - --from= \ - --chain-id=gaia-7001 -``` - -While tokens are bonded, they are pooled with all the other bonded tokens in the network. Validators and delegators obtain a percentage of shares that equal their stake in this pool. - -> _*NOTE:*_ Don't use more `steak` thank you have! You can always get more by using the [Faucet](https://gaia.faucetcosmos.network/)! - -### Unbond Tokens - -If for any reason the validator misbehaves, or you want to unbond a certain amount of tokens, use this following command. You can unbond a specific amount of`shares`\(eg:`12.1`\) or all of them \(`MAX`\). - -```bash -gaiacli stake unbond \ - --address-delegator= \ - --address-validator= \ - --shares=MAX \ - --from= \ - --chain-id=gaia-7001 -``` - -You can check your balance and your stake delegation to see that the unbonding went through successfully. - -```bash -gaiacli account - -gaiacli stake delegation \ - --address-delegator= \ - --address-validator= \ - --chain-id=gaia-7001 -``` - -## Governance - -Governance is the process from which users in the Cosmos Hub can come to consensus on software upgrades, parameters of the mainnet or on custom text proposals. This is done through voting on proposals, which will be submitted by `Atom` holders on the mainnet. - -Some considerations about the voting process: - -- Voting is done by bonded `Atom` holders on a 1 bonded `Atom` 1 vote basis -- Delegators inherit the vote of their validator if they don't vote -- **Validators MUST vote on every proposal**. If a validator does not vote on a proposal, they will be **partially slashed** -- Votes are tallied at the end of the voting period (2 weeks on mainnet). Each address can vote multiple times to update its `Option` value (paying the transaction fee each time), only the last casted vote will count as valid -- Voters can choose between options `Yes`, `No`, `NoWithVeto` and `Abstain` -At the end of the voting period, a proposal is accepted if `(YesVotes/(YesVotes+NoVotes+NoWithVetoVotes))>1/2` and `(NoWithVetoVotes/(YesVotes+NoVotes+NoWithVetoVotes))<1/3`. It is rejected otherwise - -For more information about the governance process and how it works, please check out the Governance module [specification](https://github.com/cosmos/cosmos-sdk/tree/develop/docs/spec/governance). - -### Create a Governance proposal - -In order to create a governance proposal, you must submit an initial deposit along with the proposal details: - -- `title`: Title of the proposal -- `description`: Description of the proposal -- `type`: Type of proposal. Must be of value _Text_ (types _SoftwareUpgrade_ and _ParameterChange_ not supported yet). - -```bash -gaiacli gov submit-proposal \ - --title= \ - --description=<description> \ - --type=<Text/ParameterChange/SoftwareUpgrade> \ - --proposer=<account_cosmosaccaddr> \ - --deposit=<40steak> \ - --from=<name> \ - --chain-id=gaia-7001 -``` - - -### Increase deposit - -In order for a proposal to be broadcasted to the network, the amount deposited must be above a `minDeposit` value (default: `10 steak`). If the proposal you previously created didn't meet this requirement, you can still increase the total amount deposited to activate it. Once the minimum deposit is reached, the proposal enters voting period: - -```bash -gaiacli gov deposit \ - --proposalID=<proposal_id> \ - --depositer=<account_cosmosaccaddr> \ - --deposit=<200steak> \ - --from=<name> \ - --chain-id=gaia-7001 -``` - -> _NOTE_: Proposals that don't meet this requirement will be deleted after `MaxDepositPeriod` is reached. - -#### Query proposal - -Once created, you can now query information of the proposal: - -```bash -gaiacli gov query-proposal \ - --proposalID=<proposal_id> \ - --chain-id=gaia-7001 -``` - -### Vote on a proposal - -After a proposal's deposit reaches the `MinDeposit` value, the voting period opens. Bonded `Atom` holders can then cast vote on it: - -```bash -gaiacli gov vote \ - --proposalID=<proposal_id> \ - --voter=<account_cosmosaccaddr> \ - --option=<Yes/No/NoWithVeto/Abstain> \ - --from=<name> \ - --chain-id=gaia-7001 -``` - -#### Query vote - -Check the vote with the option you just submitted: - -```bash -gaiacli gov query-vote \ - --proposalID=<proposal_id> \ - --voter=<account_cosmosaccaddr> \ - --chain-id=gaia-7001 -``` - -## Other Operations - -### Send Tokens - -```bash -gaiacli send \ - --amount=10faucetToken \ - --chain-id=gaia-7001 \ - --from=<key_name> \ - --to=<destination_cosmosaccaddr> -``` - -> _*NOTE:*_ The `--amount` flag accepts the format `--amount=<value|coin_name>`. - -Now, view the updated balances of the origin and destination accounts: - -```bash -gaiacli account <account_cosmosaccaddr> -gaiacli account <destination_cosmosaccaddr> -``` - -You can also check your balance at a given block by using the `--block` flag: - -```bash -gaiacli account <account_cosmosaccaddr> --block=<block_height> -``` - -## Create your Own Testnet - -To create your own testnet, first each validator will need to install gaiad and -run `gen-tx`: - -```bash -gaiad init gen-tx --name <account_name> -``` - -The validator will be prompted to enter a password for their new account. - -This populates `$HOME/.gaiad/gen-tx/` with a json file. - -Now these json files need to be aggregated together via Github, a Google form, pastebin or other methods. - -Place all files on one computer in `$HOME/.gaiad/gen-tx/` - -```bash -gaiad init --gen-txs -o --chain=<chain-name> -``` - -This will generate a `genesis.json` in `$HOME/.gaiad/config/genesis.json` distribute this file to all validators on your testnet. \ No newline at end of file +The rest of this folder was moved to the [testnets +repo](https://github.com/cosmos/testnets). diff --git a/cmd/gaia/testnets/STATUS.md b/cmd/gaia/testnets/STATUS.md index 442de16ec..b972eb802 100644 --- a/cmd/gaia/testnets/STATUS.md +++ b/cmd/gaia/testnets/STATUS.md @@ -1,4 +1,6 @@ -# TESTNET STATUS +# DEPRECATED + +See [testnets repo](https://github.com/cosmos/testnets). ## *July 22, 2018, 5:30 EST* - Gaia-7001 Consensus Failure diff --git a/docs/getting-started/full-node.md b/docs/getting-started/full-node.md index 82583a3c9..1add3f8c0 100644 --- a/docs/getting-started/full-node.md +++ b/docs/getting-started/full-node.md @@ -1,5 +1,11 @@ # Join the Testnet +::: tip Current Testnet +See the [testnet repo](https://github.com/cosmos/testnets) for +information on the latest testnet, including the correct version +of the Cosmos-SDK to use and details about the genesis file. +::: + Please ensure you have the [Cosmos SDK](/getting-started/installation.md) installed. If you ran a full node on a previous testnet, please skip to [Upgrading From Previous Testnet](#upgrading-from-previous-testnet). ## Setting Up a New Node @@ -52,30 +58,40 @@ Now it is time to upgrade the software: ```bash cd $GOPATH/src/github.com/cosmos/cosmos-sdk -git fetch --all && git checkout v0.19.0 +git fetch --all && git checkout master make update_tools && make get_vendor_deps && make install ``` +Note we use `master` here since it contains the latest stable release. +See the [testnet repo](https://github.com/cosmos/testnets) +for details on which version is needed for which testnet, +and the [SDK release page](https://github.com/cosmos/cosmos-sdk/releases) +for details on each release. + Your full node has been cleanly upgraded! ## Genesis & Seeds ### Copy the Genesis File -Copy the testnet's `genesis.json` file and place it in `gaiad`'s config directory. +Fetch the testnet's `genesis.json` file into `gaiad`'s config directory. ```bash mkdir -p $HOME/.gaiad/config -cp -a $GOPATH/src/github.com/cosmos/cosmos-sdk/cmd/gaia/testnets/gaia-6002/genesis.json $HOME/.gaiad/config/genesis.json +curl https://raw.githubusercontent.com/cosmos/testnets/master/latest/genesis.json > $HOME/.gaiad/config/genesis.json ``` +Note we use the `latest` directory in the [testnets repo](https://github.com/cosmos/testnets) +which contains details for the latest testnet. If you are connecting to a different testnet, ensure you +get the right files. + ### Add Seed Nodes Your node needs to know how to find peers. You'll need to add healthy seed nodes to `$HOME/.gaiad/config/config.toml`. Here are some seed nodes you can use: ```toml # Comma separated list of seed nodes to connect to -seeds = "38aa9bec3998f12ae9088b21a2d910d19d565c27@gaia-6002.coinculture.net:46656,80a35a46ce09cfb31ee220c8141a25e73e0b239b@seed.cosmos.cryptium.ch:46656,80a35a46ce09cfb31ee220c8141a25e73e0b239b@35.198.166.171:46656,032fa56301de335d835057fb6ad9f7ce2242a66d@165.227.236.213:46656" +seeds = "718145d422a823fd2a4e1e36e91b92bb0c4ddf8e@gaia-testnet.coinculture.net:26656,5922bf29b48a18c2300b85cc53f424fce23927ab@67.207.73.206:26656,7c8b8fd03577cd4817f5be1f03d506f879df98d8@gaia-7000-seed1.interblock.io:26656,a28737ff02391a6e00a1d3b79befd57e68e8264c@gaia-7000-seed2.interblock.io:26656,987ffd26640cd03d08ed7e53b24dfaa7956e612d@gaia-7000-seed3.interblock.io:26656" ``` If those seeds aren't working, you can find more seeds and persistent peers on the [Cosmos Explorer](https://explorecosmos.network/nodes). Open the the `Full Nodes` pane and select nodes that do not have private (`10.x.x.x`) or [local IP addresses](https://en.wikipedia.org/wiki/Private_network). The `Persistent Peer` field contains the connection string. For best results use 4-6. diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 70922dc20..c23f3b02c 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -20,12 +20,18 @@ echo "export PATH=$PATH:$GOBIN" >> ~/.bash_profile ## Install Cosmos SDK Next, let's install the testnet's version of the Cosmos SDK. +You can find information about the latest testnet and the right +version of the Cosmos-SDK for it in the [testnets +repo](https://github.com/cosmos/testnets#testnet-status). +Here we'll use the `master` branch, which contains the latest stable release. +If necessary, make sure you `git checkout` the correct +[released version](https://github.com/cosmos/cosmos-sdk/releases). ```bash mkdir -p $GOPATH/src/github.com/cosmos cd $GOPATH/src/github.com/cosmos git clone https://github.com/cosmos/cosmos-sdk -cd cosmos-sdk && git checkout v0.19.0 +cd cosmos-sdk && git checkout master make get_tools && make get_vendor_deps && make install ``` @@ -33,10 +39,7 @@ That will install the `gaiad` and `gaiacli` binaries. Verify that everything is ```bash $ gaiad version -0.19.0-c6711810 - $ gaiacli version -0.19.0-c6711810 ``` ## Run a Full Node diff --git a/docs/sdk/clients.md b/docs/sdk/clients.md index 0767745e5..f24f5b46d 100644 --- a/docs/sdk/clients.md +++ b/docs/sdk/clients.md @@ -10,7 +10,6 @@ 🚧 We are actively working on improving documentation for Gaiacli and Gaiad. ::: - `gaiacli` is the command line interface to manage accounts and transactions on Cosmos testnets. Here is a list of useful `gaiacli` commands, including usage examples. ### Key Types @@ -18,18 +17,20 @@ There are three types of key representations that are used: - `cosmosaccaddr` - * Derived from account keys generated by `gaiacli keys add` - * Used to receive funds - * e.g. `cosmosaccaddr15h6vd5f0wqps26zjlwrc6chah08ryu4hzzdwhc` + + - Derived from account keys generated by `gaiacli keys add` + - Used to receive funds + - e.g. `cosmosaccaddr15h6vd5f0wqps26zjlwrc6chah08ryu4hzzdwhc` - `cosmosaccpub` - * Derived from account keys generated by `gaiacli keys add` - * e.g. `cosmosaccpub1zcjduc3q7fu03jnlu2xpl75s2nkt7krm6grh4cc5aqth73v0zwmea25wj2hsqhlqzm` + + - Derived from account keys generated by `gaiacli keys add` + - e.g. `cosmosaccpub1zcjduc3q7fu03jnlu2xpl75s2nkt7krm6grh4cc5aqth73v0zwmea25wj2hsqhlqzm` - `cosmosvalpub` - * Generated when the node is created with `gaiad init`. - * Get this value with `gaiad tendermint show_validator` - * e.g. `cosmosvalpub1zcjduc3qcyj09qc03elte23zwshdx92jm6ce88fgc90rtqhjx8v0608qh5ssp0w94c` + - Generated when the node is created with `gaiad init`. + - Get this value with `gaiad tendermint show_validator` + - e.g. `cosmosvalpub1zcjduc3qcyj09qc03elte23zwshdx92jm6ce88fgc90rtqhjx8v0608qh5ssp0w94c` ### Generate Keys @@ -62,7 +63,7 @@ gaiad tendermint show_validator ``` ::: danger Warning -We strongly recommend *NOT* using the same passphrase for multiple keys. The Tendermint team and the Interchain Foundation will not be responsible for the loss of funds. +We strongly recommend _NOT_ using the same passphrase for multiple keys. The Tendermint team and the Interchain Foundation will not be responsible for the loss of funds. ::: ### Get Tokens @@ -86,7 +87,7 @@ We're working on improving our error messages! ```bash gaiacli send \ --amount=10faucetToken \ - --chain-id=gaia-6002 \ + --chain-id=gaia-7005 \ --name=<key_name> \ --to=<destination_cosmosaccaddr> ``` @@ -120,14 +121,14 @@ On the testnet, we delegate `steak` instead of `atom`. Here's how you can bond t gaiacli stake delegate \ --amount=10steak \ --address-validator=$(gaiad tendermint show_validator) \ - --from=<key_name> \ - --chain-id=gaia-6002 + --name=<key_name> \ + --chain-id=gaia-7005 ``` While tokens are bonded, they are pooled with all the other bonded tokens in the network. Validators and delegators obtain a percentage of shares that equal their stake in this pool. ::: tip Note - Don't use more `steak` thank you have! You can always get more by using the [Faucet](https://faucetcosmos.network/)! +Don't use more `steak` thank you have! You can always get more by using the [Faucet](https://faucetcosmos.network/)! ::: ### Unbond Tokens @@ -137,9 +138,9 @@ If for any reason the validator misbehaves, or you want to unbond a certain amou ```bash gaiacli stake unbond begin \ --address-validator=$(gaiad tendermint show_validator) \ - --shares-percent=1 \ - --from=<key_name> \ - --chain-id=gaia-6002 + --shares=MAX \ + --name=<key_name> \ + --chain-id=gaia-7005 ``` Later you must use the `gaiacli stake unbond complete` command to finish @@ -152,7 +153,7 @@ gaiacli account <account_cosmosaccaddr> gaiacli stake delegation \ --address-delegator=<account_cosmosaccaddr> \ --address-validator=$(gaiad tendermint show_validator) \ - --chain-id=gaia-6002 + --chain-id=gaia-7005 ``` ## Light Client Daemon diff --git a/docs/validators/validator-setup.md b/docs/validators/validator-setup.md index dad18151e..bac2c441d 100644 --- a/docs/validators/validator-setup.md +++ b/docs/validators/validator-setup.md @@ -1,5 +1,9 @@ # Validator Setup +::: warning Current Testnet +The current testnet is `gaia-7005`. +::: + Before setting up your validator node, make sure you've already gone through the [Full Node Setup](/getting-started/full-node.md) guide. ## Running a Validator Node @@ -30,7 +34,7 @@ gaiacli stake create-validator \ --pubkey=$(gaiad tendermint show_validator) \ --address-validator=<account_cosmosaccaddr> --moniker="choose a moniker" \ - --chain-id=gaia-6002 \ + --chain-id=gaia-7005 \ --name=<key_name> ``` @@ -47,17 +51,18 @@ gaiacli stake edit-validator --website="https://cosmos.network" \ --identity=6A0D65E29A4CBC8E --details="To infinity and beyond!" - --chain-id=gaia-6002 \ + --chain-id=gaia-7005 \ --name=<key_name> ``` ### View Validator Description + View the validator's information with this command: ```bash gaiacli stake validator \ --address-validator=<account_cosmosaccaddr> \ - --chain-id=gaia-6002 + --chain-id=gaia-7005 ``` ### Confirm Your Validator is Running @@ -79,7 +84,7 @@ To be in the validator set, you need to have more total voting power than the 10 ### Problem #1: My validator has `voting_power: 0` -Your validator has become auto-unbonded. In `gaia-6002`, we unbond validators if they do not vote on `50` of the last `100` blocks. Since blocks are proposed every ~2 seconds, a validator unresponsive for ~100 seconds will become unbonded. This usually happens when your `gaiad` process crashes. +Your validator has become auto-unbonded. In `gaia-7005`, we unbond validators if they do not vote on `50` of the last `100` blocks. Since blocks are proposed every ~2 seconds, a validator unresponsive for ~100 seconds will become unbonded. This usually happens when your `gaiad` process crashes. Here's how you can return the voting power back to your validator. First, if `gaiad` is not running, start it up again: @@ -90,7 +95,7 @@ gaiad start Wait for your full node to catch up to the latest block. Next, run the following command. Note that `<cosmosaccaddr>` is the address of your validator account, and `<name>` is the name of the validator account. You can find this info by running `gaiacli keys list`. ```bash -gaiacli stake unrevoke <cosmosaccaddr> --chain-id=gaia-6002 --name=<name> +gaiacli stake unrevoke <cosmosaccaddr> --chain-id=gaia-7005 --name=<name> ``` ::: danger Warning diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 4b1eef258..17f6de87b 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -62,8 +62,8 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.Ba // define and attach the mappers and keepers app.accountMapper = auth.NewAccountMapper( cdc, - app.keyAccount, // target store - func () auth.Account { + app.keyAccount, // target store + func() auth.Account { return &types.AppAccount{} }, ) diff --git a/version/version.go b/version/version.go index c6361dd50..9b332353b 100644 --- a/version/version.go +++ b/version/version.go @@ -2,10 +2,10 @@ package version const Maj = "0" -const Min = "22" -const Fix = "0" +const Min = "23" +const Fix = "1" -const Version = "0.22.0" +const Version = "0.23.1" // GitCommit set by build flags var GitCommit = "" diff --git a/x/gov/proposals.go b/x/gov/proposals.go index 01d839b8c..0a7f5de70 100644 --- a/x/gov/proposals.go +++ b/x/gov/proposals.go @@ -174,11 +174,11 @@ func (pt *ProposalKind) UnmarshalJSON(data []byte) error { // Turns VoteOption byte to String func (pt ProposalKind) String() string { switch pt { - case 0x01: + case ProposalTypeText: return "Text" - case 0x02: + case ProposalTypeParameterChange: return "ParameterChange" - case 0x03: + case ProposalTypeSoftwareUpgrade: return "SoftwareUpgrade" default: return "" diff --git a/x/slashing/keeper_test.go b/x/slashing/keeper_test.go index fc60c5029..5eeca8305 100644 --- a/x/slashing/keeper_test.go +++ b/x/slashing/keeper_test.go @@ -128,7 +128,8 @@ func TestHandleAbsentValidator(t *testing.T) { // validator should have been slashed pool = sk.GetPool(ctx) - require.Equal(t, int64(amtInt-1), pool.BondedTokens.RoundInt64()) + slashAmt := sdk.NewRat(amtInt).Mul(keeper.SlashFractionDowntime(ctx)).RoundInt64() + require.Equal(t, int64(amtInt)-slashAmt, pool.BondedTokens.RoundInt64()) // validator start height should have been changed info, found = keeper.getValidatorSigningInfo(ctx, sdk.ValAddress(val.Address()))