Merge branch 'master' into develop

This commit is contained in:
Ethan Buchman 2018-06-13 18:05:45 -07:00
commit 329bbdd502
6 changed files with 1579 additions and 17 deletions

View File

@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -50,7 +49,7 @@ func TestGaiaCLISend(t *testing.T) {
assert.Equal(t, int64(50), fooAcc.GetCoins().AmountOf("steak"))
executeWrite(t, fmt.Sprintf("gaiacli send %v --amount=10steak --to=%v --name=foo", flags, barCech), pass)
time.Sleep(time.Second * 2) // waiting for some blocks to pass
tests.WaitForNextHeightTM(port)
barAcc := executeGetAccount(t, fmt.Sprintf("gaiacli account %v %v", barCech, flags))
assert.Equal(t, int64(10), barAcc.GetCoins().AmountOf("steak"))
@ -59,7 +58,7 @@ func TestGaiaCLISend(t *testing.T) {
// test autosequencing
executeWrite(t, fmt.Sprintf("gaiacli send %v --amount=10steak --to=%v --name=foo", flags, barCech), pass)
time.Sleep(time.Second * 2) // waiting for some blocks to pass
tests.WaitForNextHeightTM(port)
barAcc = executeGetAccount(t, fmt.Sprintf("gaiacli account %v %v", barCech, flags))
assert.Equal(t, int64(20), barAcc.GetCoins().AmountOf("steak"))
@ -96,7 +95,7 @@ func TestGaiaCLICreateValidator(t *testing.T) {
require.NoError(t, err)
executeWrite(t, fmt.Sprintf("gaiacli send %v --amount=10steak --to=%v --name=foo", flags, barCech), pass)
time.Sleep(time.Second * 3) // waiting for some blocks to pass
tests.WaitForNextHeightTM(port)
barAcc := executeGetAccount(t, fmt.Sprintf("gaiacli account %v %v", barCech, flags))
assert.Equal(t, int64(10), barAcc.GetCoins().AmountOf("steak"))
@ -112,7 +111,7 @@ func TestGaiaCLICreateValidator(t *testing.T) {
cvStr += fmt.Sprintf(" --moniker=%v", "bar-vally")
executeWrite(t, cvStr, pass)
time.Sleep(time.Second * 3) // waiting for some blocks to pass
tests.WaitForNextHeightTM(port)
barAcc = executeGetAccount(t, fmt.Sprintf("gaiacli account %v %v", barCech, flags))
require.Equal(t, int64(8), barAcc.GetCoins().AmountOf("steak"), "%v", barAcc)
@ -131,7 +130,7 @@ func TestGaiaCLICreateValidator(t *testing.T) {
t.Log(fmt.Sprintf("debug unbondStr: %v\n", unbondStr))
executeWrite(t, unbondStr, pass)
time.Sleep(time.Second * 3) // waiting for some blocks to pass
tests.WaitForNextHeightTM(port)
barAcc = executeGetAccount(t, fmt.Sprintf("gaiacli account %v %v", barCech, flags))
require.Equal(t, int64(9), barAcc.GetCoins().AmountOf("steak"), "%v", barAcc)
@ -150,6 +149,8 @@ func executeWrite(t *testing.T, cmdStr string, writes ...string) {
require.NoError(t, err)
}
proc.Wait()
// bz := proc.StdoutBuffer.Bytes()
// fmt.Println("EXEC WRITE", string(bz))
}
func executeInit(t *testing.T, cmdStr string) (chainID string) {

View File

@ -0,0 +1,35 @@
# Gaiadebug
Simple tool for simple debugging.
We try to accept both hex and base64 formats and provide a useful response.
Note we often encode bytes as hex in the logs, but as base64 in the JSON.
## Pubkeys
The following give the same result:
```
gaiadebug pubkey TZTQnfqOsi89SeoXVnIw+tnFJnr4X8qVC0U8AsEmFk4=
gaiadebug pubkey 4D94D09DFA8EB22F3D49EA17567230FAD9C5267AF85FCA950B453C02C126164E
```
## Txs
Pass in a hex/base64 tx and get back the full JSON
```
gaiadebug tx <hex or base64 transaction>
```
## Hack
This is a command with boilerplate for using Go as a scripting language to hack
on an existing Gaia state.
Currently we have an example for the state of gaia-6001 after it
[crashed](https://github.com/cosmos/cosmos-sdk/blob/master/cmd/gaia/testnets/STATUS.md#june-13-2018-230-est---published-postmortem-of-gaia-6001-failure).
If you run `gaiadebug hack $HOME/.gaiad` on that
state, it will do a binary search on the state history to find when the state
invariant was violated.

View File

@ -1,4 +1,4 @@
# Connect to the `gaia-6001` Testnet
# Connect to the `gaia-6002` Testnet
Note: We are aware this documentation is sub-par. We are working to
improve the tooling and the documentation to make this process as painless as
@ -23,7 +23,7 @@ Next, let's install the testnet's version of the Cosmos SDK.
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.18.0
cd cosmos-sdk && git checkout v0.19.0
make get_tools && make get_vendor_deps && make install
```
@ -31,7 +31,7 @@ That will install the `gaiad` and `gaiacli` binaries. Verify that everything is
```
gaiad version
0.18.0-eceb56b7
0.19.0-<commit>
```
### Node Setup
@ -76,7 +76,7 @@ Now it is time to upgrade the software:
```
cd $GOPATH/src/github.com/cosmos/cosmos-sdk
git fetch --all && git checkout v0.18.0
git fetch --all && git checkout v0.19.0
make update_tools && make get_vendor_deps && make install
```
@ -90,7 +90,7 @@ Copy the testnet's `genesis.json` file and place it in `gaiad`'s config director
```
mkdir -p $HOME/.gaiad/config
cp -a $GOPATH/src/github.com/cosmos/cosmos-sdk/cmd/gaia/testnets/gaia-6001/genesis.json $HOME/.gaiad/config/genesis.json
cp -a $GOPATH/src/github.com/cosmos/cosmos-sdk/cmd/gaia/testnets/gaia-6002/genesis.json $HOME/.gaiad/config/genesis.json
```
### Add Seed Nodes
@ -99,7 +99,7 @@ Your node needs to know how to find peers. You'll need to add healthy seed nodes
```
# Comma separated list of seed nodes to connect to
seeds = "38aa9bec3998f12ae9088b21a2d910d19d565c27@gaia-6001.coinculture.net:46656,80a35a46ce09cfb31ee220c8141a25e73e0b239b@seed.cosmos.cryptium.ch:46656,80a35a46ce09cfb31ee220c8141a25e73e0b239b@35.198.166.171:46656,032fa56301de335d835057fb6ad9f7ce2242a66d@165.227.236.213:46656"
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"
```
You can also [ask other validators](https://riot.im/app/#/room/#cosmos_validators:matrix.org) for a persistent peer and add it under the `persistent_peers` key. For more information on seeds and peers, [read this](https://github.com/tendermint/tendermint/blob/develop/docs/using-tendermint.md#peers).

View File

@ -1,5 +1,26 @@
# TESTNET STATUS
## *June 13, 2018, 17:00 EST* - Gaia-6002 is making blocks!
- Gaia-6002 is live and making blocks
- Absent validators have been slashed and revoked
- Currently live with 17 validators
## *June 13, 2018, 4:30 EST* - New Testnet Gaia-6002
- After fixing bugs from gaia-6001, especially [issue
#1197](https://github.com/cosmos/cosmos-sdk/issues/1197), we are announcing a
new testnet, Gaia-6002
- Gaia-6002 has the same genesis file as Gaia-6001, just with the chain-id
updated
- Update from previous testnet [here](https://github.com/cosmos/cosmos-sdk/tree/master/cmd/gaia/testnets#upgrading-from-previous-testnet)
## *June 13, 2018, 4:30 EST* - New Release
- Released gaia
[v0.19.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.19.0)
- Includes various bug-fixes for staking found on Gaia-6001
## *June 13, 2018, 2:30 EST* - Published Postmortem of Gaia-6001 failure
- A bug in the design of the staking data model caused a sanity check to fail

File diff suppressed because it is too large Load Diff

View File

@ -7,16 +7,61 @@ import (
"time"
amino "github.com/tendermint/go-amino"
tmclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpcclient "github.com/tendermint/tendermint/rpc/lib/client"
)
func WaitForNextHeightTM(port string) {
url := fmt.Sprintf("http://localhost:%v", port)
cl := tmclient.NewHTTP(url, "/websocket")
resBlock, err := cl.Block(nil)
if err != nil {
panic(err)
}
waitForHeightTM(resBlock.Block.Height+1, url)
}
func WaitForHeightTM(height int64, port string) {
url := fmt.Sprintf("http://localhost:%v", port)
waitForHeightTM(height, url)
}
func waitForHeightTM(height int64, url string) {
cl := tmclient.NewHTTP(url, "/websocket")
for {
// get url, try a few times
var resBlock *ctypes.ResultBlock
var err error
INNER:
for i := 0; i < 5; i++ {
resBlock, err = cl.Block(nil)
if err == nil {
break INNER
}
time.Sleep(time.Millisecond * 200)
}
if err != nil {
panic(err)
}
if resBlock.Block != nil &&
resBlock.Block.Height >= height {
fmt.Println("HEIGHT", resBlock.Block.Height)
return
}
time.Sleep(time.Millisecond * 100)
}
}
// Uses localhost
func WaitForHeight(height int64, port string) {
url := fmt.Sprintf("http://localhost:%v/blocks/latest", port)
waitForHeight(height, url)
}
func waitForHeight(height int64, url string) {
for {
url := fmt.Sprintf("http://localhost:%v/blocks/latest", port)
// get url, try a few times
var res *http.Response
var err error
@ -25,7 +70,7 @@ func WaitForHeight(height int64, port string) {
if err == nil {
break
}
time.Sleep(time.Second)
time.Sleep(time.Millisecond * 200)
}
if err != nil {
panic(err)
@ -45,7 +90,8 @@ func WaitForHeight(height int64, port string) {
panic(err)
}
if resultBlock.Block.Height >= height {
if resultBlock.Block != nil &&
resultBlock.Block.Height >= height {
return
}
time.Sleep(time.Millisecond * 100)