From 6e4c8a51cd2b269641b8d12abe75c4dbffd7aad5 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Wed, 11 Sep 2019 15:03:40 -0400 Subject: [PATCH 01/14] update go.mod --- go.mod | 7 ++++--- go.sum | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 911e62da..90a28ad0 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,11 @@ module github.com/kava-labs/kava go 1.12 require ( - github.com/cosmos/cosmos-sdk v0.36.0-rc1 + github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 - github.com/stretchr/testify v1.3.0 + github.com/stretchr/testify v1.4.0 github.com/tendermint/go-amino v0.15.0 - github.com/tendermint/tendermint v0.32.1 + github.com/tendermint/tendermint v0.32.3 + github.com/tendermint/tm-db v0.1.1 ) diff --git a/go.sum b/go.sum index cbad7405..5e112af0 100644 --- a/go.sum +++ b/go.sum @@ -34,8 +34,14 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb h1:VKEfR1unkvgquOUgGcuXq6gPXDd7L125MSuCSEmthNM= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190911151311-849e2fb6385b h1:Dta0d6D/aGw+S3pSeBZ/wajE3AfaFjfJJ5lqDH1g/G8= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190911151311-849e2fb6385b/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= github.com/cosmos/cosmos-sdk v0.36.0-rc1 h1:hgSXNeVwNYxD0+O9DxRrxJcir9Z7Q5zreLV6G7GrjYA= github.com/cosmos/cosmos-sdk v0.36.0-rc1/go.mod h1:UV765S3m9sxCg8rYaBr4XgeHZl2UP6y++Coz9mLlYFc= +github.com/cosmos/cosmos-sdk v0.37.0 h1:S2I3NDGN2wqfGlY5KqkAHTpfezjhgeqDxrCxhlhd528= +github.com/cosmos/cosmos-sdk v0.37.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc= @@ -70,6 +76,8 @@ github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -82,6 +90,8 @@ github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -93,12 +103,18 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U= github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk= +github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -113,6 +129,7 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -121,10 +138,14 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= +github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-isatty v0.0.6 h1:SrwhHcpV4nWrMGdNcC2kXpMfcBVYGDuTArqyhocJgvA= github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -139,6 +160,8 @@ github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= +github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -168,6 +191,9 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.4 h1:zCS/YQCxfo/fQjCtGVGIyWGFnRbQ18Y55mhS3XPE+Oo= github.com/rakyll/statik v0.1.4/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= +github.com/rakyll/statik v0.1.5/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= +github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= +github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -175,6 +201,7 @@ github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -200,6 +227,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v0.0.0-20181105012736-f9080354173f/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= @@ -207,15 +236,24 @@ github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae h1:AOXNM7c2Vvo45SjAgeWF8Wy+NS7/NCqzRNpUc+HPAec= +github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk= github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk= github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.12.3-0.20190712145259-c834d3192b52 h1:l3qTzz8KkhZZSeLTJGqh0+iONjGM/tS5vvbunXjAmnA= github.com/tendermint/iavl v0.12.3-0.20190712145259-c834d3192b52/go.mod h1:A9IoWRVTibyXXlfZztHy52RloI85QOrIcsE9dyQh+DY= +github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= +github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= github.com/tendermint/tendermint v0.31.7/go.mod h1:ymcPyWblXCplCPQjbOYbrF1fWnpslATMVqiGgWbZrlc= github.com/tendermint/tendermint v0.32.1 h1:J8ddXMbCmG6GZjdCl/N1wgdXDU9uO91J2Y5CA9xYfGo= github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= +github.com/tendermint/tendermint v0.32.2/go.mod h1:NwMyx58S8VJ7tEpFKqRVlVWKO9N9zjTHu+Dx96VsnOE= +github.com/tendermint/tendermint v0.32.3 h1:GEnWpGQ795h5oTFNbfBLsY0LW/CW2j6p6HtiYNfxsgg= +github.com/tendermint/tendermint v0.32.3/go.mod h1:ZK2c29jl1QRYznIRyRWRDsmm1yvtPzBRT00x4t1JToY= +github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= +github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -237,6 +275,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U= +golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -249,6 +289,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJV golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -265,13 +307,17 @@ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -283,6 +329,8 @@ google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= +google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -297,3 +345,4 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 5acc23e6e5e39e7b3dee1f439b29309cca89a1ba Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Wed, 11 Sep 2019 18:33:20 -0400 Subject: [PATCH 02/14] update app package --- app/app.go | 160 ++++++++------ app/app_test.go | 12 +- app/export.go | 2 +- app/sim_test.go | 546 ++++++++++++++++++++++++------------------------ app/utils.go | 17 ++ 5 files changed, 389 insertions(+), 348 deletions(-) create mode 100644 app/utils.go diff --git a/app/app.go b/app/app.go index 4bb547d8..6154cb73 100644 --- a/app/app.go +++ b/app/app.go @@ -6,8 +6,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" cmn "github.com/tendermint/tendermint/libs/common" - dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" @@ -18,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/gov" @@ -41,7 +40,20 @@ var ( DefaultNodeHome = os.ExpandEnv("$HOME/.kvd") // ModuleBasics manages simple versions of full app modules. It's used for things such as codec registration and genesis file verification. - ModuleBasics module.BasicManager + ModuleBasics = module.NewBasicManager( + genaccounts.AppModuleBasic{}, + genutil.AppModuleBasic{}, + auth.AppModuleBasic{}, + bank.AppModuleBasic{}, + staking.AppModuleBasic{}, + mint.AppModuleBasic{}, + distr.AppModuleBasic{}, + gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler), + params.AppModuleBasic{}, + crisis.AppModuleBasic{}, + slashing.AppModuleBasic{}, + supply.AppModuleBasic{}, + ) // module account permissions mAccPerms = map[string][]string{ @@ -54,23 +66,6 @@ var ( } ) -func init() { - ModuleBasics = module.NewBasicManager( - genaccounts.AppModuleBasic{}, - genutil.AppModuleBasic{}, - auth.AppModuleBasic{}, - bank.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic(paramsclient.ProposalHandler, distrclient.ProposalHandler), - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - supply.AppModuleBasic{}, - ) -} - // Extended ABCI application type App struct { *bam.BaseApp @@ -79,18 +74,8 @@ type App struct { invCheckPeriod uint // keys to access the substores - keyMain *sdk.KVStoreKey - keyAccount *sdk.KVStoreKey - keySupply *sdk.KVStoreKey - keyStaking *sdk.KVStoreKey - tkeyStaking *sdk.TransientStoreKey - keySlashing *sdk.KVStoreKey - keyMint *sdk.KVStoreKey - keyDistr *sdk.KVStoreKey - tkeyDistr *sdk.TransientStoreKey - keyGov *sdk.KVStoreKey - keyParams *sdk.KVStoreKey - tkeyParams *sdk.TransientStoreKey + keys map[string]*sdk.KVStoreKey + tkeys map[string]*sdk.TransientStoreKey // keepers from all the modules accountKeeper auth.AccountKeeper @@ -106,6 +91,9 @@ type App struct { // the module manager mm *module.Manager + + // simulation manager + sm *module.SimulationManager } // NewApp returns a reference to an initialized App. @@ -119,77 +107,75 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetAppVersion(version.Version) + keys := sdk.NewKVStoreKeys( + bam.MainStoreKey, auth.StoreKey, staking.StoreKey, + supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey, + gov.StoreKey, params.StoreKey, + ) + tkeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey) + var app = &App{ BaseApp: bApp, cdc: cdc, invCheckPeriod: invCheckPeriod, - keyMain: sdk.NewKVStoreKey(bam.MainStoreKey), - keyAccount: sdk.NewKVStoreKey(auth.StoreKey), - keySupply: sdk.NewKVStoreKey(supply.StoreKey), - keyStaking: sdk.NewKVStoreKey(staking.StoreKey), - tkeyStaking: sdk.NewTransientStoreKey(staking.TStoreKey), - keyMint: sdk.NewKVStoreKey(mint.StoreKey), - keyDistr: sdk.NewKVStoreKey(distr.StoreKey), - tkeyDistr: sdk.NewTransientStoreKey(distr.TStoreKey), - keySlashing: sdk.NewKVStoreKey(slashing.StoreKey), - keyGov: sdk.NewKVStoreKey(gov.StoreKey), - keyParams: sdk.NewKVStoreKey(params.StoreKey), - tkeyParams: sdk.NewTransientStoreKey(params.TStoreKey), + keys: keys, + tkeys: tkeys, } // init params keeper and subspaces - app.paramsKeeper = params.NewKeeper(app.cdc, app.keyParams, app.tkeyParams, params.DefaultCodespace) + app.paramsKeeper = params.NewKeeper(app.cdc, keys[params.StoreKey], tkeys[params.TStoreKey], params.DefaultCodespace) authSubspace := app.paramsKeeper.Subspace(auth.DefaultParamspace) bankSubspace := app.paramsKeeper.Subspace(bank.DefaultParamspace) stakingSubspace := app.paramsKeeper.Subspace(staking.DefaultParamspace) mintSubspace := app.paramsKeeper.Subspace(mint.DefaultParamspace) distrSubspace := app.paramsKeeper.Subspace(distr.DefaultParamspace) slashingSubspace := app.paramsKeeper.Subspace(slashing.DefaultParamspace) - govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace) + govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable()) crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace) // add keepers app.accountKeeper = auth.NewAccountKeeper( app.cdc, - app.keyAccount, + keys[auth.StoreKey], authSubspace, auth.ProtoBaseAccount) app.bankKeeper = bank.NewBaseKeeper( app.accountKeeper, bankSubspace, - bank.DefaultCodespace) + bank.DefaultCodespace, + app.ModuleAccountAddrs()) app.supplyKeeper = supply.NewKeeper( app.cdc, - app.keySupply, + keys[supply.StoreKey], app.accountKeeper, app.bankKeeper, - supply.DefaultCodespace, mAccPerms) stakingKeeper := staking.NewKeeper( app.cdc, - app.keyStaking, - app.tkeyStaking, + keys[staking.StoreKey], + tkeys[staking.TStoreKey], app.supplyKeeper, stakingSubspace, staking.DefaultCodespace) app.mintKeeper = mint.NewKeeper( app.cdc, - app.keyMint, + keys[mint.StoreKey], mintSubspace, &stakingKeeper, app.supplyKeeper, auth.FeeCollectorName) app.distrKeeper = distr.NewKeeper( app.cdc, - app.keyDistr, + keys[distr.StoreKey], distrSubspace, &stakingKeeper, app.supplyKeeper, distr.DefaultCodespace, - auth.FeeCollectorName) + auth.FeeCollectorName, + app.ModuleAccountAddrs()) app.slashingKeeper = slashing.NewKeeper( app.cdc, - app.keySlashing, + keys[slashing.StoreKey], &stakingKeeper, slashingSubspace, slashing.DefaultCodespace) @@ -205,8 +191,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)) app.govKeeper = gov.NewKeeper( app.cdc, - app.keyGov, - app.paramsKeeper, + keys[gov.StoreKey], govSubspace, app.supplyKeeper, &stakingKeeper, @@ -218,19 +203,20 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, app.stakingKeeper = *stakingKeeper.SetHooks( staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks())) - // create the module manager + // create the module manager (Note: Any module instantiated in the module manager that is later modified + // must be passed by reference here.) app.mm = module.NewManager( genaccounts.NewAppModule(app.accountKeeper), genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx), auth.NewAppModule(app.accountKeeper), bank.NewAppModule(app.bankKeeper, app.accountKeeper), - crisis.NewAppModule(app.crisisKeeper), + crisis.NewAppModule(&app.crisisKeeper), supply.NewAppModule(app.supplyKeeper, app.accountKeeper), distr.NewAppModule(app.distrKeeper, app.supplyKeeper), gov.NewAppModule(app.govKeeper, app.supplyKeeper), mint.NewAppModule(app.mintKeeper), slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper), - staking.NewAppModule(app.stakingKeeper, app.distrKeeper, app.accountKeeper, app.supplyKeeper), + staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -238,7 +224,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, // CanWithdrawInvariant invariant. app.mm.SetOrderBeginBlockers(mint.ModuleName, distr.ModuleName, slashing.ModuleName) - app.mm.SetOrderEndBlockers(gov.ModuleName, staking.ModuleName) + app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName) // genutils must occur after staking so that pools are properly // initialized with tokens from genesis accounts. @@ -249,10 +235,29 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, app.mm.RegisterInvariants(&app.crisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter()) + // create the simulation manager and define the order of the modules for deterministic simulations + // + // NOTE: This is not required for apps that don't use the simulator for fuzz testing + // transactions. + app.sm = module.NewSimulationManager( + genaccounts.NewAppModule(app.accountKeeper), + auth.NewAppModule(app.accountKeeper), + bank.NewAppModule(app.bankKeeper, app.accountKeeper), + supply.NewAppModule(app.supplyKeeper, app.accountKeeper), + gov.NewAppModule(app.govKeeper, app.supplyKeeper), + mint.NewAppModule(app.mintKeeper), + distr.NewAppModule(app.distrKeeper, app.supplyKeeper), + staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper), + slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper), + ) + + app.sm.RegisterStoreDecoders() + + // initialize stores + app.MountKVStores(keys) + app.MountTransientStores(tkeys) + // initialize the app - app.MountStores(app.keyMain, app.keyAccount, app.keySupply, app.keyStaking, - app.keyMint, app.keyDistr, app.keySlashing, app.keyGov, app.keyParams, - app.tkeyParams, app.tkeyStaking, app.tkeyDistr) app.SetInitChainer(app.InitChainer) app.SetBeginBlocker(app.BeginBlocker) app.SetAnteHandler(auth.NewAnteHandler(app.accountKeeper, app.supplyKeeper, auth.DefaultSigVerificationGasConsumer)) @@ -260,7 +265,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, // load store if loadLatest { - err := app.LoadLatestVersion(app.keyMain) + err := app.LoadLatestVersion(app.keys[bam.MainStoreKey]) if err != nil { cmn.Exit(err.Error()) } @@ -272,10 +277,13 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, // custom tx codec func MakeCodec() *codec.Codec { var cdc = codec.New() + ModuleBasics.RegisterCodec(cdc) sdk.RegisterCodec(cdc) codec.RegisterCrypto(cdc) - return cdc + codec.RegisterEvidences(cdc) + + return cdc.Seal() } func SetBech32AddressPrefixes(config *sdk.Config) { @@ -303,15 +311,29 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res // load a particular height func (app *App) LoadHeight(height int64) error { - return app.LoadVersion(height, app.keyMain) + return app.LoadVersion(height, app.keys[bam.MainStoreKey]) } // ModuleAccountAddrs returns all the app's module account addresses. func (app *App) ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) for acc := range mAccPerms { - modAccAddrs[app.supplyKeeper.GetModuleAddress(acc).String()] = true + modAccAddrs[supply.NewModuleAddress(acc).String()] = true } return modAccAddrs } + +// Codec returns the application's sealed codec. +func (app *App) Codec() *codec.Codec { + return app.cdc +} + +// GetMaccPerms returns a mapping of the application's module account permissions. +func GetMaccPerms() map[string][]string { + perms := make(map[string][]string) + for k, v := range mAccPerms { + perms[k] = v + } + return perms +} diff --git a/app/app_test.go b/app/app_test.go index ed9f6400..ae3dfbf2 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + db "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/codec" @@ -24,6 +24,16 @@ func TestExport(t *testing.T) { require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } +// ensure that black listed addresses are properly set in bank keeper +func TestBlackListedAddrs(t *testing.T) { + db := db.NewMemDB() + app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, 0) + + for acc := range mAccPerms { + require.True(t, app.bankKeeper.BlacklistedAddr(app.supplyKeeper.GetModuleAddress(acc))) + } +} + func setGenesis(app *App) error { genesisState := NewDefaultGenesisState() diff --git a/app/export.go b/app/export.go index 81db5dd1..0b6c150c 100644 --- a/app/export.go +++ b/app/export.go @@ -124,7 +124,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. - store := ctx.KVStore(app.keyStaking) + store := ctx.KVStore(app.keys[staking.StoreKey]) iter := sdk.KVStoreReversePrefixIterator(store, staking.ValidatorsKey) counter := int16(0) diff --git a/app/sim_test.go b/app/sim_test.go index 15782411..803dbed0 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -2,33 +2,38 @@ package app import ( "encoding/json" - "flag" "fmt" - "io" "io/ioutil" "math/rand" "os" "testing" - "time" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/simapp" // TODO replace with types from app/genesis.go ? + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - authsim "github.com/cosmos/cosmos-sdk/x/auth/simulation" - "github.com/cosmos/cosmos-sdk/x/bank" - distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" - govsim "github.com/cosmos/cosmos-sdk/x/gov/simulation" - paramsim "github.com/cosmos/cosmos-sdk/x/params/simulation" + "github.com/cosmos/cosmos-sdk/x/auth" + authsimops "github.com/cosmos/cosmos-sdk/x/auth/simulation/operations" + banksimops "github.com/cosmos/cosmos-sdk/x/bank/simulation/operations" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + distrsimops "github.com/cosmos/cosmos-sdk/x/distribution/simulation/operations" + "github.com/cosmos/cosmos-sdk/x/gov" + govsimops "github.com/cosmos/cosmos-sdk/x/gov/simulation/operations" + "github.com/cosmos/cosmos-sdk/x/mint" + "github.com/cosmos/cosmos-sdk/x/params" + paramsimops "github.com/cosmos/cosmos-sdk/x/params/simulation/operations" "github.com/cosmos/cosmos-sdk/x/simulation" - slashingsim "github.com/cosmos/cosmos-sdk/x/slashing/simulation" + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingsimops "github.com/cosmos/cosmos-sdk/x/slashing/simulation/operations" "github.com/cosmos/cosmos-sdk/x/staking" - stakingsim "github.com/cosmos/cosmos-sdk/x/staking/simulation" + stakingsimops "github.com/cosmos/cosmos-sdk/x/staking/simulation/operations" + "github.com/cosmos/cosmos-sdk/x/supply" ) // Simulation parameter constants @@ -53,372 +58,276 @@ const ( OpWeightMsgUnjail = "op_weight_msg_unjail" ) -var ( - genesisFile string - paramsFile string - seed int64 - numBlocks int - blockSize int - enabled bool - verbose bool - lean bool - commit bool - period int - onOperation bool // TODO Remove in favor of binary search for invariant violation - allInvariants bool -) - func init() { - flag.StringVar(&genesisFile, "SimulationGenesis", "", "custom simulation genesis file; cannot be used with params file") - flag.StringVar(¶msFile, "SimulationParams", "", "custom simulation params file which overrides any random params; cannot be used with genesis") - flag.Int64Var(&seed, "SimulationSeed", 42, "simulation random seed") - flag.IntVar(&numBlocks, "SimulationNumBlocks", 500, "number of blocks") - flag.IntVar(&blockSize, "SimulationBlockSize", 200, "operations per block") - flag.BoolVar(&enabled, "SimulationEnabled", false, "enable the simulation") - flag.BoolVar(&verbose, "SimulationVerbose", false, "verbose log output") - flag.BoolVar(&lean, "SimulationLean", false, "lean simulation log output") - flag.BoolVar(&commit, "SimulationCommit", false, "have the simulation commit") - flag.IntVar(&period, "SimulationPeriod", 1, "run slow invariants only once every period assertions") - flag.BoolVar(&onOperation, "SimulateEveryOperation", false, "run slow invariants every operation") - flag.BoolVar(&allInvariants, "PrintAllInvariants", false, "print all invariants if a broken invariant is found") + simapp.GetSimulatorFlags() } -// helper function for populating input for SimulateFromSeed -func getSimulateFromSeedInput(tb testing.TB, w io.Writer, app *App) ( - testing.TB, io.Writer, *baseapp.BaseApp, simulation.AppStateFn, int64, - simulation.WeightedOperations, sdk.Invariants, int, int, bool, bool, bool, bool, map[string]bool, -) { - - return tb, w, app.BaseApp, appStateFn, seed, - testAndRunTxs(app), invariants(app), numBlocks, blockSize, commit, - lean, onOperation, allInvariants, app.ModuleAccountAddrs() -} - -func appStateFn( - r *rand.Rand, accs []simulation.Account, genesisTimestamp time.Time, -) (appState json.RawMessage, simAccs []simulation.Account, chainID string) { - - cdc := MakeCodec() - - switch { - case paramsFile != "" && genesisFile != "": - panic("cannot provide both a genesis file and a params file") - - case genesisFile != "": - appState, simAccs, chainID = simapp.AppStateFromGenesisFileFn(r, accs, genesisTimestamp) - - case paramsFile != "": - appParams := make(simulation.AppParams) - bz, err := ioutil.ReadFile(paramsFile) - if err != nil { - panic(err) - } - - cdc.MustUnmarshalJSON(bz, &appParams) - appState, simAccs, chainID = appStateRandomizedFn(r, accs, genesisTimestamp, appParams) - - default: - appParams := make(simulation.AppParams) - appState, simAccs, chainID = appStateRandomizedFn(r, accs, genesisTimestamp, appParams) - } - - return appState, simAccs, chainID -} - -// TODO refactor out random initialization code to the modules -func appStateRandomizedFn( - r *rand.Rand, accs []simulation.Account, genesisTimestamp time.Time, appParams simulation.AppParams, -) (json.RawMessage, []simulation.Account, string) { - - cdc := MakeCodec() - genesisState := simapp.NewDefaultGenesisState() - - var ( - amount int64 - numInitiallyBonded int64 - ) - - appParams.GetOrGenerate(cdc, StakePerAccount, &amount, r, - func(r *rand.Rand) { amount = int64(r.Intn(1e12)) }) - appParams.GetOrGenerate(cdc, InitiallyBondedValidators, &amount, r, - func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(250)) }) - - numAccs := int64(len(accs)) - if numInitiallyBonded > numAccs { - numInitiallyBonded = numAccs - } - - fmt.Printf( - `Selected randomly generated parameters for simulated genesis: -{ - stake_per_account: "%v", - initially_bonded_validators: "%v" -} -`, amount, numInitiallyBonded, - ) - - simapp.GenGenesisAccounts(cdc, r, accs, genesisTimestamp, amount, numInitiallyBonded, genesisState) - simapp.GenAuthGenesisState(cdc, r, appParams, genesisState) - simapp.GenBankGenesisState(cdc, r, appParams, genesisState) - simapp.GenSupplyGenesisState(cdc, amount, numInitiallyBonded, int64(len(accs)), genesisState) - simapp.GenGovGenesisState(cdc, r, appParams, genesisState) - simapp.GenMintGenesisState(cdc, r, appParams, genesisState) - simapp.GenDistrGenesisState(cdc, r, appParams, genesisState) - stakingGen := simapp.GenStakingGenesisState(cdc, r, accs, amount, numAccs, numInitiallyBonded, appParams, genesisState) - simapp.GenSlashingGenesisState(cdc, r, stakingGen, appParams, genesisState) - - appState, err := MakeCodec().MarshalJSON(genesisState) - if err != nil { - panic(err) - } - - return appState, accs, "simulation" -} - -func testAndRunTxs(app *App) []simulation.WeightedOperation { - cdc := MakeCodec() +func testAndRunTxs(app *App, config simulation.Config) []simulation.WeightedOperation { ap := make(simulation.AppParams) - if paramsFile != "" { - bz, err := ioutil.ReadFile(paramsFile) + paramChanges := app.sm.GenerateParamChanges(config.Seed) + + if config.ParamsFile != "" { + bz, err := ioutil.ReadFile(config.ParamsFile) if err != nil { panic(err) } - cdc.MustUnmarshalJSON(bz, &ap) + app.cdc.MustUnmarshalJSON(bz, &ap) } + // nolint: govet return []simulation.WeightedOperation{ { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightDeductFee, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightDeductFee, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - authsim.SimulateDeductFee(app.accountKeeper, app.supplyKeeper), + authsimops.SimulateDeductFee(app.accountKeeper, app.supplyKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgSend, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgSend, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - bank.SimulateMsgSend(app.accountKeeper, app.bankKeeper), + banksimops.SimulateMsgSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSingleInputMsgMultiSend, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSingleInputMsgMultiSend, &v, nil, func(_ *rand.Rand) { v = 10 }) return v }(nil), - bank.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), + banksimops.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgSetWithdrawAddress, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgSetWithdrawAddress, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsim.SimulateMsgSetWithdrawAddress(app.accountKeeper, app.distrKeeper), + distrsimops.SimulateMsgSetWithdrawAddress(app.distrKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawDelegationReward, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsim.SimulateMsgWithdrawDelegatorReward(app.accountKeeper, app.distrKeeper), + distrsimops.SimulateMsgWithdrawDelegatorReward(app.distrKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgWithdrawValidatorCommission, &v, nil, func(_ *rand.Rand) { v = 50 }) return v }(nil), - distrsim.SimulateMsgWithdrawValidatorCommission(app.accountKeeper, app.distrKeeper), + distrsimops.SimulateMsgWithdrawValidatorCommission(app.distrKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingTextProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingTextProposal, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, govsim.SimulateTextProposalContent), + govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, govsimops.SimulateTextProposalContent), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingCommunitySpendProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingCommunitySpendProposal, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, distrsim.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), + govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, distrsimops.SimulateCommunityPoolSpendProposalContent(app.distrKeeper)), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightSubmitVotingSlashingParamChangeProposal, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightSubmitVotingSlashingParamChangeProposal, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, paramsim.SimulateParamChangeProposalContent), + govsimops.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, paramsimops.SimulateParamChangeProposalContent(paramChanges)), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgDeposit, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgDeposit, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - govsim.SimulateMsgDeposit(app.govKeeper), + govsimops.SimulateMsgDeposit(app.govKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgCreateValidator, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgCreateValidator, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgCreateValidator(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgEditValidator, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgEditValidator, &v, nil, func(_ *rand.Rand) { v = 5 }) return v }(nil), - stakingsim.SimulateMsgEditValidator(app.stakingKeeper), + stakingsimops.SimulateMsgEditValidator(app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgDelegate, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgDelegate, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgDelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgUndelegate, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgUndelegate, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgUndelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgBeginRedelegate, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgBeginRedelegate, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - stakingsim.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), + stakingsimops.SimulateMsgBeginRedelegate(app.accountKeeper, app.stakingKeeper), }, { func(_ *rand.Rand) int { var v int - ap.GetOrGenerate(cdc, OpWeightMsgUnjail, &v, nil, + ap.GetOrGenerate(app.cdc, OpWeightMsgUnjail, &v, nil, func(_ *rand.Rand) { v = 100 }) return v }(nil), - slashingsim.SimulateMsgUnjail(app.slashingKeeper), + slashingsimops.SimulateMsgUnjail(app.slashingKeeper), }, } } -func invariants(app *App) []sdk.Invariant { - // TODO: fix PeriodicInvariants, it doesn't seem to call individual invariants for a period of 1 - // Ref: https://github.com/cosmos/cosmos-sdk/issues/4631 - if period == 1 { - return app.crisisKeeper.Invariants() - } - return simulation.PeriodicInvariants(app.crisisKeeper.Invariants(), period, 0) -} - -// Pass this in as an option to use a dbStoreAdapter instead of an IAVLStore for simulation speed. +// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of +// an IAVLStore for faster simulation speed. func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { bapp.SetFauxMerkleMode() } +// interBlockCacheOpt returns a BaseApp option function that sets the persistent +// inter-block write-through cache. +func interBlockCacheOpt() func(*baseapp.BaseApp) { + return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager()) +} + // Profile with: -// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -SimulationCommit=true -cpuprofile cpu.out -// TODO does this work +// /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/GaiaApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out func BenchmarkFullAppSimulation(b *testing.B) { logger := log.NewNopLogger() + config := simapp.NewConfigFromFlags() var db dbm.DB dir, _ := ioutil.TempDir("", "goleveldb-app-sim") db, _ = sdk.NewLevelDB("Simulation", dir) defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() - app := NewApp(logger, db, nil, true, 0) + + app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // Run randomized simulation - // TODO parameterize numbers, save for a later PR - _, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(b, os.Stdout, app)) - if err != nil { - fmt.Println(err) - b.Fail() + // TODO: parameterize numbers, save for a later PR + _, simParams, simErr := simulation.SimulateFromSeed( + b, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + ) + + // export state and params before the simulation error is checked + if config.ExportStatePath != "" { + if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { + fmt.Println(err) + b.Fail() + } } - if commit { - fmt.Println("GoLevelDB Stats") + + if config.ExportParamsPath != "" { + if err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath); err != nil { + fmt.Println(err) + b.Fail() + } + } + + if simErr != nil { + fmt.Println(simErr) + b.FailNow() + } + + if config.Commit { + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } } func TestFullAppSimulation(t *testing.T) { - if !enabled { - t.Skip("Skipping application simulation") + if !simapp.FlagEnabledValue { + t.Skip("skipping application simulation") } var logger log.Logger + config := simapp.NewConfigFromFlags() - if verbose { + if simapp.FlagVerboseValue { logger = log.TestingLogger() } else { logger = log.NewNopLogger() @@ -430,32 +339,49 @@ func TestFullAppSimulation(t *testing.T) { defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() - app := NewApp(logger, db, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "kava", app.Name()) + app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "GaiaApp", app.Name()) // Run randomized simulation - _, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) - if commit { + _, simParams, simErr := simulation.SimulateFromSeed( + t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + ) + + // export state and params before the simulation error is checked + if config.ExportStatePath != "" { + err := ExportStateToJSON(app, config.ExportStatePath) + require.NoError(t, err) + } + + if config.ExportParamsPath != "" { + err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) + require.NoError(t, err) + } + + require.NoError(t, simErr) + + if config.Commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) - fmt.Println("GoLevelDB Stats") + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } - - require.Nil(t, err) } func TestAppImportExport(t *testing.T) { - if !enabled { - t.Skip("Skipping application import/export simulation") + if !simapp.FlagEnabledValue { + t.Skip("skipping application import/export simulation") } var logger log.Logger - if verbose { + config := simapp.NewConfigFromFlags() + + if simapp.FlagVerboseValue { logger = log.TestingLogger() } else { logger = log.NewNopLogger() @@ -467,52 +393,65 @@ func TestAppImportExport(t *testing.T) { defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() - app := NewApp(logger, db, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "kava", app.Name()) + app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "SimApp", app.Name()) // Run randomized simulation - _, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + _, simParams, simErr := simulation.SimulateFromSeed( + t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + ) - if commit { + // export state and simParams before the simulation error is checked + if config.ExportStatePath != "" { + err := ExportStateToJSON(app, config.ExportStatePath) + require.NoError(t, err) + } + + if config.ExportParamsPath != "" { + err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) + require.NoError(t, err) + } + + require.NoError(t, simErr) + + if config.Commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) - fmt.Println("GoLevelDB Stats") + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } - require.Nil(t, err) - fmt.Printf("Exporting genesis...\n") + fmt.Printf("exporting genesis...\n") appState, _, err := app.ExportAppStateAndValidators(false, []string{}) require.NoError(t, err) - fmt.Printf("Importing genesis...\n") + fmt.Printf("importing genesis...\n") newDir, _ := ioutil.TempDir("", "goleveldb-app-sim-2") newDB, _ := sdk.NewLevelDB("Simulation-2", dir) defer func() { newDB.Close() - os.RemoveAll(newDir) + _ = os.RemoveAll(newDir) }() - newApp := NewApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "kava", newApp.Name()) + newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "SimApp", newApp.Name()) var genesisState simapp.GenesisState err = app.cdc.UnmarshalJSON(appState, &genesisState) - if err != nil { - panic(err) - } + require.NoError(t, err) - ctxB := newApp.NewContext(true, abci.Header{}) + ctxB := newApp.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) newApp.mm.InitGenesis(ctxB, genesisState) - fmt.Printf("Comparing stores...\n") - ctxA := app.NewContext(true, abci.Header{}) + fmt.Printf("comparing stores...\n") + ctxA := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()}) type StoreKeysPrefixes struct { A sdk.StoreKey @@ -521,38 +460,45 @@ func TestAppImportExport(t *testing.T) { } storeKeysPrefixes := []StoreKeysPrefixes{ - {app.keyMain, newApp.keyMain, [][]byte{}}, - {app.keyAccount, newApp.keyAccount, [][]byte{}}, - {app.keyStaking, newApp.keyStaking, [][]byte{staking.UnbondingQueueKey, - staking.RedelegationQueueKey, staking.ValidatorQueueKey}}, // ordering may change but it doesn't matter - {app.keySlashing, newApp.keySlashing, [][]byte{}}, - {app.keyMint, newApp.keyMint, [][]byte{}}, - {app.keyDistr, newApp.keyDistr, [][]byte{}}, - {app.keySupply, newApp.keySupply, [][]byte{}}, - {app.keyParams, newApp.keyParams, [][]byte{}}, - {app.keyGov, newApp.keyGov, [][]byte{}}, + {app.keys[baseapp.MainStoreKey], newApp.keys[baseapp.MainStoreKey], [][]byte{}}, + {app.keys[auth.StoreKey], newApp.keys[auth.StoreKey], [][]byte{}}, + {app.keys[staking.StoreKey], newApp.keys[staking.StoreKey], + [][]byte{ + staking.UnbondingQueueKey, staking.RedelegationQueueKey, staking.ValidatorQueueKey, + }}, // ordering may change but it doesn't matter + {app.keys[slashing.StoreKey], newApp.keys[slashing.StoreKey], [][]byte{}}, + {app.keys[mint.StoreKey], newApp.keys[mint.StoreKey], [][]byte{}}, + {app.keys[distr.StoreKey], newApp.keys[distr.StoreKey], [][]byte{}}, + {app.keys[supply.StoreKey], newApp.keys[supply.StoreKey], [][]byte{}}, + {app.keys[params.StoreKey], newApp.keys[params.StoreKey], [][]byte{}}, + {app.keys[gov.StoreKey], newApp.keys[gov.StoreKey], [][]byte{}}, } for _, storeKeysPrefix := range storeKeysPrefixes { storeKeyA := storeKeysPrefix.A storeKeyB := storeKeysPrefix.B prefixes := storeKeysPrefix.Prefixes + storeA := ctxA.KVStore(storeKeyA) storeB := ctxB.KVStore(storeKeyB) - kvA, kvB, count, equal := sdk.DiffKVStores(storeA, storeB, prefixes) - fmt.Printf("Compared %d key/value pairs between %s and %s\n", count, storeKeyA, storeKeyB) - require.True(t, equal, simapp.GetSimulationLog(storeKeyA.Name(), app.cdc, newApp.cdc, kvA, kvB)) - } + failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, prefixes) + require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") + + fmt.Printf("compared %d key/value pairs between %s and %s\n", len(failedKVAs), storeKeyA, storeKeyB) + require.Len(t, failedKVAs, 0, simapp.GetSimulationLog(storeKeyA.Name(), app.sm.StoreDecoders, app.cdc, failedKVAs, failedKVBs)) + } } func TestAppSimulationAfterImport(t *testing.T) { - if !enabled { - t.Skip("Skipping application simulation after import") + if !simapp.FlagEnabledValue { + t.Skip("skipping application simulation after import") } var logger log.Logger - if verbose { + config := simapp.NewConfigFromFlags() + + if simapp.FlagVerboseValue { logger = log.TestingLogger() } else { logger = log.NewNopLogger() @@ -563,25 +509,40 @@ func TestAppSimulationAfterImport(t *testing.T) { defer func() { db.Close() - os.RemoveAll(dir) + _ = os.RemoveAll(dir) }() - app := NewApp(logger, db, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "kava", app.Name()) + app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) + require.Equal(t, "GaiaApp", app.Name()) // Run randomized simulation - stopEarly, err := simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, app)) + // Run randomized simulation + stopEarly, simParams, simErr := simulation.SimulateFromSeed( + t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + ) - if commit { + // export state and params before the simulation error is checked + if config.ExportStatePath != "" { + err := ExportStateToJSON(app, config.ExportStatePath) + require.NoError(t, err) + } + + if config.ExportParamsPath != "" { + err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath) + require.NoError(t, err) + } + + require.NoError(t, simErr) + + if config.Commit { // for memdb: // fmt.Println("Database Size", db.Stats()["database.size"]) - fmt.Println("GoLevelDB Stats") + fmt.Println("\nGoLevelDB Stats") fmt.Println(db.Stats()["leveldb.stats"]) fmt.Println("GoLevelDB cached block size", db.Stats()["leveldb.cachedblock"]) } - require.Nil(t, err) - if stopEarly { // we can't export or import a zero-validator genesis fmt.Printf("We can't export or import a zero-validator genesis, exiting test...\n") @@ -602,64 +563,80 @@ func TestAppSimulationAfterImport(t *testing.T) { defer func() { newDB.Close() - os.RemoveAll(newDir) + _ = os.RemoveAll(newDir) }() newApp := NewApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "kava", newApp.Name()) + require.Equal(t, "GaiaApp", newApp.Name()) + newApp.InitChain(abci.RequestInitChain{ AppStateBytes: appState, }) // Run randomized simulation on imported app - _, err = simulation.SimulateFromSeed(getSimulateFromSeedInput(t, os.Stdout, newApp)) - require.Nil(t, err) + _, _, err = simulation.SimulateFromSeed( + t, os.Stdout, newApp.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + testAndRunTxs(newApp, config), newApp.ModuleAccountAddrs(), config, + ) + + require.NoError(t, err) } // TODO: Make another test for the fuzzer itself, which just has noOp txs // and doesn't depend on the application. func TestAppStateDeterminism(t *testing.T) { - if !enabled { - t.Skip("Skipping application simulation") + if !simapp.FlagEnabledValue { + t.Skip("skipping application simulation") } + config := simapp.NewConfigFromFlags() + config.InitialBlockHeight = 1 + config.ExportParamsPath = "" + config.OnOperation = false + config.AllInvariants = false + numSeeds := 3 numTimesToRunPerSeed := 5 appHashList := make([]json.RawMessage, numTimesToRunPerSeed) for i := 0; i < numSeeds; i++ { - seed := rand.Int63() + config.Seed = rand.Int63() + for j := 0; j < numTimesToRunPerSeed; j++ { logger := log.NewNopLogger() db := dbm.NewMemDB() - app := NewApp(logger, db, nil, true, 0) + app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) - // run randomized simulation - simulation.SimulateFromSeed( - t, os.Stdout, app.BaseApp, appStateFn, seed, - testAndRunTxs(app), - []sdk.Invariant{}, - 50, - 100, - true, - false, - false, - false, - app.ModuleAccountAddrs(), + fmt.Printf( + "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", + config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, ) + _, _, err := simulation.SimulateFromSeed( + t, os.Stdout, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, + ) + require.NoError(t, err) + appHash := app.LastCommitID().Hash appHashList[j] = appHash - } - for k := 1; k < numTimesToRunPerSeed; k++ { - require.Equal(t, appHashList[0], appHashList[k], "appHash list: %v", appHashList) + if j != 0 { + require.Equal( + t, appHashList[0], appHashList[j], + "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + ) + } } } } func BenchmarkInvariants(b *testing.B) { logger := log.NewNopLogger() + + config := simapp.NewConfigFromFlags() + config.AllInvariants = false + dir, _ := ioutil.TempDir("", "goleveldb-app-invariant-bench") db, _ := sdk.NewLevelDB("simulation", dir) @@ -668,16 +645,31 @@ func BenchmarkInvariants(b *testing.B) { os.RemoveAll(dir) }() - app := NewApp(logger, db, nil, true, 0) + app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, interBlockCacheOpt()) // 2. Run parameterized simulation (w/o invariants) - _, err := simulation.SimulateFromSeed( - b, ioutil.Discard, app.BaseApp, appStateFn, seed, testAndRunTxs(app), - []sdk.Invariant{}, numBlocks, blockSize, commit, lean, onOperation, false, - app.ModuleAccountAddrs(), + _, simParams, simErr := simulation.SimulateFromSeed( + b, ioutil.Discard, app.BaseApp, simapp.AppStateFn(app.Codec(), app.sm), + testAndRunTxs(app, config), app.ModuleAccountAddrs(), config, ) - if err != nil { - fmt.Println(err) + + // export state and params before the simulation error is checked + if config.ExportStatePath != "" { + if err := ExportStateToJSON(app, config.ExportStatePath); err != nil { + fmt.Println(err) + b.Fail() + } + } + + if config.ExportParamsPath != "" { + if err := simapp.ExportParamsToJSON(simParams, config.ExportParamsPath); err != nil { + fmt.Println(err) + b.Fail() + } + } + + if simErr != nil { + fmt.Println(simErr) b.FailNow() } @@ -690,7 +682,7 @@ func BenchmarkInvariants(b *testing.B) { for _, cr := range app.crisisKeeper.Routes() { b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { if res, stop := cr.Invar(ctx); stop { - fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, numBlocks, res) + fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) b.FailNow() } }) diff --git a/app/utils.go b/app/utils.go new file mode 100644 index 00000000..9c5742b4 --- /dev/null +++ b/app/utils.go @@ -0,0 +1,17 @@ +package app + +import ( + "fmt" + "io/ioutil" +) + +// ExportStateToJSON util function to export the app state to JSON +func ExportStateToJSON(app *App, path string) error { + fmt.Println("exporting app state...") + appState, _, err := app.ExportAppStateAndValidators(false, nil) + if err != nil { + return err + } + + return ioutil.WriteFile(path, []byte(appState), 0644) +} From 5d6141b4f2842e5acc30423ad7b84643859f93d3 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Wed, 11 Sep 2019 18:42:35 -0400 Subject: [PATCH 03/14] update cmd package --- cmd/kvd/main.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/kvd/main.go b/cmd/kvd/main.go index fc3ae833..cfffa083 100644 --- a/cmd/kvd/main.go +++ b/cmd/kvd/main.go @@ -9,9 +9,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/cli" - dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" + dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -74,11 +74,19 @@ func main() { } func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer) abci.Application { + var cache sdk.MultiStorePersistentCache + + if viper.GetBool(server.FlagInterBlockCache) { + cache = store.NewCommitKVStoreCacheManager() + } + return app.NewApp( logger, db, traceStore, true, invCheckPeriod, baseapp.SetPruning(store.NewPruningOptionsFromString(viper.GetString("pruning"))), baseapp.SetMinGasPrices(viper.GetString(server.FlagMinGasPrices)), - baseapp.SetHaltHeight(uint64(viper.GetInt(server.FlagHaltHeight))), + baseapp.SetHaltHeight(viper.GetUint64(server.FlagHaltHeight)), + baseapp.SetHaltTime(viper.GetUint64(server.FlagHaltTime)), + baseapp.SetInterBlockCache(cache), ) } From e6a96fa4da9eefeb084da11fe3443492ad1d2380 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Thu, 12 Sep 2019 12:19:13 -0400 Subject: [PATCH 04/14] update cli tests --- .gitignore | 1 + cli_test/README.md | 3 +- cli_test/cli_test.go | 414 +++++++++++++++++++++++++++++++-------- cli_test/doc.go | 2 - cli_test/test_helpers.go | 307 ++++++++++++++++++----------- go.mod | 2 +- go.sum | 129 +++++++----- 7 files changed, 613 insertions(+), 245 deletions(-) delete mode 100644 cli_test/doc.go diff --git a/.gitignore b/.gitignore index bf38f2d2..71fbf7e6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ # Exclude build files vendor +build diff --git a/cli_test/README.md b/cli_test/README.md index 8dacad3a..682b9b12 100644 --- a/cli_test/README.md +++ b/cli_test/README.md @@ -3,6 +3,7 @@ Run the full suite: ```bash +make build go test -v -p 4 ./cli_test -tags cli_test ``` @@ -10,4 +11,4 @@ go test -v -p 4 ./cli_test -tags cli_test > NOTE: While the full suite runs in parallel, some of the tests can take up to a minute to complete -> NOTE: The tests will use the `kvd` or `kvcli` binaries in your `$GOPATH/bin`. Or in `$BUILDDIR` if that env var is set. \ No newline at end of file +> NOTE: The tests will use the `kvd` or `kvcli` binaries in the build dir. Or in `$BUILDDIR` if that env var is set. \ No newline at end of file diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 0b9ab572..a242a6ef 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -14,15 +14,18 @@ import ( "testing" "time" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/crypto/ed25519" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/gov" + "github.com/cosmos/cosmos-sdk/x/mint" "github.com/kava-labs/kava/app" ) @@ -45,6 +48,9 @@ func TestGaiaCLIKeysAddMultisig(t *testing.T) { fmt.Sprintf("--multisig=%s,%s", keyBaz, keyBar), "--nosort") require.NotEqual(t, f.KeysShow("msig3").Address, f.KeysShow("msig4").Address) + + // Cleanup testing directories + f.Cleanup() } func TestGaiaCLIKeysAddRecover(t *testing.T) { @@ -56,7 +62,10 @@ func TestGaiaCLIKeysAddRecover(t *testing.T) { exitSuccess, _, _ = f.KeysAddRecover("test-recover", "dentist task convince chimney quality leave banana trade firm crawl eternal easily") require.True(t, exitSuccess) - require.Equal(t, "k1qcfdf69js922qrdr4yaww3ax7gjml6pd3fmkx7", f.KeyAddress("test-recover").String()) + require.Equal(t, "kava1qcfdf69js922qrdr4yaww3ax7gjml6pd39p8lj", f.KeyAddress("test-recover").String()) + + // Cleanup testing directories + f.Cleanup() } func TestGaiaCLIKeysAddRecoverHDPath(t *testing.T) { @@ -64,16 +73,19 @@ func TestGaiaCLIKeysAddRecoverHDPath(t *testing.T) { f := InitFixtures(t) f.KeysAddRecoverHDPath("test-recoverHD1", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 0, 0) - require.Equal(t, "k1qcfdf69js922qrdr4yaww3ax7gjml6pd3fmkx7", f.KeyAddress("test-recoverHD1").String()) + require.Equal(t, "kava1qcfdf69js922qrdr4yaww3ax7gjml6pd39p8lj", f.KeyAddress("test-recoverHD1").String()) f.KeysAddRecoverHDPath("test-recoverH2", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 1, 5) - require.Equal(t, "k1pdfav2cjhry9k79nu6r8kgknnjtq6a7rc043x0", f.KeyAddress("test-recoverH2").String()) + require.Equal(t, "kava1pdfav2cjhry9k79nu6r8kgknnjtq6a7rcr0qlr", f.KeyAddress("test-recoverH2").String()) f.KeysAddRecoverHDPath("test-recoverH3", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 1, 17) - require.Equal(t, "k1909k354n6wl8ujzu6kmh49w4d02ax7qvr0zelc", f.KeyAddress("test-recoverH3").String()) + require.Equal(t, "kava1909k354n6wl8ujzu6kmh49w4d02ax7qvrrcgx5", f.KeyAddress("test-recoverH3").String()) f.KeysAddRecoverHDPath("test-recoverH4", "dentist task convince chimney quality leave banana trade firm crawl eternal easily", 2, 17) - require.Equal(t, "k1v9plmhvyhgxk3th9ydacm7j4z357s3nhhh77jq", f.KeyAddress("test-recoverH4").String()) + require.Equal(t, "kava1v9plmhvyhgxk3th9ydacm7j4z357s3nhhmy0tv", f.KeyAddress("test-recoverH4").String()) + + // Cleanup testing directories + f.Cleanup() } func TestGaiaCLIMinimumFees(t *testing.T) { @@ -93,8 +105,9 @@ func TestGaiaCLIMinimumFees(t *testing.T) { barAddr := f.KeyAddress(keyBar) // Send a transaction that will get rejected - success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") - require.False(f.T, success) + success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") + require.Contains(t, stdOut, "insufficient fees") + require.True(f.T, success) tests.WaitForNextNBlocksTM(1, f.Port) // Ensure tx w/ correct fees pass @@ -105,8 +118,9 @@ func TestGaiaCLIMinimumFees(t *testing.T) { // Ensure tx w/ improper fees fails txFees = fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 1)) - success, _, _ = f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 10), txFees, "-y") - require.False(f.T, success) + success, stdOut, _ = f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 10), txFees, "-y") + require.Contains(t, stdOut, "insufficient fees") + require.True(f.T, success) // Cleanup testing directories f.Cleanup() @@ -125,10 +139,11 @@ func TestGaiaCLIGasPrices(t *testing.T) { // insufficient gas prices (tx fails) badGasPrice, _ := sdk.NewDecFromStr("0.000003") - success, _, _ := f.TxSend( + success, stdOut, _ := f.TxSend( keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 50), fmt.Sprintf("--gas-prices=%s", sdk.NewDecCoinFromDec(feeDenom, badGasPrice)), "-y") - require.False(t, success) + require.Contains(t, stdOut, "insufficient fees") + require.True(t, success) // wait for a block confirmation tests.WaitForNextNBlocksTM(1, f.Port) @@ -175,11 +190,12 @@ func TestGaiaCLIFeesDeduction(t *testing.T) { require.Equal(t, fooAmt.Int64(), fooAcc.GetCoins().AmountOf(fooDenom).Int64()) // insufficient funds (coins + fees) tx fails - largeCoins := sdk.TokensFromTendermintPower(10000000) - success, _, _ = f.TxSend( + largeCoins := sdk.TokensFromConsensusPower(10000000) + success, stdOut, _ := f.TxSend( keyFoo, barAddr, sdk.NewCoin(fooDenom, largeCoins), fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 2)), "-y") - require.False(t, success) + require.Contains(t, stdOut, "insufficient account funds") + require.True(t, success) // Wait for a block tests.WaitForNextNBlocksTM(1, f.Port) @@ -210,11 +226,11 @@ func TestGaiaCLISend(t *testing.T) { barAddr := f.KeyAddress(keyBar) fooAcc := f.QueryAccount(fooAddr) - startTokens := sdk.TokensFromTendermintPower(50) + startTokens := sdk.TokensFromConsensusPower(50) require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) // Send some tokens from one account to the other - sendTokens := sdk.TokensFromTendermintPower(10) + sendTokens := sdk.TokensFromConsensusPower(10) f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") tests.WaitForNextNBlocksTM(1, f.Port) @@ -228,6 +244,17 @@ func TestGaiaCLISend(t *testing.T) { success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--dry-run") require.True(t, success) + // Test --generate-only + success, stdout, stderr := f.TxSend( + fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only=true", + ) + require.Empty(t, stderr) + require.True(t, success) + msg := unmarshalStdTx(f.T, stdout) + require.NotZero(t, msg.Fee.Gas) + require.Len(t, msg.Msgs, 1) + require.Len(t, msg.GetSignatures(), 0) + // Check state didn't change fooAcc = f.QueryAccount(fooAddr) require.Equal(t, startTokens.Sub(sendTokens), fooAcc.GetCoins().AmountOf(denom)) @@ -255,6 +282,7 @@ func TestGaiaCLISend(t *testing.T) { f.Cleanup() } +// TODO needed? not in gaia tests func TestGaiaCLIConfirmTx(t *testing.T) { t.Parallel() f := InitFixtures(t) @@ -268,12 +296,12 @@ func TestGaiaCLIConfirmTx(t *testing.T) { barAddr := f.KeyAddress(keyBar) fooAcc := f.QueryAccount(fooAddr) - startTokens := sdk.TokensFromTendermintPower(50) + startTokens := sdk.TokensFromConsensusPower(50) require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) // send some tokens from one account to the other - sendTokens := sdk.TokensFromTendermintPower(10) - f.txSendWithConfirm(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "Y") + sendTokens := sdk.TokensFromConsensusPower(10) + f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") tests.WaitForNextNBlocksTM(1, f.Port) // ensure account balances match expected @@ -281,7 +309,7 @@ func TestGaiaCLIConfirmTx(t *testing.T) { require.Equal(t, sendTokens, barAcc.GetCoins().AmountOf(denom)) // send some tokens from one account to the other (cancelling confirmation) - f.txSendWithConfirm(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "n") + f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-n") tests.WaitForNextNBlocksTM(1, f.Port) // ensure account balances match expected @@ -301,13 +329,14 @@ func TestGaiaCLIGasAuto(t *testing.T) { barAddr := f.KeyAddress(keyBar) fooAcc := f.QueryAccount(fooAddr) - startTokens := sdk.TokensFromTendermintPower(50) + startTokens := sdk.TokensFromConsensusPower(50) require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) // Test failure with auto gas disabled and very little gas set by hand - sendTokens := sdk.TokensFromTendermintPower(10) - success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") - require.False(t, success) + sendTokens := sdk.TokensFromConsensusPower(10) + success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") + require.Contains(t, stdOut, "out of gas in location") + require.True(t, success) // Check state didn't change fooAcc = f.QueryAccount(fooAddr) @@ -322,8 +351,9 @@ func TestGaiaCLIGasAuto(t *testing.T) { require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) // Test failure with 0 gas - success, _, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") - require.False(t, success) + success, stdOut, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") + require.Contains(t, stdOut, "out of gas in location") + require.True(t, success) // Check state didn't change fooAcc = f.QueryAccount(fooAddr) @@ -360,7 +390,7 @@ func TestGaiaCLICreateValidator(t *testing.T) { consPubKey := sdk.MustBech32ifyConsPub(ed25519.GenPrivKey().PubKey()) - sendTokens := sdk.TokensFromTendermintPower(10) + sendTokens := sdk.TokensFromConsensusPower(10) f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "-y") tests.WaitForNextNBlocksTM(1, f.Port) @@ -378,7 +408,7 @@ func TestGaiaCLICreateValidator(t *testing.T) { require.Equal(t, 0, len(msg.GetSignatures())) // Test --dry-run - newValTokens := sdk.TokensFromTendermintPower(2) + newValTokens := sdk.TokensFromConsensusPower(2) success, _, _ = f.TxStakingCreateValidator(keyBar, consPubKey, sdk.NewCoin(denom, newValTokens), "--dry-run") require.True(t, success) @@ -401,7 +431,7 @@ func TestGaiaCLICreateValidator(t *testing.T) { require.NotZero(t, validatorDelegations[0].Shares) // unbond a single share - unbondAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromTendermintPower(1)) + unbondAmt := sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromConsensusPower(1)) success = f.TxStakingUnbond(keyBar, unbondAmt.String(), barVal, "-y") require.True(t, success) tests.WaitForNextNBlocksTM(1, f.Port) @@ -420,6 +450,56 @@ func TestGaiaCLICreateValidator(t *testing.T) { f.Cleanup() } +func TestGaiaCLIQueryRewards(t *testing.T) { + t.Parallel() + f := InitFixtures(t) + cdc := app.MakeCodec() + + genesisState := f.GenesisState() + inflationMin := sdk.MustNewDecFromStr("10000.0") + var mintData mint.GenesisState + cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) + mintData.Minter.Inflation = inflationMin + mintData.Params.InflationMin = inflationMin + mintData.Params.InflationMax = sdk.MustNewDecFromStr("15000.0") + mintDataBz, err := cdc.MarshalJSON(mintData) + require.NoError(t, err) + genesisState[mint.ModuleName] = mintDataBz + + genFile := filepath.Join(f.GaiadHome, "config", "genesis.json") + genDoc, err := tmtypes.GenesisDocFromFile(genFile) + require.NoError(t, err) + genDoc.AppState, err = cdc.MarshalJSON(genesisState) + require.NoError(t, genDoc.SaveAs(genFile)) + + // start gaiad server + proc := f.GDStart() + defer proc.Stop(false) + + fooAddr := f.KeyAddress(keyFoo) + rewards := f.QueryRewards(fooAddr) + require.Equal(t, 1, len(rewards.Rewards)) + + f.Cleanup() +} + +func TestGaiaCLIQuerySupply(t *testing.T) { + t.Parallel() + f := InitFixtures(t) + + // start gaiad server + proc := f.GDStart() + defer proc.Stop(false) + + totalSupply := f.QueryTotalSupply() + totalSupplyOf := f.QueryTotalSupplyOf(fooDenom) + + require.Equal(t, totalCoins, totalSupply) + require.True(sdk.IntEq(t, totalCoins.AmountOf(fooDenom), totalSupplyOf)) + + f.Cleanup() +} + func TestGaiaCLISubmitProposal(t *testing.T) { t.Parallel() f := InitFixtures(t) @@ -435,14 +515,14 @@ func TestGaiaCLISubmitProposal(t *testing.T) { fooAddr := f.KeyAddress(keyFoo) fooAcc := f.QueryAccount(fooAddr) - startTokens := sdk.TokensFromTendermintPower(50) + startTokens := sdk.TokensFromConsensusPower(50) require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom)) proposalsQuery := f.QueryGovProposals() require.Empty(t, proposalsQuery) // Test submit generate only for submit proposal - proposalTokens := sdk.TokensFromTendermintPower(5) + proposalTokens := sdk.TokensFromConsensusPower(5) success, stdout, stderr := f.TxGovSubmitProposal( fooAddr.String(), "Text", "Test", "test", sdk.NewCoin(denom, proposalTokens), "--generate-only", "-y") require.True(t, success) @@ -461,8 +541,8 @@ func TestGaiaCLISubmitProposal(t *testing.T) { tests.WaitForNextNBlocksTM(1, f.Port) // Ensure transaction tags can be queried - txs := f.QueryTxs(1, 50, "action:submit_proposal", fmt.Sprintf("proposer:%s", fooAddr)) - require.Len(t, txs, 1) + searchResult := f.QueryTxs(1, 50, "message.action:submit_proposal", fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, searchResult.Txs, 1) // Ensure deposit was deducted fooAcc = f.QueryAccount(fooAddr) @@ -482,7 +562,7 @@ func TestGaiaCLISubmitProposal(t *testing.T) { require.Equal(t, proposalTokens, deposit.Amount.AmountOf(denom)) // Test deposit generate only - depositTokens := sdk.TokensFromTendermintPower(10) + depositTokens := sdk.TokensFromConsensusPower(10) success, stdout, stderr = f.TxGovDeposit(1, fooAddr.String(), sdk.NewCoin(denom, depositTokens), "--generate-only") require.True(t, success) require.Empty(t, stderr) @@ -505,8 +585,8 @@ func TestGaiaCLISubmitProposal(t *testing.T) { require.Equal(t, proposalTokens.Add(depositTokens), deposit.Amount.AmountOf(denom)) // Ensure tags are set on the transaction - txs = f.QueryTxs(1, 50, "action:deposit", fmt.Sprintf("depositor:%s", fooAddr)) - require.Len(t, txs, 1) + searchResult = f.QueryTxs(1, 50, "message.action:deposit", fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, searchResult.Txs, 1) // Ensure account has expected amount of funds fooAcc = f.QueryAccount(fooAddr) @@ -542,8 +622,8 @@ func TestGaiaCLISubmitProposal(t *testing.T) { require.Equal(t, gov.OptionYes, votes[0].Option) // Ensure tags are applied to voting transaction properly - txs = f.QueryTxs(1, 50, "action:vote", fmt.Sprintf("voter:%s", fooAddr)) - require.Len(t, txs, 1) + searchResult = f.QueryTxs(1, 50, "message.action:vote", fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, searchResult.Txs, 1) // Ensure no proposals in deposit period proposalsQuery = f.QueryGovProposals("--status=DepositPeriod") @@ -564,6 +644,154 @@ func TestGaiaCLISubmitProposal(t *testing.T) { f.Cleanup() } +func TestGaiaCLISubmitParamChangeProposal(t *testing.T) { + t.Parallel() + f := InitFixtures(t) + + proc := f.GDStart() + defer proc.Stop(false) + + fooAddr := f.KeyAddress(keyFoo) + fooAcc := f.QueryAccount(fooAddr) + startTokens := sdk.TokensFromConsensusPower(50) + require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom)) + + // write proposal to file + proposalTokens := sdk.TokensFromConsensusPower(5) + proposal := fmt.Sprintf(`{ + "title": "Param Change", + "description": "Update max validators", + "changes": [ + { + "subspace": "staking", + "key": "MaxValidators", + "value": 105 + } + ], + "deposit": [ + { + "denom": "stake", + "amount": "%s" + } + ] +} +`, proposalTokens.String()) + + proposalFile := WriteToNewTempFile(t, proposal) + + // create the param change proposal + f.TxGovSubmitParamChangeProposal(keyFoo, proposalFile.Name(), sdk.NewCoin(denom, proposalTokens), "-y") + tests.WaitForNextNBlocksTM(1, f.Port) + + // ensure transaction tags can be queried + txsPage := f.QueryTxs(1, 50, "message.action:submit_proposal", fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, txsPage.Txs, 1) + + // ensure deposit was deducted + fooAcc = f.QueryAccount(fooAddr) + require.Equal(t, startTokens.Sub(proposalTokens).String(), fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom).String()) + + // ensure proposal is directly queryable + proposal1 := f.QueryGovProposal(1) + require.Equal(t, uint64(1), proposal1.ProposalID) + require.Equal(t, gov.StatusDepositPeriod, proposal1.Status) + + // ensure correct query proposals result + proposalsQuery := f.QueryGovProposals() + require.Equal(t, uint64(1), proposalsQuery[0].ProposalID) + + // ensure the correct deposit amount on the proposal + deposit := f.QueryGovDeposit(1, fooAddr) + require.Equal(t, proposalTokens, deposit.Amount.AmountOf(denom)) + + // Cleanup testing directories + f.Cleanup() +} + +func TestGaiaCLISubmitCommunityPoolSpendProposal(t *testing.T) { + t.Parallel() + f := InitFixtures(t) + + // create some inflation + cdc := app.MakeCodec() + genesisState := f.GenesisState() + inflationMin := sdk.MustNewDecFromStr("10000.0") + var mintData mint.GenesisState + cdc.UnmarshalJSON(genesisState[mint.ModuleName], &mintData) + mintData.Minter.Inflation = inflationMin + mintData.Params.InflationMin = inflationMin + mintData.Params.InflationMax = sdk.MustNewDecFromStr("15000.0") + mintDataBz, err := cdc.MarshalJSON(mintData) + require.NoError(t, err) + genesisState[mint.ModuleName] = mintDataBz + + genFile := filepath.Join(f.GaiadHome, "config", "genesis.json") + genDoc, err := tmtypes.GenesisDocFromFile(genFile) + require.NoError(t, err) + genDoc.AppState, err = cdc.MarshalJSON(genesisState) + require.NoError(t, genDoc.SaveAs(genFile)) + + proc := f.GDStart() + defer proc.Stop(false) + + fooAddr := f.KeyAddress(keyFoo) + fooAcc := f.QueryAccount(fooAddr) + startTokens := sdk.TokensFromConsensusPower(50) + require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom)) + + tests.WaitForNextNBlocksTM(3, f.Port) + + // write proposal to file + proposalTokens := sdk.TokensFromConsensusPower(5) + proposal := fmt.Sprintf(`{ + "title": "Community Pool Spend", + "description": "Spend from community pool", + "recipient": "%s", + "amount": [ + { + "denom": "%s", + "amount": "1" + } + ], + "deposit": [ + { + "denom": "%s", + "amount": "%s" + } + ] +} +`, fooAddr, sdk.DefaultBondDenom, sdk.DefaultBondDenom, proposalTokens.String()) + proposalFile := WriteToNewTempFile(t, proposal) + + // create the param change proposal + f.TxGovSubmitCommunityPoolSpendProposal(keyFoo, proposalFile.Name(), sdk.NewCoin(denom, proposalTokens), "-y") + tests.WaitForNextNBlocksTM(1, f.Port) + + // ensure transaction tags can be queried + txsPage := f.QueryTxs(1, 50, "message.action:submit_proposal", fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, txsPage.Txs, 1) + + // ensure deposit was deducted + fooAcc = f.QueryAccount(fooAddr) + require.Equal(t, startTokens.Sub(proposalTokens).String(), fooAcc.GetCoins().AmountOf(sdk.DefaultBondDenom).String()) + + // ensure proposal is directly queryable + proposal1 := f.QueryGovProposal(1) + require.Equal(t, uint64(1), proposal1.ProposalID) + require.Equal(t, gov.StatusDepositPeriod, proposal1.Status) + + // ensure correct query proposals result + proposalsQuery := f.QueryGovProposals() + require.Equal(t, uint64(1), proposalsQuery[0].ProposalID) + + // ensure the correct deposit amount on the proposal + deposit := f.QueryGovDeposit(1, fooAddr) + require.Equal(t, proposalTokens, deposit.Amount.AmountOf(denom)) + + // Cleanup testing directories + f.Cleanup() +} + func TestGaiaCLIQueryTxPagination(t *testing.T) { t.Parallel() f := InitFixtures(t) @@ -585,32 +813,33 @@ func TestGaiaCLIQueryTxPagination(t *testing.T) { } // perPage = 15, 2 pages - txsPage1 := f.QueryTxs(1, 15, fmt.Sprintf("sender:%s", fooAddr)) - require.Len(t, txsPage1, 15) - txsPage2 := f.QueryTxs(2, 15, fmt.Sprintf("sender:%s", fooAddr)) - require.Len(t, txsPage2, 15) - require.NotEqual(t, txsPage1, txsPage2) - txsPage3 := f.QueryTxs(3, 15, fmt.Sprintf("sender:%s", fooAddr)) - require.Len(t, txsPage3, 15) - require.Equal(t, txsPage2, txsPage3) + txsPage1 := f.QueryTxs(1, 15, fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, txsPage1.Txs, 15) + require.Equal(t, txsPage1.Count, 15) + txsPage2 := f.QueryTxs(2, 15, fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, txsPage2.Txs, 15) + require.NotEqual(t, txsPage1.Txs, txsPage2.Txs) // perPage = 16, 2 pages - txsPage1 = f.QueryTxs(1, 16, fmt.Sprintf("sender:%s", fooAddr)) - require.Len(t, txsPage1, 16) - txsPage2 = f.QueryTxs(2, 16, fmt.Sprintf("sender:%s", fooAddr)) - require.Len(t, txsPage2, 14) - require.NotEqual(t, txsPage1, txsPage2) + txsPage1 = f.QueryTxs(1, 16, fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, txsPage1.Txs, 16) + txsPage2 = f.QueryTxs(2, 16, fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, txsPage2.Txs, 14) + require.NotEqual(t, txsPage1.Txs, txsPage2.Txs) // perPage = 50 - txsPageFull := f.QueryTxs(1, 50, fmt.Sprintf("sender:%s", fooAddr)) - require.Len(t, txsPageFull, 30) - require.Equal(t, txsPageFull, append(txsPage1, txsPage2...)) + txsPageFull := f.QueryTxs(1, 50, fmt.Sprintf("message.sender:%s", fooAddr)) + require.Len(t, txsPageFull.Txs, 30) + require.Equal(t, txsPageFull.Txs, append(txsPage1.Txs, txsPage2.Txs...)) // perPage = 0 - f.QueryTxsInvalid(errors.New("ERROR: page must greater than 0"), 0, 50, fmt.Sprintf("sender:%s", fooAddr)) + f.QueryTxsInvalid(errors.New("ERROR: page must greater than 0"), 0, 50, fmt.Sprintf("message.sender:%s", fooAddr)) // limit = 0 - f.QueryTxsInvalid(errors.New("ERROR: limit must greater than 0"), 1, 0, fmt.Sprintf("sender:%s", fooAddr)) + f.QueryTxsInvalid(errors.New("ERROR: limit must greater than 0"), 1, 0, fmt.Sprintf("message.sender:%s", fooAddr)) + + // Cleanup testing directories + f.Cleanup() } func TestGaiaCLIValidateSignatures(t *testing.T) { @@ -675,7 +904,7 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { barAddr := f.KeyAddress(keyBar) // Test generate sendTx with default gas - sendTokens := sdk.TokensFromTendermintPower(10) + sendTokens := sdk.TokensFromConsensusPower(10) success, stdout, stderr := f.TxSend(fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only") require.True(t, success) require.Empty(t, stderr) @@ -694,9 +923,9 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { require.Equal(t, 0, len(msg.GetSignatures())) // Test generate sendTx, estimate gas - success, stdout, stderr = f.TxSend(fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--gas=auto", "--generate-only") + success, stdout, stderr = f.TxSend(fooAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only") require.True(t, success) - require.NotEmpty(t, stderr) + require.Empty(t, stderr) msg = unmarshalStdTx(t, stdout) require.True(t, msg.Fee.Gas > 0) require.Equal(t, len(msg.Msgs), 1) @@ -730,19 +959,12 @@ func TestGaiaCLISendGenerateSignAndBroadcast(t *testing.T) { // Ensure foo has right amount of funds fooAcc := f.QueryAccount(fooAddr) - startTokens := sdk.TokensFromTendermintPower(50) + startTokens := sdk.TokensFromConsensusPower(50) require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) // Test broadcast success, stdout, _ = f.TxBroadcast(signedTxFile.Name()) require.True(t, success) - - var result sdk.TxResponse - - // Unmarshal the response and ensure that gas was properly used - require.Nil(t, app.MakeCodec().UnmarshalJSON([]byte(stdout), &result)) - require.Equal(t, msg.Fee.Gas, uint64(result.GasUsed)) - require.Equal(t, msg.Fee.Gas, uint64(result.GasWanted)) tests.WaitForNextNBlocksTM(1, f.Port) // Ensure account state @@ -799,8 +1021,12 @@ func TestGaiaCLIMultisignInsufficientCosigners(t *testing.T) { require.False(t, success) // Broadcast the transaction - success, _, _ = f.TxBroadcast(signedTxFile.Name()) - require.False(t, success) + success, stdOut, _ := f.TxBroadcast(signedTxFile.Name()) + require.Contains(t, stdOut, "signature verification failed") + require.True(t, success) + + // Cleanup testing directories + f.Cleanup() } func TestGaiaCLIEncode(t *testing.T) { @@ -817,7 +1043,7 @@ func TestGaiaCLIEncode(t *testing.T) { barAddr := f.KeyAddress(keyBar) keyAddr := f.KeyAddress(keyFoo) - sendTokens := sdk.TokensFromTendermintPower(10) + sendTokens := sdk.TokensFromConsensusPower(10) success, stdout, stderr := f.TxSend(keyAddr.String(), barAddr, sdk.NewCoin(denom, sendTokens), "--generate-only", "--memo", "deadbeef") require.True(t, success) require.Empty(t, stderr) @@ -901,6 +1127,9 @@ func TestGaiaCLIMultisignSortSignatures(t *testing.T) { // Broadcast the transaction success, _, _ = f.TxBroadcast(signedTxFile.Name()) require.True(t, success) + + // Cleanup testing directories + f.Cleanup() } func TestGaiaCLIMultisign(t *testing.T) { @@ -964,6 +1193,9 @@ func TestGaiaCLIMultisign(t *testing.T) { // Broadcast the transaction success, _, _ = f.TxBroadcast(signedTxFile.Name()) require.True(t, success) + + // Cleanup testing directories + f.Cleanup() } func TestGaiaCLIConfig(t *testing.T) { @@ -980,7 +1212,7 @@ func TestGaiaCLIConfig(t *testing.T) { f.CLIConfig("trace", "false") f.CLIConfig("indent", "true") - config, err := ioutil.ReadFile(path.Join(f.GCLIHome, "config", "config.toml")) + config, err := ioutil.ReadFile(path.Join(f.GaiacliHome, "config", "config.toml")) require.NoError(t, err) expectedConfig := fmt.Sprintf(`broadcast-mode = "block" chain-id = "%s" @@ -997,6 +1229,7 @@ trust-node = true func TestGaiadCollectGentxs(t *testing.T) { t.Parallel() + var customMaxBytes, customMaxGas int64 = 99999999, 1234567 f := NewFixtures(t) // Initialise temporary directories @@ -1016,6 +1249,15 @@ func TestGaiadCollectGentxs(t *testing.T) { // Run init f.GDInit(keyFoo) + // Customise genesis.json + + genFile := f.GenesisFile() + genDoc, err := tmtypes.GenesisDocFromFile(genFile) + require.NoError(t, err) + genDoc.ConsensusParams.Block.MaxBytes = customMaxBytes + genDoc.ConsensusParams.Block.MaxGas = customMaxGas + genDoc.SaveAs(genFile) + // Add account to genesis.json f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) @@ -1025,6 +1267,11 @@ func TestGaiadCollectGentxs(t *testing.T) { // Collect gentxs from a custom directory f.CollectGenTxs(fmt.Sprintf("--gentx-dir=%s", gentxDir)) + genDoc, err = tmtypes.GenesisDocFromFile(genFile) + require.NoError(t, err) + require.Equal(t, genDoc.ConsensusParams.Block.MaxBytes, customMaxBytes) + require.Equal(t, genDoc.ConsensusParams.Block.MaxGas, customMaxGas) + f.Cleanup(gentxDir) } @@ -1058,10 +1305,17 @@ func TestGaiadAddGenesisAccount(t *testing.T) { f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) f.AddGenesisAccount(f.KeyAddress(keyBar), bazCoins) genesisState := f.GenesisState() - require.Equal(t, genesisState.Accounts[0].Address, f.KeyAddress(keyFoo)) - require.Equal(t, genesisState.Accounts[1].Address, f.KeyAddress(keyBar)) - require.True(t, genesisState.Accounts[0].Coins.IsEqual(startCoins)) - require.True(t, genesisState.Accounts[1].Coins.IsEqual(bazCoins)) + + cdc := app.MakeCodec() + accounts := genaccounts.GetGenesisStateFromAppState(cdc, genesisState) + + require.Equal(t, accounts[0].Address, f.KeyAddress(keyFoo)) + require.Equal(t, accounts[1].Address, f.KeyAddress(keyBar)) + require.True(t, accounts[0].Coins.IsEqual(startCoins)) + require.True(t, accounts[1].Coins.IsEqual(bazCoins)) + + // Cleanup testing directories + f.Cleanup() } func TestSlashingGetParams(t *testing.T) { @@ -1080,6 +1334,9 @@ func TestSlashingGetParams(t *testing.T) { sinfo := f.QuerySigningInfo(f.GDTendermint("show-validator")) require.Equal(t, int64(0), sinfo.StartHeight) require.False(t, sinfo.Tombstoned) + + // Cleanup testing directories + f.Cleanup() } func TestValidateGenesis(t *testing.T) { @@ -1091,4 +1348,7 @@ func TestValidateGenesis(t *testing.T) { defer proc.Stop(false) f.ValidateGenesis() + + // Cleanup testing directories + f.Cleanup() } diff --git a/cli_test/doc.go b/cli_test/doc.go deleted file mode 100644 index 51ef2ad5..00000000 --- a/cli_test/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package clitest runs integration tests which make use of CLI commands. -package clitest diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 6441f444..05470c99 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -3,7 +3,6 @@ package clitest import ( "encoding/json" "fmt" - "go/build" "io/ioutil" "os" "path/filepath" @@ -13,21 +12,23 @@ import ( "github.com/stretchr/testify/require" - cmn "github.com/tendermint/tendermint/libs/common" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/client" clientkeys "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/simapp" "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/distribution" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/kava-labs/kava/app" - appInit "github.com/kava-labs/kava/init" ) const ( @@ -43,16 +44,23 @@ const ( ) var ( - startCoins = sdk.Coins{ - sdk.NewCoin(feeDenom, sdk.TokensFromTendermintPower(1000000)), - sdk.NewCoin(fee2Denom, sdk.TokensFromTendermintPower(1000000)), - sdk.NewCoin(fooDenom, sdk.TokensFromTendermintPower(1000)), - sdk.NewCoin(denom, sdk.TokensFromTendermintPower(150)), - } + totalCoins = sdk.NewCoins( + sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(2000000)), + sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(2000000)), + sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(2000)), + sdk.NewCoin(denom, sdk.TokensFromConsensusPower(300).Add(sdk.NewInt(12))), // add coins from inflation + ) - vestingCoins = sdk.Coins{ - sdk.NewCoin(feeDenom, sdk.TokensFromTendermintPower(500000)), - } + startCoins = sdk.NewCoins( + sdk.NewCoin(fee2Denom, sdk.TokensFromConsensusPower(1000000)), + sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(1000000)), + sdk.NewCoin(fooDenom, sdk.TokensFromConsensusPower(1000)), + sdk.NewCoin(denom, sdk.TokensFromConsensusPower(150)), + ) + + vestingCoins = sdk.NewCoins( + sdk.NewCoin(feeDenom, sdk.TokensFromConsensusPower(500000)), + ) ) func init() { @@ -67,15 +75,17 @@ func init() { // Fixtures is used to setup the testing environment type Fixtures struct { - ChainID string - RPCAddr string - Port string - AppDaemonBinary string - AppCliBinary string - GDHome string - GCLIHome string - P2PAddr string - T *testing.T + BuildDir string + RootDir string + GaiadBinary string + GaiacliBinary string + ChainID string + RPCAddr string + Port string + GaiadHome string + GaiacliHome string + P2PAddr string + T *testing.T } // NewFixtures creates a new instance of Fixtures with many vars set @@ -83,42 +93,44 @@ func NewFixtures(t *testing.T) *Fixtures { tmpDir, err := ioutil.TempDir("", "kava_integration_"+t.Name()+"_") require.NoError(t, err) - // set location of the app binaries - buildDir := os.Getenv("BUILDDIR") - if buildDir == "" { - buildDir = filepath.Join(build.Default.GOPATH, "bin") - } - servAddr, port, err := server.FreeTCPAddr() require.NoError(t, err) p2pAddr, _, err := server.FreeTCPAddr() require.NoError(t, err) + buildDir := os.Getenv("BUILDDIR") + if buildDir == "" { + buildDir, err = filepath.Abs("../build/") + require.NoError(t, err) + } + return &Fixtures{ - T: t, - AppDaemonBinary: filepath.Join(buildDir, "kvd"), - AppCliBinary: filepath.Join(buildDir, "kvcli"), - GDHome: filepath.Join(tmpDir, ".kvd"), - GCLIHome: filepath.Join(tmpDir, ".kvcli"), - RPCAddr: servAddr, - P2PAddr: p2pAddr, - Port: port, + T: t, + BuildDir: buildDir, + RootDir: tmpDir, + GaiadBinary: filepath.Join(buildDir, "kvd"), + GaiacliBinary: filepath.Join(buildDir, "kvcli"), + GaiadHome: filepath.Join(tmpDir, ".kvd"), + GaiacliHome: filepath.Join(tmpDir, ".kvcli"), + RPCAddr: servAddr, + P2PAddr: p2pAddr, + Port: port, } } // GenesisFile returns the path of the genesis file func (f Fixtures) GenesisFile() string { - return filepath.Join(f.GDHome, "config", "genesis.json") + return filepath.Join(f.GaiadHome, "config", "genesis.json") } // GenesisFile returns the application's genesis state -func (f Fixtures) GenesisState() app.GenesisState { +func (f Fixtures) GenesisState() simapp.GenesisState { cdc := codec.New() - genDoc, err := appInit.LoadGenesisDoc(cdc, f.GenesisFile()) + genDoc, err := tmtypes.GenesisDocFromFile(f.GenesisFile()) require.NoError(f.T, err) - var appState app.GenesisState + var appState simapp.GenesisState require.NoError(f.T, cdc.UnmarshalJSON(genDoc.AppState, &appState)) return appState } @@ -151,6 +163,7 @@ func InitFixtures(t *testing.T) (f *Fixtures) { f.CLIConfig("chain-id", f.ChainID) f.CLIConfig("broadcast-mode", "block") + f.CLIConfig("trust-node", "true") // start an account with tokens f.AddGenesisAccount(f.KeyAddress(keyFoo), startCoins) @@ -169,16 +182,15 @@ func InitFixtures(t *testing.T) (f *Fixtures) { // Cleanup is meant to be run at the end of a test to clean up an remaining test state func (f *Fixtures) Cleanup(dirs ...string) { - clean := append(dirs, f.GDHome, f.GCLIHome) + clean := append(dirs, f.RootDir) for _, d := range clean { - err := os.RemoveAll(d) - require.NoError(f.T, err) + require.NoError(f.T, os.RemoveAll(d)) } } // Flags returns the flags necessary for making most CLI calls func (f *Fixtures) Flags() string { - return fmt.Sprintf("--home=%s --node=%s", f.GCLIHome, f.RPCAddr) + return fmt.Sprintf("--home=%s --node=%s", f.GaiacliHome, f.RPCAddr) } //___________________________________________________________________________________ @@ -186,17 +198,17 @@ func (f *Fixtures) Flags() string { // UnsafeResetAll is gaiad unsafe-reset-all func (f *Fixtures) UnsafeResetAll(flags ...string) { - cmd := fmt.Sprintf("%s --home=%s unsafe-reset-all", f.AppDaemonBinary, f.GDHome) + cmd := fmt.Sprintf("%s --home=%s unsafe-reset-all", f.GaiadBinary, f.GaiadHome) executeWrite(f.T, addFlags(cmd, flags)) - err := os.RemoveAll(filepath.Join(f.GDHome, "config", "gentx")) + err := os.RemoveAll(filepath.Join(f.GaiadHome, "config", "gentx")) require.NoError(f.T, err) } // GDInit is gaiad init // NOTE: GDInit sets the ChainID for the Fixtures instance func (f *Fixtures) GDInit(moniker string, flags ...string) { - cmd := fmt.Sprintf("%s init -o --home=%s %s", f.AppDaemonBinary, f.GDHome, moniker) - _, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s init -o --home=%s %s", f.GaiadBinary, f.GaiadHome, moniker) + _, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), client.DefaultKeyPass) var chainID string var initRes map[string]json.RawMessage @@ -212,25 +224,25 @@ func (f *Fixtures) GDInit(moniker string, flags ...string) { // AddGenesisAccount is gaiad add-genesis-account func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, flags ...string) { - cmd := fmt.Sprintf("%s add-genesis-account %s %s --home=%s", f.AppDaemonBinary, address, coins, f.GDHome) + cmd := fmt.Sprintf("%s add-genesis-account %s %s --home=%s", f.GaiadBinary, address, coins, f.GaiadHome) executeWriteCheckErr(f.T, addFlags(cmd, flags)) } // GenTx is gaiad gentx func (f *Fixtures) GenTx(name string, flags ...string) { - cmd := fmt.Sprintf("%s gentx --name=%s --home=%s --home-client=%s", f.AppDaemonBinary, name, f.GDHome, f.GCLIHome) - executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s gentx --name=%s --home=%s --home-client=%s", f.GaiadBinary, name, f.GaiadHome, f.GaiacliHome) + executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // CollectGenTxs is gaiad collect-gentxs func (f *Fixtures) CollectGenTxs(flags ...string) { - cmd := fmt.Sprintf("%s collect-gentxs --home=%s", f.AppDaemonBinary, f.GDHome) - executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s collect-gentxs --home=%s", f.GaiadBinary, f.GaiadHome) + executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // GDStart runs gaiad start with the appropriate flags and returns a process func (f *Fixtures) GDStart(flags ...string) *tests.Process { - cmd := fmt.Sprintf("%s start --home=%s --rpc.laddr=%v --p2p.laddr=%v", f.AppDaemonBinary, f.GDHome, f.RPCAddr, f.P2PAddr) + cmd := fmt.Sprintf("%s start --home=%s --rpc.laddr=%v --p2p.laddr=%v", f.GaiadBinary, f.GaiadHome, f.RPCAddr, f.P2PAddr) proc := tests.GoExecuteTWithStdout(f.T, addFlags(cmd, flags)) tests.WaitForTMStart(f.Port) tests.WaitForNextNBlocksTM(1, f.Port) @@ -239,7 +251,7 @@ func (f *Fixtures) GDStart(flags ...string) *tests.Process { // GDTendermint returns the results of gaiad tendermint [query] func (f *Fixtures) GDTendermint(query string) string { - cmd := fmt.Sprintf("%s tendermint %s --home=%s", f.AppDaemonBinary, query, f.GDHome) + cmd := fmt.Sprintf("%s tendermint %s --home=%s", f.GaiadBinary, query, f.GaiadHome) success, stdout, stderr := executeWriteRetStdStreams(f.T, cmd) require.Empty(f.T, stderr) require.True(f.T, success) @@ -248,7 +260,7 @@ func (f *Fixtures) GDTendermint(query string) string { // ValidateGenesis runs gaiad validate-genesis func (f *Fixtures) ValidateGenesis() { - cmd := fmt.Sprintf("%s validate-genesis --home=%s", f.AppDaemonBinary, f.GDHome) + cmd := fmt.Sprintf("%s validate-genesis --home=%s", f.GaiadBinary, f.GaiadHome) executeWriteCheckErr(f.T, cmd) } @@ -257,31 +269,31 @@ func (f *Fixtures) ValidateGenesis() { // KeysDelete is gaiacli keys delete func (f *Fixtures) KeysDelete(name string, flags ...string) { - cmd := fmt.Sprintf("%s keys delete --home=%s %s", f.AppCliBinary, f.GCLIHome, name) + cmd := fmt.Sprintf("%s keys delete --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) executeWrite(f.T, addFlags(cmd, append(append(flags, "-y"), "-f"))) } // KeysAdd is gaiacli keys add func (f *Fixtures) KeysAdd(name string, flags ...string) { - cmd := fmt.Sprintf("%s keys add --home=%s %s", f.AppCliBinary, f.GCLIHome, name) - executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s keys add --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) + executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // KeysAddRecover prepares gaiacli keys add --recover func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (exitSuccess bool, stdout, stderr string) { - cmd := fmt.Sprintf("%s keys add --home=%s --recover %s", f.AppCliBinary, f.GCLIHome, name) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic) + cmd := fmt.Sprintf("%s keys add --home=%s --recover %s", f.GaiacliBinary, f.GaiacliHome, name) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass, mnemonic) } // KeysAddRecoverHDPath prepares gaiacli keys add --recover --account --index func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) { - cmd := fmt.Sprintf("%s keys add --home=%s --recover %s --account %d --index %d", f.AppCliBinary, f.GCLIHome, name, account, index) - executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic) + cmd := fmt.Sprintf("%s keys add --home=%s --recover %s --account %d --index %d", f.GaiacliBinary, f.GaiacliHome, name, account, index) + executeWriteCheckErr(f.T, addFlags(cmd, flags), client.DefaultKeyPass, mnemonic) } // KeysShow is gaiacli keys show func (f *Fixtures) KeysShow(name string, flags ...string) keys.KeyOutput { - cmd := fmt.Sprintf("%s keys show --home=%s %s", f.AppCliBinary, f.GCLIHome, name) + cmd := fmt.Sprintf("%s keys show --home=%s %s", f.GaiacliBinary, f.GaiacliHome, name) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var ko keys.KeyOutput err := clientkeys.UnmarshalJSON([]byte(out), &ko) @@ -302,7 +314,7 @@ func (f *Fixtures) KeyAddress(name string) sdk.AccAddress { // CLIConfig is gaiacli config func (f *Fixtures) CLIConfig(key, value string, flags ...string) { - cmd := fmt.Sprintf("%s config --home=%s %s %s", f.AppCliBinary, f.GCLIHome, key, value) + cmd := fmt.Sprintf("%s config --home=%s %s %s", f.GaiacliBinary, f.GaiacliHome, key, value) executeWriteCheckErr(f.T, addFlags(cmd, flags)) } @@ -311,41 +323,33 @@ func (f *Fixtures) CLIConfig(key, value string, flags ...string) { // TxSend is gaiacli tx send func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx send %s %s %v --from=%s", f.AppCliBinary, to, amount, f.Flags(), from) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) -} - -func (f *Fixtures) txSendWithConfirm( - from string, to sdk.AccAddress, amount sdk.Coin, confirm string, flags ...string, -) (bool, string, string) { - - cmd := fmt.Sprintf("%s tx send %s %s %v --from=%s", f.AppCliBinary, to, amount, f.Flags(), from) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), confirm, app.DefaultKeyPass) + cmd := fmt.Sprintf("%s tx send %s %s %s %v", f.GaiacliBinary, from, to, amount, f.Flags()) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // TxSign is gaiacli tx sign func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.AppCliBinary, f.Flags(), signer, fileName) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.GaiacliBinary, f.Flags(), signer, fileName) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // TxBroadcast is gaiacli tx broadcast func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx broadcast %v %v", f.AppCliBinary, f.Flags(), fileName) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s tx broadcast %v %v", f.GaiacliBinary, f.Flags(), fileName) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // TxEncode is gaiacli tx encode func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx encode %v %v", f.AppCliBinary, f.Flags(), fileName) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s tx encode %v %v", f.GaiacliBinary, f.Flags(), fileName) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // TxMultisign is gaiacli tx multisign func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx multisign %v %s %s %s", f.AppCliBinary, f.Flags(), + cmd := fmt.Sprintf("%s tx multisign %v %s %s %s", f.GaiacliBinary, f.Flags(), fileName, name, strings.Join(signaturesFiles, " "), ) return executeWriteRetStdStreams(f.T, cmd) @@ -356,17 +360,17 @@ func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, // TxStakingCreateValidator is gaiacli tx staking create-validator func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk.Coin, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx staking create-validator %v --from=%s --pubkey=%s", f.AppCliBinary, f.Flags(), from, consPubKey) + cmd := fmt.Sprintf("%s tx staking create-validator %v --from=%s --pubkey=%s", f.GaiacliBinary, f.Flags(), from, consPubKey) cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05") cmd += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10") cmd += fmt.Sprintf(" --min-self-delegation=%v", "1") - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // TxStakingUnbond is gaiacli tx staking unbond func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress, flags ...string) bool { - cmd := fmt.Sprintf("%s tx staking unbond %s %v --from=%s %v", f.AppCliBinary, validator, shares, from, f.Flags()) - return executeWrite(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s tx staking unbond %s %v --from=%s %v", f.GaiacliBinary, validator, shares, from, f.Flags()) + return executeWrite(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } //___________________________________________________________________________________ @@ -374,21 +378,49 @@ func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress // TxGovSubmitProposal is gaiacli tx gov submit-proposal func (f *Fixtures) TxGovSubmitProposal(from, typ, title, description string, deposit sdk.Coin, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx gov submit-proposal %v --from=%s --type=%s", f.AppCliBinary, f.Flags(), from, typ) + cmd := fmt.Sprintf("%s tx gov submit-proposal %v --from=%s --type=%s", f.GaiacliBinary, f.Flags(), from, typ) cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // TxGovDeposit is gaiacli tx gov deposit func (f *Fixtures) TxGovDeposit(proposalID int, from string, amount sdk.Coin, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx gov deposit %d %s --from=%s %v", f.AppCliBinary, proposalID, amount, from, f.Flags()) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s tx gov deposit %d %s --from=%s %v", f.GaiacliBinary, proposalID, amount, from, f.Flags()) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } // TxGovVote is gaiacli tx gov vote func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, flags ...string) (bool, string, string) { - cmd := fmt.Sprintf("%s tx gov vote %d %s --from=%s %v", f.AppCliBinary, proposalID, option, from, f.Flags()) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) + cmd := fmt.Sprintf("%s tx gov vote %d %s --from=%s %v", f.GaiacliBinary, proposalID, option, from, f.Flags()) + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) +} + +// TxGovSubmitParamChangeProposal executes a CLI parameter change proposal +// submission. +func (f *Fixtures) TxGovSubmitParamChangeProposal( + from, proposalPath string, deposit sdk.Coin, flags ...string, +) (bool, string, string) { + + cmd := fmt.Sprintf( + "%s tx gov submit-proposal param-change %s --from=%s %v", + f.GaiacliBinary, proposalPath, from, f.Flags(), + ) + + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) +} + +// TxGovSubmitCommunityPoolSpendProposal executes a CLI community pool spend proposal +// submission. +func (f *Fixtures) TxGovSubmitCommunityPoolSpendProposal( + from, proposalPath string, deposit sdk.Coin, flags ...string, +) (bool, string, string) { + + cmd := fmt.Sprintf( + "%s tx gov submit-proposal community-pool-spend %s --from=%s %v", + f.GaiacliBinary, proposalPath, from, f.Flags(), + ) + + return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } //___________________________________________________________________________________ @@ -396,7 +428,7 @@ func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, // QueryAccount is gaiacli query account func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.BaseAccount { - cmd := fmt.Sprintf("%s query account %s %v", f.AppCliBinary, address, f.Flags()) + cmd := fmt.Sprintf("%s query account %s %v", f.GaiacliBinary, address, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var initRes map[string]json.RawMessage err := json.Unmarshal([]byte(out), &initRes) @@ -414,19 +446,19 @@ func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.Ba // gaiacli query txs // QueryTxs is gaiacli query txs -func (f *Fixtures) QueryTxs(page, limit int, tags ...string) []sdk.TxResponse { - cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.AppCliBinary, page, limit, queryTags(tags), f.Flags()) +func (f *Fixtures) QueryTxs(page, limit int, tags ...string) *sdk.SearchTxsResult { + cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.GaiacliBinary, page, limit, queryTags(tags), f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") - var txs []sdk.TxResponse + var result sdk.SearchTxsResult cdc := app.MakeCodec() - err := cdc.UnmarshalJSON([]byte(out), &txs) + err := cdc.UnmarshalJSON([]byte(out), &result) require.NoError(f.T, err, "out %v\n, err %v", out, err) - return txs + return &result } // QueryTxsInvalid query txs with wrong parameters and compare expected error func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...string) { - cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.AppCliBinary, page, limit, queryTags(tags), f.Flags()) + cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.GaiacliBinary, page, limit, queryTags(tags), f.Flags()) _, err := tests.ExecuteT(f.T, cmd, "") require.EqualError(f.T, expectedErr, err) } @@ -436,7 +468,7 @@ func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...s // QueryStakingValidator is gaiacli query staking validator func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string) staking.Validator { - cmd := fmt.Sprintf("%s query staking validator %s %v", f.AppCliBinary, valAddr, f.Flags()) + cmd := fmt.Sprintf("%s query staking validator %s %v", f.GaiacliBinary, valAddr, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var validator staking.Validator cdc := app.MakeCodec() @@ -447,7 +479,7 @@ func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string // QueryStakingUnbondingDelegationsFrom is gaiacli query staking unbonding-delegations-from func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation { - cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.AppCliBinary, valAddr, f.Flags()) + cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.GaiacliBinary, valAddr, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var ubds []staking.UnbondingDelegation cdc := app.MakeCodec() @@ -458,7 +490,7 @@ func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, // QueryStakingDelegationsTo is gaiacli query staking delegations-to func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...string) []staking.Delegation { - cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.AppCliBinary, valAddr, f.Flags()) + cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.GaiacliBinary, valAddr, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var delegations []staking.Delegation cdc := app.MakeCodec() @@ -469,7 +501,7 @@ func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...st // QueryStakingPool is gaiacli query staking pool func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { - cmd := fmt.Sprintf("%s query staking pool %v", f.AppCliBinary, f.Flags()) + cmd := fmt.Sprintf("%s query staking pool %v", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var pool staking.Pool cdc := app.MakeCodec() @@ -480,7 +512,7 @@ func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { // QueryStakingParameters is gaiacli query staking parameters func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { - cmd := fmt.Sprintf("%s query staking params %v", f.AppCliBinary, f.Flags()) + cmd := fmt.Sprintf("%s query staking params %v", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var params staking.Params cdc := app.MakeCodec() @@ -494,7 +526,7 @@ func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { // QueryGovParamDeposit is gaiacli query gov param deposit func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { - cmd := fmt.Sprintf("%s query gov param deposit %s", f.AppCliBinary, f.Flags()) + cmd := fmt.Sprintf("%s query gov param deposit %s", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") var depositParam gov.DepositParams cdc := app.MakeCodec() @@ -505,7 +537,7 @@ func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { // QueryGovParamVoting is gaiacli query gov param voting func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { - cmd := fmt.Sprintf("%s query gov param voting %s", f.AppCliBinary, f.Flags()) + cmd := fmt.Sprintf("%s query gov param voting %s", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") var votingParam gov.VotingParams cdc := app.MakeCodec() @@ -516,7 +548,7 @@ func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { // QueryGovParamTallying is gaiacli query gov param tallying func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { - cmd := fmt.Sprintf("%s query gov param tallying %s", f.AppCliBinary, f.Flags()) + cmd := fmt.Sprintf("%s query gov param tallying %s", f.GaiacliBinary, f.Flags()) out, _ := tests.ExecuteT(f.T, cmd, "") var tallyingParam gov.TallyParams cdc := app.MakeCodec() @@ -527,9 +559,9 @@ func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { // QueryGovProposals is gaiacli query gov proposals func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { - cmd := fmt.Sprintf("%s query gov proposals %v", f.AppCliBinary, f.Flags()) + cmd := fmt.Sprintf("%s query gov proposals %v", f.GaiacliBinary, f.Flags()) stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "") - if strings.Contains(stderr, "No matching proposals found") { + if strings.Contains(stderr, "no matching proposals found") { return gov.Proposals{} } require.Empty(f.T, stderr) @@ -542,7 +574,7 @@ func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { // QueryGovProposal is gaiacli query gov proposal func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposal { - cmd := fmt.Sprintf("%s query gov proposal %d %v", f.AppCliBinary, proposalID, f.Flags()) + cmd := fmt.Sprintf("%s query gov proposal %d %v", f.GaiacliBinary, proposalID, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var proposal gov.Proposal cdc := app.MakeCodec() @@ -553,7 +585,7 @@ func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposa // QueryGovVote is gaiacli query gov vote func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...string) gov.Vote { - cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.AppCliBinary, proposalID, voter, f.Flags()) + cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.GaiacliBinary, proposalID, voter, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var vote gov.Vote cdc := app.MakeCodec() @@ -564,7 +596,7 @@ func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...s // QueryGovVotes is gaiacli query gov votes func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { - cmd := fmt.Sprintf("%s query gov votes %d %v", f.AppCliBinary, proposalID, f.Flags()) + cmd := fmt.Sprintf("%s query gov votes %d %v", f.GaiacliBinary, proposalID, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var votes []gov.Vote cdc := app.MakeCodec() @@ -575,7 +607,7 @@ func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { // QueryGovDeposit is gaiacli query gov deposit func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, flags ...string) gov.Deposit { - cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.AppCliBinary, proposalID, depositor, f.Flags()) + cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.GaiacliBinary, proposalID, depositor, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var deposit gov.Deposit cdc := app.MakeCodec() @@ -586,7 +618,7 @@ func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, fla // QueryGovDeposits is gaiacli query gov deposits func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposit { - cmd := fmt.Sprintf("%s query gov deposits %d %v", f.AppCliBinary, propsalID, f.Flags()) + cmd := fmt.Sprintf("%s query gov deposits %d %v", f.GaiacliBinary, propsalID, f.Flags()) out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") var deposits []gov.Deposit cdc := app.MakeCodec() @@ -600,7 +632,7 @@ func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposi // QuerySigningInfo returns the signing info for a validator func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo { - cmd := fmt.Sprintf("%s query slashing signing-info %s %s", f.AppCliBinary, val, f.Flags()) + cmd := fmt.Sprintf("%s query slashing signing-info %s %s", f.GaiacliBinary, val, f.Flags()) res, errStr := tests.ExecuteT(f.T, cmd, "") require.Empty(f.T, errStr) cdc := app.MakeCodec() @@ -612,7 +644,7 @@ func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo { // QuerySlashingParams is gaiacli query slashing params func (f *Fixtures) QuerySlashingParams() slashing.Params { - cmd := fmt.Sprintf("%s query slashing params %s", f.AppCliBinary, f.Flags()) + cmd := fmt.Sprintf("%s query slashing params %s", f.GaiacliBinary, f.Flags()) res, errStr := tests.ExecuteT(f.T, cmd, "") require.Empty(f.T, errStr) cdc := app.MakeCodec() @@ -622,6 +654,47 @@ func (f *Fixtures) QuerySlashingParams() slashing.Params { return params } +//___________________________________________________________________________________ +// query distribution + +// QueryRewards returns the rewards of a delegator +func (f *Fixtures) QueryRewards(delAddr sdk.AccAddress, flags ...string) distribution.QueryDelegatorTotalRewardsResponse { + cmd := fmt.Sprintf("%s query distribution rewards %s %s", f.GaiacliBinary, delAddr, f.Flags()) + res, errStr := tests.ExecuteT(f.T, cmd, "") + require.Empty(f.T, errStr) + cdc := app.MakeCodec() + var rewards distribution.QueryDelegatorTotalRewardsResponse + err := cdc.UnmarshalJSON([]byte(res), &rewards) + require.NoError(f.T, err) + return rewards +} + +//___________________________________________________________________________________ +// query supply + +// QueryTotalSupply returns the total supply of coins +func (f *Fixtures) QueryTotalSupply(flags ...string) (totalSupply sdk.Coins) { + cmd := fmt.Sprintf("%s query supply total %s", f.GaiacliBinary, f.Flags()) + res, errStr := tests.ExecuteT(f.T, cmd, "") + require.Empty(f.T, errStr) + cdc := app.MakeCodec() + err := cdc.UnmarshalJSON([]byte(res), &totalSupply) + require.NoError(f.T, err) + return totalSupply +} + +// QueryTotalSupplyOf returns the total supply of a given coin denom +func (f *Fixtures) QueryTotalSupplyOf(denom string, flags ...string) sdk.Int { + cmd := fmt.Sprintf("%s query supply total %s %s", f.GaiacliBinary, denom, f.Flags()) + res, errStr := tests.ExecuteT(f.T, cmd, "") + require.Empty(f.T, errStr) + cdc := app.MakeCodec() + var supplyOf sdk.Int + err := cdc.UnmarshalJSON([]byte(res), &supplyOf) + require.NoError(f.T, err) + return supplyOf +} + //___________________________________________________________________________________ // executors @@ -651,10 +724,10 @@ func executeWriteRetStdStreams(t *testing.T, cmdStr string, writes ...string) (b // Log output. if len(stdout) > 0 { - t.Log("Stdout:", cmn.Green(string(stdout))) + t.Log("Stdout:", string(stdout)) } if len(stderr) > 0 { - t.Log("Stderr:", cmn.Red(string(stderr))) + t.Log("Stderr:", string(stderr)) } // Wait for process to exit diff --git a/go.mod b/go.mod index 90a28ad0..fc66793d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kava-labs/kava -go 1.12 +go 1.13 require ( github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb diff --git a/go.sum b/go.sum index 5e112af0..6f596edc 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -10,7 +11,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d h1:1aAija9gr0Hyv4KfQcRcwlmFIrhkDmIj2dz5bkg/s/8= github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d/go.mod h1:icNx/6QdFblhsEjZehARqbNumymUT/ydwlLojFdv7Sk= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -18,9 +18,13 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d h1:xG8Pj6Y6J760xwETNmMzmlt38QSwz0BLp1cZ09g27uw= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= +github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= +github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a h1:RQMUrEILyYJEoAT34XS/kLu40vC0+po/UfxrBBA4qZE= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= @@ -36,14 +40,16 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb h1:VKEfR1unkvgquOUgGcuXq6gPXDd7L125MSuCSEmthNM= github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190911151311-849e2fb6385b h1:Dta0d6D/aGw+S3pSeBZ/wajE3AfaFjfJJ5lqDH1g/G8= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190911151311-849e2fb6385b/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= -github.com/cosmos/cosmos-sdk v0.36.0-rc1 h1:hgSXNeVwNYxD0+O9DxRrxJcir9Z7Q5zreLV6G7GrjYA= -github.com/cosmos/cosmos-sdk v0.36.0-rc1/go.mod h1:UV765S3m9sxCg8rYaBr4XgeHZl2UP6y++Coz9mLlYFc= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190911185636-5bcab79e8aef/go.mod h1:WFgmzqlpCWWhon5UF59Nu3olrxCUB3+S/GzTeUyfs1U= +github.com/cosmos/cosmos-sdk v0.36.0 h1:nDHhZDeucmv/PoThz89Q8cj9S8OH2EUutgertz2pZ90= +github.com/cosmos/cosmos-sdk v0.36.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= github.com/cosmos/cosmos-sdk v0.37.0 h1:S2I3NDGN2wqfGlY5KqkAHTpfezjhgeqDxrCxhlhd528= -github.com/cosmos/cosmos-sdk v0.37.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= +github.com/cosmos/gaia v1.0.0 h1:Wu4nH0t5hpKiU5WeIPDnun7kHcO8ijMXvMjF+yb9wS4= +github.com/cosmos/gaia v1.0.0/go.mod h1:hqavT29EEm4CBBe1ONUggGWecpPTcolOlkqv93C6yAQ= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc= github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -53,6 +59,8 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deadcheat/goblet v1.3.1/go.mod h1:IrMNyAwyrVgB30HsND2WgleTUM4wHTS9m40yNY6NJQg= +github.com/deadcheat/gonch v0.0.0-20180528124129-c2ff7a019863/go.mod h1:/5mH3gAuXUxGN3maOBAxBfB8RXvP9tBIX5fx2x1k0V0= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/etcd-io/bbolt v1.3.2/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= @@ -67,14 +75,14 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-kit/kit v0.6.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= @@ -82,31 +90,26 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129 h1:tT8iWCYw4uOem71yYA3htfH+LNopJvcqZQshm56G5L4= github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0 h1:kbxbvI4Un1LUWKxufD+BiE6AEExYYgkQLQmLFqA1LFk= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U= github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -122,11 +125,11 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jmhodges/levigo v0.0.0-20161115193449-c42d9e0ca023/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -135,15 +138,24 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kyoh86/richgo v0.3.3 h1:fW7ygWNMg1INcX3Yoha9v1C5nYlvd/IodJUf0Batz6Q= +github.com/kyoh86/richgo v0.3.3/go.mod h1:S65jllVRxBm59fqIXfCa3cPxQYRT9u9v45EPQVeuoH0= +github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81 h1:C2Yb5TxdHWrtWXdf+j8xWW4QQu8lXuxtj1UOK816dpA= +github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81/go.mod h1:Z5mDqe0fxyxn3W2yTxsBAOQqIrXADQIh02wrTnaRM38= github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-isatty v0.0.6 h1:SrwhHcpV4nWrMGdNcC2kXpMfcBVYGDuTArqyhocJgvA= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-isatty v0.0.0-20170925054904-a5cdd64afdee/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -151,14 +163,24 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE= +github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4= +github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw= +github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= @@ -168,34 +190,39 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190227231451-bbced9601137 h1:3l8oligPtjd4JuM+OZ+U8sjtwFGJs98cdWsqs6QZRWs= github.com/prometheus/procfs v0.0.0-20190227231451-bbced9601137/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rakyll/statik v0.1.4 h1:zCS/YQCxfo/fQjCtGVGIyWGFnRbQ18Y55mhS3XPE+Oo= -github.com/rakyll/statik v0.1.4/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rakyll/statik v0.1.5/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81 h1:zQTtDd7fQiF9e80lbl+ShnD9/5NSq5r1EhcS8955ECg= +github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= @@ -207,6 +234,8 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.1 h1:qgMbHoJbPbw579P+1zVY+6n4nIFuIchaIjzZ/I/Yq8M= github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.1/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -218,36 +247,28 @@ github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0 github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/goleveldb v0.0.0-20181105012736-f9080354173f/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= -github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae h1:AOXNM7c2Vvo45SjAgeWF8Wy+NS7/NCqzRNpUc+HPAec= github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk= github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk= github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/iavl v0.12.3-0.20190712145259-c834d3192b52 h1:l3qTzz8KkhZZSeLTJGqh0+iONjGM/tS5vvbunXjAmnA= -github.com/tendermint/iavl v0.12.3-0.20190712145259-c834d3192b52/go.mod h1:A9IoWRVTibyXXlfZztHy52RloI85QOrIcsE9dyQh+DY= github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= -github.com/tendermint/tendermint v0.31.7/go.mod h1:ymcPyWblXCplCPQjbOYbrF1fWnpslATMVqiGgWbZrlc= -github.com/tendermint/tendermint v0.32.1 h1:J8ddXMbCmG6GZjdCl/N1wgdXDU9uO91J2Y5CA9xYfGo= github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= github.com/tendermint/tendermint v0.32.2/go.mod h1:NwMyx58S8VJ7tEpFKqRVlVWKO9N9zjTHu+Dx96VsnOE= github.com/tendermint/tendermint v0.32.3 h1:GEnWpGQ795h5oTFNbfBLsY0LW/CW2j6p6HtiYNfxsgg= @@ -257,6 +278,9 @@ github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8 h1:js9Z9dWq50Ttu4D1YRqgS1gkSgRfpKp+rMza4io7qNw= +github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8/go.mod h1:BD0gjsZrCwtoR+yWDB9v2hQ8STlq9tT84qKfa+3txOc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= @@ -268,36 +292,41 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181126093934-9eb0be3963ea/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180404174746-b3c676e531a6/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20170927054621-314a259e304f/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -305,35 +334,41 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df h1:k3DT34vxk64+4bD5x+fRy6U0SXxZehzUHRSYUJcKfII= +google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= From b71ce1802b9272eca21eae4c4a28fddf12a9047a Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Thu, 12 Sep 2019 14:27:13 -0400 Subject: [PATCH 05/14] fix simulations --- Makefile | 10 ++++++++-- app/sim_test.go | 10 +++++----- cli_test/README.md | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 03837ab2..f2b21fdd 100644 --- a/Makefile +++ b/Makefile @@ -83,10 +83,16 @@ install: go.sum ### Tools & dependencies go.sum: go.mod - @echo "--> Ensure dependencies have not been modified" + @echo "--> Ensuring dependencies have not been modified" @go mod verify clean: rm -rf build/ -.PHONY: all build-linux install clean build \ No newline at end of file +######################################## +### Testing + +sim: + @go test -mod=readonly ./app -run TestFullAppSimulation -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h + +.PHONY: all build-linux install clean build sim \ No newline at end of file diff --git a/app/sim_test.go b/app/sim_test.go index 803dbed0..edcb94b8 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -343,7 +343,7 @@ func TestFullAppSimulation(t *testing.T) { }() app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", app.Name()) + require.Equal(t, "kava", app.Name()) // Run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( @@ -397,7 +397,7 @@ func TestAppImportExport(t *testing.T) { }() app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "SimApp", app.Name()) + require.Equal(t, "kava", app.Name()) // Run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( @@ -441,7 +441,7 @@ func TestAppImportExport(t *testing.T) { }() newApp := NewApp(log.NewNopLogger(), newDB, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "SimApp", newApp.Name()) + require.Equal(t, "kava", newApp.Name()) var genesisState simapp.GenesisState err = app.cdc.UnmarshalJSON(appState, &genesisState) @@ -513,7 +513,7 @@ func TestAppSimulationAfterImport(t *testing.T) { }() app := NewApp(logger, db, nil, true, simapp.FlagPeriodValue, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", app.Name()) + require.Equal(t, "kava", app.Name()) // Run randomized simulation // Run randomized simulation @@ -567,7 +567,7 @@ func TestAppSimulationAfterImport(t *testing.T) { }() newApp := NewApp(log.NewNopLogger(), newDB, nil, true, 0, fauxMerkleModeOpt) - require.Equal(t, "GaiaApp", newApp.Name()) + require.Equal(t, "kava", newApp.Name()) newApp.InitChain(abci.RequestInitChain{ AppStateBytes: appState, diff --git a/cli_test/README.md b/cli_test/README.md index 682b9b12..a9152712 100644 --- a/cli_test/README.md +++ b/cli_test/README.md @@ -11,4 +11,4 @@ go test -v -p 4 ./cli_test -tags cli_test > NOTE: While the full suite runs in parallel, some of the tests can take up to a minute to complete -> NOTE: The tests will use the `kvd` or `kvcli` binaries in the build dir. Or in `$BUILDDIR` if that env var is set. \ No newline at end of file +> NOTE: The tests will use the `kvd` or `kvcli` binaries in the build dir. Or in `$BUILDDIR` if that env var is set. From 3871e5a84b6bd2c0c436d7123d15aed97ab4eb7f Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Fri, 13 Sep 2019 16:52:10 -0400 Subject: [PATCH 06/14] update to latest master --- app/app.go | 6 +- app/genesis.go | 22 ++++++ cli_test/cli_test.go | 15 +++-- cmd/kvd/add_account.go | 150 +++++++++++++++++++++++++++++++++++++++++ cmd/kvd/main.go | 8 +-- go.mod | 2 +- go.sum | 3 + 7 files changed, 189 insertions(+), 17 deletions(-) create mode 100644 cmd/kvd/add_account.go diff --git a/app/app.go b/app/app.go index 6154cb73..b1d298a7 100644 --- a/app/app.go +++ b/app/app.go @@ -18,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" - "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/mint" @@ -41,7 +40,6 @@ var ( // ModuleBasics manages simple versions of full app modules. It's used for things such as codec registration and genesis file verification. ModuleBasics = module.NewBasicManager( - genaccounts.AppModuleBasic{}, genutil.AppModuleBasic{}, auth.AppModuleBasic{}, bank.AppModuleBasic{}, @@ -206,7 +204,6 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, // create the module manager (Note: Any module instantiated in the module manager that is later modified // must be passed by reference here.) app.mm = module.NewManager( - genaccounts.NewAppModule(app.accountKeeper), genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx), auth.NewAppModule(app.accountKeeper), bank.NewAppModule(app.bankKeeper, app.accountKeeper), @@ -228,7 +225,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, // genutils must occur after staking so that pools are properly // initialized with tokens from genesis accounts. - app.mm.SetOrderInitGenesis(genaccounts.ModuleName, distr.ModuleName, + app.mm.SetOrderInitGenesis(auth.ModuleName, distr.ModuleName, staking.ModuleName, auth.ModuleName, bank.ModuleName, slashing.ModuleName, gov.ModuleName, mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName) @@ -240,7 +237,6 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, // NOTE: This is not required for apps that don't use the simulator for fuzz testing // transactions. app.sm = module.NewSimulationManager( - genaccounts.NewAppModule(app.accountKeeper), auth.NewAppModule(app.accountKeeper), bank.NewAppModule(app.bankKeeper, app.accountKeeper), supply.NewAppModule(app.supplyKeeper, app.accountKeeper), diff --git a/app/genesis.go b/app/genesis.go index d6af7e32..5602b64f 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -2,6 +2,9 @@ package app import ( "encoding/json" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/exported" ) // GenesisState represents the genesis state of the blockchain. It is a map from module names to module genesis states. @@ -11,3 +14,22 @@ type GenesisState map[string]json.RawMessage func NewDefaultGenesisState() GenesisState { return ModuleBasics.DefaultGenesis() } + +// TODO remove iterator once merged into sdk master +type GenesisAccountIterator struct{} +// IterateGenesisAccounts iterates over all the genesis accounts found in +// appGenesis and invokes a callback on each genesis account. If any call +// returns true, iteration stops. +func (GenesisAccountIterator) IterateGenesisAccounts( + cdc *codec.Codec, appGenesis map[string]json.RawMessage, cb func(exported.Account) (stop bool), +) { + + var authGenState auth.GenesisState + cdc.MustUnmarshalJSON(appGenesis[auth.ModuleName], &authGenState) + + for _, genAcc := range authGenState.Accounts { + if cb(genAcc) { + break + } + } +} \ No newline at end of file diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index a242a6ef..9e7df17d 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -23,7 +23,6 @@ import ( "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/mint" @@ -1307,12 +1306,16 @@ func TestGaiadAddGenesisAccount(t *testing.T) { genesisState := f.GenesisState() cdc := app.MakeCodec() - accounts := genaccounts.GetGenesisStateFromAppState(cdc, genesisState) - require.Equal(t, accounts[0].Address, f.KeyAddress(keyFoo)) - require.Equal(t, accounts[1].Address, f.KeyAddress(keyBar)) - require.True(t, accounts[0].Coins.IsEqual(startCoins)) - require.True(t, accounts[1].Coins.IsEqual(bazCoins)) + // TODO maybe replace once sdk updated + var authGenState auth.GenesisState + cdc.MustUnmarshalJSON(genesisState[auth.ModuleName], &authGenState) + accounts := authGenState.Accounts + + require.Equal(t, accounts[0].GetAddress(), f.KeyAddress(keyFoo)) + require.Equal(t, accounts[1].GetAddress(), f.KeyAddress(keyBar)) + require.True(t, accounts[0].GetCoins().IsEqual(startCoins)) + require.True(t, accounts[1].GetCoins().IsEqual(bazCoins)) // Cleanup testing directories f.Cleanup() diff --git a/cmd/kvd/add_account.go b/cmd/kvd/add_account.go new file mode 100644 index 00000000..a9fc9a2d --- /dev/null +++ b/cmd/kvd/add_account.go @@ -0,0 +1,150 @@ +package main + +import ( + "errors" + "fmt" + + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/tendermint/tendermint/libs/cli" + + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" + authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" + "github.com/cosmos/cosmos-sdk/x/genutil" +) + +const ( + flagClientHome = "home-client" + flagVestingStart = "vesting-start-time" + flagVestingEnd = "vesting-end-time" + flagVestingAmt = "vesting-amount" +) + +// AddGenesisAccountCmd returns an add-genesis-account cobra Command. +func AddGenesisAccountCmd( + ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string, +) *cobra.Command { + + cmd := &cobra.Command{ + Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]", + Short: "Add a genesis account to genesis.json", + Long: `Add a genesis account to genesis.json. The provided account must specify + the account address or key name and a list of initial coins. If a key name is given, + the address will be looked up in the local Keybase. The list of initial tokens must + contain valid denominations. Accounts may optionally be supplied with vesting parameters. + `, + Args: cobra.ExactArgs(2), + RunE: func(_ *cobra.Command, args []string) error { + config := ctx.Config + config.SetRoot(viper.GetString(cli.HomeFlag)) + + addr, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + // attempt to lookup address from Keybase if no address was provided + kb, err := keys.NewKeyBaseFromDir(viper.GetString(flagClientHome)) + if err != nil { + return err + } + + info, err := kb.Get(args[0]) + if err != nil { + return fmt.Errorf("failed to get address from Keybase: %w", err) + } + + addr = info.GetAddress() + } + + coins, err := sdk.ParseCoins(args[1]) + if err != nil { + return fmt.Errorf("failed to parse coins: %w", err) + } + + vestingStart := viper.GetInt64(flagVestingStart) + vestingEnd := viper.GetInt64(flagVestingEnd) + vestingAmt, err := sdk.ParseCoins(viper.GetString(flagVestingAmt)) + if err != nil { + return fmt.Errorf("failed to parse vesting amount: %w", err) + } + + // create concrete account type based on input parameters + var genAccount authexported.GenesisAccount + + baseAccount := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0) + if !vestingAmt.IsZero() { + baseVestingAccount := auth.NewBaseVestingAccount( + baseAccount, vestingAmt.Sort(), sdk.Coins{}, sdk.Coins{}, vestingEnd, + ) + + switch { + case vestingStart != 0 && vestingEnd != 0: + genAccount = auth.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart) + + case vestingEnd != 0: + genAccount = auth.NewDelayedVestingAccountRaw(baseVestingAccount) + + default: + return errors.New("invalid vesting parameters; must supply start and end time or end time") + } + } else { + genAccount = baseAccount + } + + if err := genAccount.Validate(); err != nil { + return fmt.Errorf("failed to validate new genesis account: %w", err) + } + + genFile := config.GenesisFile() + appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile) + if err != nil { + return fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + // authGenState := auth.GetGenesisStateFromAppState(cdc, appState) + // TODO replace 2 following lines with above once sdk updated + var authGenState auth.GenesisState + cdc.MustUnmarshalJSON(appState[auth.ModuleName], &authGenState) + + // if authGenState.Accounts.Contains(addr) { + // TODO replace loop below with above once sdk is updated + for _, acc := range authGenState.Accounts { + if acc.GetAddress().Equals(addr) { + return fmt.Errorf("cannot add account at existing address %s", addr) + } + } + + // Add the new account to the set of genesis accounts and sanitize the + // accounts afterwards. + authGenState.Accounts = append(authGenState.Accounts, genAccount) + // TODO uncomment following line once merged into master + // authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts) + + authGenStateBz, err := cdc.MarshalJSON(authGenState) + if err != nil { + return fmt.Errorf("failed to marshal auth genesis state: %w", err) + } + + appState[auth.ModuleName] = authGenStateBz + + appStateJSON, err := cdc.MarshalJSON(appState) + if err != nil { + return fmt.Errorf("failed to marshal application genesis state: %w", err) + } + + genDoc.AppState = appStateJSON + return genutil.ExportGenesisFile(genDoc, genFile) + }, + } + + cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory") + cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory") + cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") + cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") + cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") + + return cmd +} diff --git a/cmd/kvd/main.go b/cmd/kvd/main.go index cfffa083..0b9324d4 100644 --- a/cmd/kvd/main.go +++ b/cmd/kvd/main.go @@ -18,8 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/genaccounts" - genaccscli "github.com/cosmos/cosmos-sdk/x/genaccounts/client/cli" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cosmos/cosmos-sdk/x/staking" @@ -47,18 +45,18 @@ func main() { } rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) - rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, genaccounts.AppModuleBasic{}, app.DefaultNodeHome)) + rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, app.GenesisAccountIterator{}, app.DefaultNodeHome)) rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) rootCmd.AddCommand(genutilcli.GenTxCmd( ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, - genaccounts.AppModuleBasic{}, + app.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome)) rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) - rootCmd.AddCommand(genaccscli.AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) + rootCmd.AddCommand(AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) rootCmd.AddCommand(client.NewCompletionCmd(rootCmd, true)) server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) diff --git a/go.mod b/go.mod index fc66793d..f30c4997 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/kava-labs/kava go 1.13 require ( - github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb + github.com/cosmos/cosmos-sdk v0.34.4-0.20190912192225-ed6366679c38 github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 diff --git a/go.sum b/go.sum index 6f596edc..3d286f74 100644 --- a/go.sum +++ b/go.sum @@ -41,9 +41,12 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb h1:VKEfR1unkvgquOUgGcuXq6gPXDd7L125MSuCSEmthNM= github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= github.com/cosmos/cosmos-sdk v0.34.4-0.20190911185636-5bcab79e8aef/go.mod h1:WFgmzqlpCWWhon5UF59Nu3olrxCUB3+S/GzTeUyfs1U= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190912192225-ed6366679c38 h1:c9YDbAZ92KeCxGQQ54GsCcrqNbnNLHrVgJoWDI81qxs= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190912192225-ed6366679c38/go.mod h1:WFgmzqlpCWWhon5UF59Nu3olrxCUB3+S/GzTeUyfs1U= github.com/cosmos/cosmos-sdk v0.36.0 h1:nDHhZDeucmv/PoThz89Q8cj9S8OH2EUutgertz2pZ90= github.com/cosmos/cosmos-sdk v0.36.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= github.com/cosmos/cosmos-sdk v0.37.0 h1:S2I3NDGN2wqfGlY5KqkAHTpfezjhgeqDxrCxhlhd528= +github.com/cosmos/cosmos-sdk v0.37.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= github.com/cosmos/gaia v1.0.0 h1:Wu4nH0t5hpKiU5WeIPDnun7kHcO8ijMXvMjF+yb9wS4= github.com/cosmos/gaia v1.0.0/go.mod h1:hqavT29EEm4CBBe1ONUggGWecpPTcolOlkqv93C6yAQ= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI= From adbe817eb4aea7288b3752f7986fc95bfad134b2 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Wed, 25 Sep 2019 12:24:15 -0400 Subject: [PATCH 07/14] add cloud simulation scripts and docs --- simulations/Dockerfile | 38 ++++++++++++++++++++++++++++++ simulations/README.md | 43 ++++++++++++++++++++++++++++++++++ simulations/run-then-upload.sh | 43 ++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 simulations/Dockerfile create mode 100644 simulations/README.md create mode 100755 simulations/run-then-upload.sh diff --git a/simulations/Dockerfile b/simulations/Dockerfile new file mode 100644 index 00000000..ff843e68 --- /dev/null +++ b/simulations/Dockerfile @@ -0,0 +1,38 @@ +FROM golang:alpine AS build-env + +# Set up dependencies +# bash for debugging +# git, make for installation +# libc-dev, gcc, linux-headers, eudev-dev are used for cgo and ledger installation (possibly) +RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq + +# Install aws cli +RUN apk add python py-pip +RUN pip install awscli + +# Set working directory for the build +WORKDIR /root/kava +# default home directory is /root + +COPY go.mod . +COPY go.sum . + +RUN go mod download + +# Add source files +COPY .git .git +COPY app app +COPY cli_test cli_test +COPY cmd cmd +COPY app app +COPY Makefile . + +# Install kvd, kvcli +ENV LEDGER_ENABLED False +RUN make install + +# Copy in simulation script after to decrease image build time +COPY simulations simulations + +# Run kvd by default, omit entrypoint to ease using container with kvcli +CMD ["kvd"] diff --git a/simulations/README.md b/simulations/README.md new file mode 100644 index 00000000..06c25bb8 --- /dev/null +++ b/simulations/README.md @@ -0,0 +1,43 @@ +# How To Run Sims In The Cloud + +Sims run with AWS batch, with results uploaded to S3 + +## AWS Batch + +In AWS batch you define: + +- a "compute environment"--just how many machines you want (and of what kind) +- a "job queue"--just a place to put jobs (pairs them with a compute environment) +- a "job definition"--a template for jobs + +Then to run stuff you create "jobs" and submit them to a job queue. + +The number of machine running auto-scales to match the number of jobs. When there are no jobs there are no machines, so you don't pay for anything. + +Jobs are defined as a docker image (assumed hosted on dockerhub) and a command string. +>e.g. `kava/kava-sim:version1`, `go test ./app` + +This can run sims but doesn't collect the results. This is handled by a custom script. + +## Running sims and uploading to S3 + +The dockerfile in this repo defines the docker image to run sims. It's just a normal app, but with the aws cli included, and the custom script. + +The custom script reads some input args, runs a sim and uploads the stdout and stderr to a S3 bucket. + +AWS Batch allows for "array jobs" which are a way of specifying many duplicates of a job, each with a different index passed in as an env var. + +### Steps + +- create and submit a new array job (based of the job definition) with + - image `kava/kava-sim:` + - command `run-then-upload.sh ` + - array size of how many sims you want to run +- any changes needed to the code or script necessitates a rebuild: + - `docker build -f simulations/Dockerfile -t kava/kava-sim: .` + - `docker push kava/kava-sim:` + +### Tips + +- click on the compute environment name, to get details, then click the link ECS Cluster Name to get details on the actual machines running +- for array jobs, click the job name to get details of the individual jobs diff --git a/simulations/run-then-upload.sh b/simulations/run-then-upload.sh new file mode 100755 index 00000000..d862adf3 --- /dev/null +++ b/simulations/run-then-upload.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# This requires AWS access keys envs to be set (ie AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) +# These need to be generated from the AWS console. + +# For commands passed to the docker container, the working directory is /root/kava (which is the blockchain git repo). + + +# Parse Input Args +# get seed +startingSeed=$1 +# compute the seed from the starting and the job index +# add two nums together, hence the $(()), and use 0 as the default value for array index, hence the ${:-} syntax +seed=$(($startingSeed+${AWS_BATCH_JOB_ARRAY_INDEX:-0})) +echo "seed: " $seed +# get sim parameters +numBlocks=$2 +blockSize=$3 + + +# Run The Sim +# redirect stdout and stderr to a file +go test ./app -run TestFullAppSimulation -Enabled=true -NumBlocks=$numBlocks -BlockSize=$blockSize -Commit=true -Period=5 -Seed=$seed -v -timeout 24h > out.log 2>&1 +# get the exit code to determine how to upload results +simExitStatus=$? +if [ $simExitStatus -eq 0 ];then + echo "simulations passed" + simResult="pass" +else + echo "simulation failed" + simResult="fail" +fi + + +# Upload Sim Results To S3 +# read in the job id, using a default value if not set +jobID=${AWS_BATCH_JOB_ID:-"testJobID:"} +# job id format is "job-id:array-job-index", this removes trailing colon (and array index if present) https://stackoverflow.com/questions/3045493/parse-string-with-bash-and-extract-number +jobID=$(echo $jobID | sed 's/\(.*\):\d*/\1/') + +# create the filename from the array job index (which won't be set if this is a normal job) +fileName=out$AWS_BATCH_JOB_ARRAY_INDEX.log +aws s3 cp out.log s3://simulations-1/$jobID/$simResult/$fileName \ No newline at end of file From d060b4145fe9bb8744df441990b074a2666dd11b Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Wed, 25 Sep 2019 15:00:44 -0400 Subject: [PATCH 08/14] update to latest sdk --- app/app.go | 3 +- go.mod | 4 +- go.sum | 126 ++++++++++++++--------------------------------------- 3 files changed, 36 insertions(+), 97 deletions(-) diff --git a/app/app.go b/app/app.go index b1d298a7..8ddb720a 100644 --- a/app/app.go +++ b/app/app.go @@ -110,7 +110,7 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey, gov.StoreKey, params.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey) + tkeys := sdk.NewTransientStoreKeys(params.TStoreKey) var app = &App{ BaseApp: bApp, @@ -151,7 +151,6 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, stakingKeeper := staking.NewKeeper( app.cdc, keys[staking.StoreKey], - tkeys[staking.TStoreKey], app.supplyKeeper, stakingSubspace, staking.DefaultCodespace) diff --git a/go.mod b/go.mod index f30c4997..68ed9437 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,11 @@ module github.com/kava-labs/kava go 1.13 require ( - github.com/cosmos/cosmos-sdk v0.34.4-0.20190912192225-ed6366679c38 + github.com/cosmos/cosmos-sdk v0.34.4-0.20190925161702-9d0bed8f4f4e github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 github.com/tendermint/go-amino v0.15.0 github.com/tendermint/tendermint v0.32.3 - github.com/tendermint/tm-db v0.1.1 + github.com/tendermint/tm-db v0.2.0 ) diff --git a/go.sum b/go.sum index 3d286f74..bd5b3aea 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,6 @@ -bou.ke/monkey v1.0.1/go.mod h1:FgHuK96Rv2Nlf+0u1OOVDpCMdsWyOFmeeketDHE7LIg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/99designs/keyring v1.1.2 h1:JJauROcU6x6Nh9uZb+8JgXFvyo0GUESLo1ixhpA0Kmw= +github.com/99designs/keyring v1.1.2/go.mod h1:657DQuMrBZRtuL/voxVyiyb6zpMehlm5vLB9Qwrv904= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -18,13 +19,9 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d h1:xG8Pj6Y6J760xwETNmMzmlt38QSwz0BLp1cZ09g27uw= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a h1:RQMUrEILyYJEoAT34XS/kLu40vC0+po/UfxrBBA4qZE= github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= @@ -38,37 +35,34 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb h1:VKEfR1unkvgquOUgGcuXq6gPXDd7L125MSuCSEmthNM= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190910181238-84627faf79eb/go.mod h1:De67lt7tcfjIhSv58L/96UEdMvR3GZhOtvHntfEglDA= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190911185636-5bcab79e8aef/go.mod h1:WFgmzqlpCWWhon5UF59Nu3olrxCUB3+S/GzTeUyfs1U= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190912192225-ed6366679c38 h1:c9YDbAZ92KeCxGQQ54GsCcrqNbnNLHrVgJoWDI81qxs= -github.com/cosmos/cosmos-sdk v0.34.4-0.20190912192225-ed6366679c38/go.mod h1:WFgmzqlpCWWhon5UF59Nu3olrxCUB3+S/GzTeUyfs1U= -github.com/cosmos/cosmos-sdk v0.36.0 h1:nDHhZDeucmv/PoThz89Q8cj9S8OH2EUutgertz2pZ90= -github.com/cosmos/cosmos-sdk v0.36.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= -github.com/cosmos/cosmos-sdk v0.37.0 h1:S2I3NDGN2wqfGlY5KqkAHTpfezjhgeqDxrCxhlhd528= -github.com/cosmos/cosmos-sdk v0.37.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= -github.com/cosmos/gaia v1.0.0 h1:Wu4nH0t5hpKiU5WeIPDnun7kHcO8ijMXvMjF+yb9wS4= -github.com/cosmos/gaia v1.0.0/go.mod h1:hqavT29EEm4CBBe1ONUggGWecpPTcolOlkqv93C6yAQ= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190925161702-9d0bed8f4f4e h1:V8WpJTIAjajE2PE+1wWCG5LUYkWQal+aH6uqPUiZ9Qc= +github.com/cosmos/cosmos-sdk v0.34.4-0.20190925161702-9d0bed8f4f4e/go.mod h1:gwKdI16dOjylNYJkaHbcx0TcEIHyRs1xyc5qROmjCJE= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc= github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= +github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deadcheat/goblet v1.3.1/go.mod h1:IrMNyAwyrVgB30HsND2WgleTUM4wHTS9m40yNY6NJQg= -github.com/deadcheat/gonch v0.0.0-20180528124129-c2ff7a019863/go.mod h1:/5mH3gAuXUxGN3maOBAxBfB8RXvP9tBIX5fx2x1k0V0= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU= +github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/etcd-io/bbolt v1.3.2/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= @@ -78,13 +72,13 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-kit/kit v0.6.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= @@ -93,9 +87,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129 h1:tT8iWCYw4uOem71yYA3htfH+LNopJvcqZQshm56G5L4= github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -105,11 +98,9 @@ github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -119,6 +110,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk= github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= @@ -132,8 +125,9 @@ github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -146,44 +140,25 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kyoh86/richgo v0.3.3 h1:fW7ygWNMg1INcX3Yoha9v1C5nYlvd/IodJUf0Batz6Q= -github.com/kyoh86/richgo v0.3.3/go.mod h1:S65jllVRxBm59fqIXfCa3cPxQYRT9u9v45EPQVeuoH0= -github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81 h1:C2Yb5TxdHWrtWXdf+j8xWW4QQu8lXuxtj1UOK816dpA= -github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81/go.mod h1:Z5mDqe0fxyxn3W2yTxsBAOQqIrXADQIh02wrTnaRM38= github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-isatty v0.0.0-20170925054904-a5cdd64afdee/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE= -github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= -github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v0.0.0-20190513014714-f5a3d24e5776/go.mod h1:3HNVkVOU7vZeFXocWuvtcS0XSFLcf2XUSDHkq9t1jU4= -github.com/otiai10/mint v1.2.3/go.mod h1:YnfyPNhBvnY8bW4SGQHCs/aAFhkgySlMZbrF5U0bOVw= -github.com/otiai10/mint v1.2.4/go.mod h1:d+b7n/0R3tdyUYYylALXpWQ/kTN+QobSq/4SRGBkR3M= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= @@ -193,39 +168,23 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190227231451-bbced9601137/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE= -github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rakyll/statik v0.1.5/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81 h1:zQTtDd7fQiF9e80lbl+ShnD9/5NSq5r1EhcS8955ECg= -github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= @@ -237,8 +196,6 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.1 h1:qgMbHoJbPbw579P+1zVY+6n4nIFuIchaIjzZ/I/Yq8M= github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= -github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= -github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.1/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -249,22 +206,26 @@ github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmq github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stumble/gorocksdb v0.0.3 h1:9UU+QA1pqFYJuf9+5p7z1IqdE5k0mma4UAeu2wmX8kA= +github.com/stumble/gorocksdb v0.0.3/go.mod h1:v6IHdFBXk5DJ1K4FZ0xi+eY737quiiBxYtSWXadLybY= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= -github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae h1:AOXNM7c2Vvo45SjAgeWF8Wy+NS7/NCqzRNpUc+HPAec= github.com/tendermint/crypto v0.0.0-20190823183015-45b1026d81ae/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= @@ -273,17 +234,15 @@ github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoM github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= -github.com/tendermint/tendermint v0.32.2/go.mod h1:NwMyx58S8VJ7tEpFKqRVlVWKO9N9zjTHu+Dx96VsnOE= github.com/tendermint/tendermint v0.32.3 h1:GEnWpGQ795h5oTFNbfBLsY0LW/CW2j6p6HtiYNfxsgg= github.com/tendermint/tendermint v0.32.3/go.mod h1:ZK2c29jl1QRYznIRyRWRDsmm1yvtPzBRT00x4t1JToY= github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= +github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ= +github.com/tendermint/tm-db v0.2.0/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8 h1:js9Z9dWq50Ttu4D1YRqgS1gkSgRfpKp+rMza4io7qNw= -github.com/wacul/ptr v0.0.0-20170209030335-91632201dfc8/go.mod h1:BD0gjsZrCwtoR+yWDB9v2hQ8STlq9tT84qKfa+3txOc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= @@ -303,33 +262,23 @@ golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exq golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180404174746-b3c676e531a6/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20170927054621-314a259e304f/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -337,33 +286,24 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df h1:k3DT34vxk64+4bD5x+fRy6U0SXxZehzUHRSYUJcKfII= -google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= From 3bf82e9ee962e16e355bf77c9fa0cb4bfc2e9c3e Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Wed, 25 Sep 2019 15:50:03 -0400 Subject: [PATCH 09/14] update app and cmd --- app/app.go | 9 ++++++--- app/genesis.go | 22 ---------------------- cmd/kvcli/main.go | 2 ++ cmd/kvd/add_account.go | 17 ++++------------- cmd/kvd/main.go | 5 +++-- 5 files changed, 15 insertions(+), 40 deletions(-) diff --git a/app/app.go b/app/app.go index 8ddb720a..efe9e3cf 100644 --- a/app/app.go +++ b/app/app.go @@ -224,9 +224,12 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, // genutils must occur after staking so that pools are properly // initialized with tokens from genesis accounts. - app.mm.SetOrderInitGenesis(auth.ModuleName, distr.ModuleName, - staking.ModuleName, auth.ModuleName, bank.ModuleName, slashing.ModuleName, - gov.ModuleName, mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName) + // TODO should auth be first? + app.mm.SetOrderInitGenesis( + auth.ModuleName, distr.ModuleName, + staking.ModuleName, bank.ModuleName, slashing.ModuleName, + gov.ModuleName, mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName, + ) app.mm.RegisterInvariants(&app.crisisKeeper) app.mm.RegisterRoutes(app.Router(), app.QueryRouter()) diff --git a/app/genesis.go b/app/genesis.go index 5602b64f..d6af7e32 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -2,9 +2,6 @@ package app import ( "encoding/json" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/auth/exported" ) // GenesisState represents the genesis state of the blockchain. It is a map from module names to module genesis states. @@ -14,22 +11,3 @@ type GenesisState map[string]json.RawMessage func NewDefaultGenesisState() GenesisState { return ModuleBasics.DefaultGenesis() } - -// TODO remove iterator once merged into sdk master -type GenesisAccountIterator struct{} -// IterateGenesisAccounts iterates over all the genesis accounts found in -// appGenesis and invokes a callback on each genesis account. If any call -// returns true, iteration stops. -func (GenesisAccountIterator) IterateGenesisAccounts( - cdc *codec.Codec, appGenesis map[string]json.RawMessage, cb func(exported.Account) (stop bool), -) { - - var authGenState auth.GenesisState - cdc.MustUnmarshalJSON(appGenesis[auth.ModuleName], &authGenState) - - for _, genAcc := range authGenState.Accounts { - if cb(genAcc) { - break - } - } -} \ No newline at end of file diff --git a/cmd/kvcli/main.go b/cmd/kvcli/main.go index dbe097b8..5407de3a 100644 --- a/cmd/kvcli/main.go +++ b/cmd/kvcli/main.go @@ -34,6 +34,7 @@ func main() { cdc := app.MakeCodec() // Read in the configuration file for the sdk + // TODO check there is no issue with `kvcli keys parse` config := sdk.GetConfig() app.SetBech32AddressPrefixes(config) config.Seal() @@ -115,6 +116,7 @@ func txCmd(cdc *amino.Codec) *cobra.Command { client.LineBreak, authcmd.GetBroadcastCommand(cdc), authcmd.GetEncodeCommand(cdc), + authcmd.GetDecodeCommand(cdc), client.LineBreak, ) diff --git a/cmd/kvd/add_account.go b/cmd/kvd/add_account.go index a9fc9a2d..7a4f4fb2 100644 --- a/cmd/kvd/add_account.go +++ b/cmd/kvd/add_account.go @@ -104,24 +104,15 @@ func AddGenesisAccountCmd( return fmt.Errorf("failed to unmarshal genesis state: %w", err) } - // authGenState := auth.GetGenesisStateFromAppState(cdc, appState) - // TODO replace 2 following lines with above once sdk updated - var authGenState auth.GenesisState - cdc.MustUnmarshalJSON(appState[auth.ModuleName], &authGenState) - - // if authGenState.Accounts.Contains(addr) { - // TODO replace loop below with above once sdk is updated - for _, acc := range authGenState.Accounts { - if acc.GetAddress().Equals(addr) { - return fmt.Errorf("cannot add account at existing address %s", addr) - } + authGenState := auth.GetGenesisStateFromAppState(cdc, appState) + if authGenState.Accounts.Contains(addr) { + return fmt.Errorf("cannot add account at existing address %s", addr) } // Add the new account to the set of genesis accounts and sanitize the // accounts afterwards. authGenState.Accounts = append(authGenState.Accounts, genAccount) - // TODO uncomment following line once merged into master - // authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts) + authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts) authGenStateBz, err := cdc.MarshalJSON(authGenState) if err != nil { diff --git a/cmd/kvd/main.go b/cmd/kvd/main.go index 0b9324d4..587b9543 100644 --- a/cmd/kvd/main.go +++ b/cmd/kvd/main.go @@ -20,6 +20,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cosmos/cosmos-sdk/x/staking" + "github.com/cosmos/cosmos-sdk/x/auth" "github.com/kava-labs/kava/app" ) @@ -45,14 +46,14 @@ func main() { } rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) - rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, app.GenesisAccountIterator{}, app.DefaultNodeHome)) + rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome)) rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) rootCmd.AddCommand(genutilcli.GenTxCmd( ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, - app.GenesisAccountIterator{}, + auth.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome)) rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) From 1ecc4ac11546eabc21ec9cd538ec9bf92e18679d Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Wed, 25 Sep 2019 16:55:02 -0400 Subject: [PATCH 10/14] resolve todo --- cmd/kvcli/main.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/kvcli/main.go b/cmd/kvcli/main.go index 5407de3a..2fac4819 100644 --- a/cmd/kvcli/main.go +++ b/cmd/kvcli/main.go @@ -34,7 +34,6 @@ func main() { cdc := app.MakeCodec() // Read in the configuration file for the sdk - // TODO check there is no issue with `kvcli keys parse` config := sdk.GetConfig() app.SetBech32AddressPrefixes(config) config.Seal() From a3108dcccb8f994c1a132fcfd7bfffd01fcf03d2 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Thu, 26 Sep 2019 15:37:03 -0400 Subject: [PATCH 11/14] fix typo --- simulations/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/README.md b/simulations/README.md index 06c25bb8..69cbdab9 100644 --- a/simulations/README.md +++ b/simulations/README.md @@ -12,7 +12,7 @@ In AWS batch you define: Then to run stuff you create "jobs" and submit them to a job queue. -The number of machine running auto-scales to match the number of jobs. When there are no jobs there are no machines, so you don't pay for anything. +The number of machines running auto-scales to match the number of jobs. When there are no jobs there are no machines, so you don't pay for anything. Jobs are defined as a docker image (assumed hosted on dockerhub) and a command string. >e.g. `kava/kava-sim:version1`, `go test ./app` From 2be4506d3177454e4ccb0ea1bbbcef82c9ea2779 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Thu, 26 Sep 2019 15:37:34 -0400 Subject: [PATCH 12/14] add make test cmd --- Makefile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f2b21fdd..ed080a2a 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,21 @@ clean: ######################################## ### Testing -sim: - @go test -mod=readonly ./app -run TestFullAppSimulation -Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h +# TODO tidy up cli tests to use same -Enable flag as simulations, or the other way round +# TODO -mod=readonly ? +# build dependency needed for cli tests +test-all: build + # basic app tests + @go test ./app -v + # cli tests + @go test ./cli_test -tags cli_test -v -p 4 + # basic simulation (seed "2" happens to not unbond all validators before reaching 100 blocks) + @go test ./app -run TestFullAppSimulation -Enabled -Commit -NumBlocks=100 -BlockSize=200 -Seed 2 -v -timeout 24h + # other sim tests + @go test ./app -run TestAppImportExport -Enabled -Commit -NumBlocks=100 -BlockSize=200 -Seed 2 -v -timeout 24h + @go test ./app -run TestAppSimulationAfterImport -Enabled -Commit -NumBlocks=100 -BlockSize=200 -Seed 2 -v -timeout 24h + @# AppStateDeterminism does use Seed flag + @go test ./app -run TestAppStateDeterminism -Enabled -Commit -NumBlocks=100 -BlockSize=200 -v -timeout 24h -.PHONY: all build-linux install clean build sim \ No newline at end of file + +.PHONY: all build-linux install clean build test-all \ No newline at end of file From a13e8d0379769f2864b6c0e6f8d969a6829f0743 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Thu, 26 Sep 2019 16:14:10 -0400 Subject: [PATCH 13/14] fix invariant benchmarking --- app/sim_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/sim_test.go b/app/sim_test.go index edcb94b8..298acccc 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -681,9 +681,11 @@ func BenchmarkInvariants(b *testing.B) { // their respective metadata which makes it useful for testing/benchmarking. for _, cr := range app.crisisKeeper.Routes() { b.Run(fmt.Sprintf("%s/%s", cr.ModuleName, cr.Route), func(b *testing.B) { - if res, stop := cr.Invar(ctx); stop { - fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) - b.FailNow() + for n := 0; n < b.N; n++ { + if res, stop := cr.Invar(ctx); stop { + fmt.Printf("broken invariant at block %d of %d\n%s", ctx.BlockHeight()-1, config.NumBlocks, res) + b.FailNow() + } } }) } From 436c48c8d2e77912d3b7bdae614e48ca02fa7b5c Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Fri, 27 Sep 2019 14:05:21 -0400 Subject: [PATCH 14/14] resolve TODOs --- app/app.go | 6 ++++-- cli_test/cli_test.go | 6 ++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/app.go b/app/app.go index efe9e3cf..1cc799d8 100644 --- a/app/app.go +++ b/app/app.go @@ -222,9 +222,11 @@ func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName) - // genutils must occur after staking so that pools are properly + // Note: genutils must occur after staking so that pools are properly // initialized with tokens from genesis accounts. - // TODO should auth be first? + // + // Note: Changing the order of the auth module and modules that use module accounts + // results in subtle changes to the way accounts are loaded from genesis. app.mm.SetOrderInitGenesis( auth.ModuleName, distr.ModuleName, staking.ModuleName, bank.ModuleName, slashing.ModuleName, diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 9e7df17d..e559e6b7 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -281,7 +281,7 @@ func TestGaiaCLISend(t *testing.T) { f.Cleanup() } -// TODO needed? not in gaia tests +// Note: this was removed from gaia due to update in sdk PR#4062 but is now working func TestGaiaCLIConfirmTx(t *testing.T) { t.Parallel() f := InitFixtures(t) @@ -1307,9 +1307,7 @@ func TestGaiadAddGenesisAccount(t *testing.T) { cdc := app.MakeCodec() - // TODO maybe replace once sdk updated - var authGenState auth.GenesisState - cdc.MustUnmarshalJSON(genesisState[auth.ModuleName], &authGenState) + authGenState := auth.GetGenesisStateFromAppState(cdc, genesisState) accounts := authGenState.Accounts require.Equal(t, accounts[0].GetAddress(), f.KeyAddress(keyFoo))