From e7488209c82e58fe297a6b013a5b831278cd171d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 1 Jul 2020 17:29:09 +0100 Subject: [PATCH] refactor soup: assemble testkit; separate test case logic from node templates. (#88) --- .../compositions/composition-k8s-10-3.toml | 2 +- .../compositions/composition-k8s-3-1.toml | 2 +- .../compositions/composition-k8s-3-2.toml | 2 +- lotus-soup/compositions/composition-k8s.toml | 2 +- .../compositions/composition-local-drand.toml | 2 +- .../compositions/composition-natural.toml | 2 +- .../compositions/composition-tracer.toml | 2 +- lotus-soup/compositions/composition.toml | 2 +- lotus-soup/go.mod | 2 +- lotus-soup/go.sum | 65 +----- lotus-soup/main.go | 116 +++++++++- lotus-soup/manifest.toml | 18 +- lotus-soup/role_client.go | 194 ---------------- lotus-soup/roles.go | 27 --- lotus-soup/{ => testkit}/deals.go | 6 +- lotus-soup/testkit/defaults.go | 55 +++++ lotus-soup/{ => testkit}/lotus_opts.go | 2 +- lotus-soup/{ => testkit}/node.go | 67 ++---- lotus-soup/{ => testkit}/retrieval.go | 8 +- lotus-soup/{ => testkit}/role_bootstrapper.go | 62 +++--- lotus-soup/testkit/role_client.go | 139 ++++++++++++ lotus-soup/{ => testkit}/role_drand.go | 62 +++--- lotus-soup/{ => testkit}/role_miner.go | 210 +++++++++--------- .../{ => testkit}/role_pubsub_tracer.go | 37 ++- lotus-soup/{ => testkit}/sync.go | 24 +- lotus-soup/testkit/testenv.go | 48 ++++ 26 files changed, 600 insertions(+), 558 deletions(-) delete mode 100644 lotus-soup/role_client.go delete mode 100644 lotus-soup/roles.go rename lotus-soup/{ => testkit}/deals.go (89%) create mode 100644 lotus-soup/testkit/defaults.go rename lotus-soup/{ => testkit}/lotus_opts.go (99%) rename lotus-soup/{ => testkit}/node.go (75%) rename lotus-soup/{ => testkit}/retrieval.go (91%) rename lotus-soup/{ => testkit}/role_bootstrapper.go (74%) create mode 100644 lotus-soup/testkit/role_client.go rename lotus-soup/{ => testkit}/role_drand.go (87%) rename lotus-soup/{ => testkit}/role_miner.go (80%) rename lotus-soup/{ => testkit}/role_pubsub_tracer.go (68%) rename lotus-soup/{ => testkit}/sync.go (51%) create mode 100644 lotus-soup/testkit/testenv.go diff --git a/lotus-soup/compositions/composition-k8s-10-3.toml b/lotus-soup/compositions/composition-k8s-10-3.toml index bc4a44220..061a1c984 100644 --- a/lotus-soup/compositions/composition-k8s-10-3.toml +++ b/lotus-soup/compositions/composition-k8s-10-3.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 14 builder = "docker:go" runner = "cluster:k8s" diff --git a/lotus-soup/compositions/composition-k8s-3-1.toml b/lotus-soup/compositions/composition-k8s-3-1.toml index a4fb82ce2..3470c3093 100644 --- a/lotus-soup/compositions/composition-k8s-3-1.toml +++ b/lotus-soup/compositions/composition-k8s-3-1.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 5 builder = "docker:go" runner = "cluster:k8s" diff --git a/lotus-soup/compositions/composition-k8s-3-2.toml b/lotus-soup/compositions/composition-k8s-3-2.toml index b0c7f3c74..8740d4f0c 100644 --- a/lotus-soup/compositions/composition-k8s-3-2.toml +++ b/lotus-soup/compositions/composition-k8s-3-2.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 6 builder = "docker:go" runner = "cluster:k8s" diff --git a/lotus-soup/compositions/composition-k8s.toml b/lotus-soup/compositions/composition-k8s.toml index b4e2d563e..548293588 100644 --- a/lotus-soup/compositions/composition-k8s.toml +++ b/lotus-soup/compositions/composition-k8s.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 3 builder = "docker:go" runner = "cluster:k8s" diff --git a/lotus-soup/compositions/composition-local-drand.toml b/lotus-soup/compositions/composition-local-drand.toml index 9994008e7..50e969a49 100644 --- a/lotus-soup/compositions/composition-local-drand.toml +++ b/lotus-soup/compositions/composition-local-drand.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 6 builder = "docker:go" runner = "local:docker" diff --git a/lotus-soup/compositions/composition-natural.toml b/lotus-soup/compositions/composition-natural.toml index e82c6a397..36e8908bd 100644 --- a/lotus-soup/compositions/composition-natural.toml +++ b/lotus-soup/compositions/composition-natural.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 6 builder = "docker:go" runner = "local:docker" diff --git a/lotus-soup/compositions/composition-tracer.toml b/lotus-soup/compositions/composition-tracer.toml index d632d287e..af9207fb0 100644 --- a/lotus-soup/compositions/composition-tracer.toml +++ b/lotus-soup/compositions/composition-tracer.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 7 builder = "docker:go" runner = "local:docker" diff --git a/lotus-soup/compositions/composition.toml b/lotus-soup/compositions/composition.toml index 1b24f3b94..cad741422 100644 --- a/lotus-soup/compositions/composition.toml +++ b/lotus-soup/compositions/composition.toml @@ -4,7 +4,7 @@ [global] plan = "lotus-soup" - case = "lotus-baseline" + case = "deals-e2e" total_instances = 6 builder = "docker:go" runner = "local:docker" diff --git a/lotus-soup/go.mod b/lotus-soup/go.mod index 332ebec9d..15a67024f 100644 --- a/lotus-soup/go.mod +++ b/lotus-soup/go.mod @@ -26,7 +26,7 @@ require ( github.com/libp2p/go-libp2p-pubsub-tracer v0.0.0-20200626141350-e730b32bf1e6 github.com/multiformats/go-multiaddr v0.2.2 github.com/multiformats/go-multiaddr-net v0.1.5 - github.com/testground/sdk-go v0.2.3-0.20200630131002-c16b558f6ca9 + github.com/testground/sdk-go v0.2.3-0.20200630140907-cda3c5ac055b go.opencensus.io v0.22.4 ) diff --git a/lotus-soup/go.sum b/lotus-soup/go.sum index 3b1748960..ce096f015 100644 --- a/lotus-soup/go.sum +++ b/lotus-soup/go.sum @@ -87,7 +87,6 @@ github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= -github.com/benbjohnson/clock v1.0.1 h1:lVM1R/o5khtrr7t3qAr+sS6uagZOP+7iprc7gS3V9CE= github.com/benbjohnson/clock v1.0.1/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.0.2 h1:Z0CN0Yb4ig9sGPXkvAQcGJfnrrMQ5QYLCMPRi9iD7YE= github.com/benbjohnson/clock v1.0.2/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= @@ -146,7 +145,6 @@ github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -228,9 +226,7 @@ github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef/go.m github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e/go.mod h1:boRtQhzmxNocrMxOXo1NYn4oUc1NGvR8tEa79wApNXg= github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200424220931-6263827e49f2 h1:jamfsxfK0Q9yCMHt8MPWx7Aa/O9k2Lve8eSc6FILYGQ= github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200424220931-6263827e49f2/go.mod h1:boRtQhzmxNocrMxOXo1NYn4oUc1NGvR8tEa79wApNXg= -github.com/filecoin-project/go-bitfield v0.0.0-20200416002808-b3ee67ec9060 h1:/3qjGMn6ukXgZJHsIbuwGL7ipla8DOV3uHZDBJkBYfU= github.com/filecoin-project/go-bitfield v0.0.0-20200416002808-b3ee67ec9060/go.mod h1:iodsLxOFZnqKtjj2zkgqzoGNrv6vUqj69AT/J8DKXEw= -github.com/filecoin-project/go-bitfield v0.0.1 h1:Xg/JnrqqE77aJVKdbEyR04n9FZQWhwrN+buDgQCVpZU= github.com/filecoin-project/go-bitfield v0.0.1/go.mod h1:Ry9/iUlWSyjPUzlAvdnfy4Gtvrq4kWmWDztCU1yEgJY= github.com/filecoin-project/go-bitfield v0.0.2-0.20200518150651-562fdb554b6e h1:gkG/7G+iKy4He+IiQNeQn+nndFznb/vCoOR8iRQsm60= github.com/filecoin-project/go-bitfield v0.0.2-0.20200518150651-562fdb554b6e/go.mod h1:Ry9/iUlWSyjPUzlAvdnfy4Gtvrq4kWmWDztCU1yEgJY= @@ -252,7 +248,6 @@ github.com/filecoin-project/go-paramfetch v0.0.1/go.mod h1:fZzmf4tftbwf9S37XRifo github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc= github.com/filecoin-project/go-paramfetch v0.0.2-0.20200605171344-fcac609550ca h1:OGykrCr6mSn/ckk2IFbIlkc76nsgEs7tSLhZXQt7+z4= github.com/filecoin-project/go-paramfetch v0.0.2-0.20200605171344-fcac609550ca/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc= -github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 h1:k9qVR9ItcziSB2rxtlkN/MDWNlbsI6yzec+zjUatLW0= github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v0.0.0-20200612181802-4eb3d0c68eba h1:GEWb/6KQyNZt4jm8fgVcIFPH0ElAGXfHM59ZSiqPTvY= github.com/filecoin-project/go-statemachine v0.0.0-20200612181802-4eb3d0c68eba/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= @@ -268,6 +263,7 @@ github.com/filecoin-project/sector-storage v0.0.0-20200618073200-d9de9b7cb4b4/go github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA= github.com/filecoin-project/specs-actors v0.3.0/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y= github.com/filecoin-project/specs-actors v0.6.0/go.mod h1:dRdy3cURykh2R8O/DKqy8olScl70rmIS7GrB4hB1IDY= +github.com/filecoin-project/specs-actors v0.6.1/go.mod h1:dRdy3cURykh2R8O/DKqy8olScl70rmIS7GrB4hB1IDY= github.com/filecoin-project/specs-actors v0.6.2-0.20200617175406-de392ca14121 h1:oRA+b4iN4H86xXDXbU3TOyvmBZp7//c5VqTc0oJ6nLg= github.com/filecoin-project/specs-actors v0.6.2-0.20200617175406-de392ca14121/go.mod h1:dRdy3cURykh2R8O/DKqy8olScl70rmIS7GrB4hB1IDY= github.com/filecoin-project/specs-storage v0.1.0 h1:PkDgTOT5W5Ao7752onjDl4QSv+sgOVdJbvFjOnD5w94= @@ -294,7 +290,6 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 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-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -327,36 +322,29 @@ github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -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-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0 h1:Rd1kQnQu0Hq3qvJppYSG0HtP+f5LPPUiDswTLiEegLg= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 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= -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/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= @@ -455,7 +443,6 @@ github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0m github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hodgesds/perf-utils v0.0.8/go.mod h1:F6TfvsbtrF88i++hou29dTXlI2sfsJv+gRZDtmTJkAs= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag= @@ -499,7 +486,6 @@ github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUP github.com/ipfs/go-cid v0.0.4-0.20191112011718-79e75dffeb10/go.mod h1:/BYOuUoxkE+0f6tGzlzMvycuN+5l35VOR4Bpg2sCmds= github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M= github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= -github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00 h1:QN88Q0kT2QiDaLxpR/SDsqOBtNIEF/F3n96gSDUimkA= github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.6 h1:go0y+GcDOGeJIV01FeBsta4FHngoA4Wz7KMeLkXAhMs= github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= @@ -539,7 +525,6 @@ github.com/ipfs/go-graphsync v0.0.6-0.20200504202014-9d5f2c26a103 h1:SD+bXod/pOW github.com/ipfs/go-graphsync v0.0.6-0.20200504202014-9d5f2c26a103/go.mod h1:jMXfqIEDFukLPZHqDPp8tJMbHO9Rmeb9CEGevngQbmE= github.com/ipfs/go-hamt-ipld v0.0.15-0.20200131012125-dd88a59d3f2e/go.mod h1:9aQJu/i/TaRDW6jqB5U217dLIDopn50wxLdHXM2CTfE= github.com/ipfs/go-hamt-ipld v0.0.15-0.20200204200533-99b8553ef242/go.mod h1:kq3Pi+UP3oHhAdKexE+kHHYRKMoFNuGero0R7q3hWGg= -github.com/ipfs/go-hamt-ipld v0.1.1-0.20200501020327-d53d20a7063e h1:Klv6s+kbuhh0JVpGFmFK2t6AtZxJfAnVneQHh1DlFOo= github.com/ipfs/go-hamt-ipld v0.1.1-0.20200501020327-d53d20a7063e/go.mod h1:giiPqWYCnRBYpNTsJ/EX1ojldX5kTXrXYckSJQ7ko9M= github.com/ipfs/go-hamt-ipld v0.1.1-0.20200605182717-0310ad2b0b1f h1:mchhWiYYUSoCuE3wDfRCo8cho5kqSoxkgnOtGcnNMZw= github.com/ipfs/go-hamt-ipld v0.1.1-0.20200605182717-0310ad2b0b1f/go.mod h1:phOFBB7W73N9dg1glcb1fQ9HtQFDUpeyJgatW8ns0bw= @@ -585,7 +570,6 @@ github.com/ipfs/go-ipfs-pq v0.0.2/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7 github.com/ipfs/go-ipfs-routing v0.0.1/go.mod h1:k76lf20iKFxQTjcJokbPM9iBXVXVZhcOwc360N4nuKs= github.com/ipfs/go-ipfs-routing v0.1.0 h1:gAJTT1cEeeLj6/DlLX6t+NxD9fQe2ymTO6qWRDI/HQQ= github.com/ipfs/go-ipfs-routing v0.1.0/go.mod h1:hYoUkJLyAUKhF58tysKpids8RNDPO42BVMgK5dNsoqY= -github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50= github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc= github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8= github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ= @@ -612,9 +596,7 @@ github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kP github.com/ipfs/go-log/v2 v2.0.1/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.2/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= github.com/ipfs/go-log/v2 v2.0.3/go.mod h1:O7P1lJt27vWHhOwQmcFEvlmo49ry2VY2+JfBWFaa9+0= -github.com/ipfs/go-log/v2 v2.0.5 h1:fL4YI+1g5V/b1Yxr1qAiXTMg1H8z9vx/VmJxBuQMHvU= github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= -github.com/ipfs/go-log/v2 v2.0.8 h1:3b3YNopMHlj4AvyhWAx0pDxqSQWYi4/WuWO7yRV6/Qg= github.com/ipfs/go-log/v2 v2.0.8/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw= github.com/ipfs/go-log/v2 v2.1.2-0.20200609205458-f8d20c392cb7 h1:LtL/rvdfbKSthZGmAAD9o4KKg6HA6Qn8gXCCdgnj7lw= github.com/ipfs/go-log/v2 v2.1.2-0.20200609205458-f8d20c392cb7/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM= @@ -722,7 +704,6 @@ github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfo github.com/kpacha/opencensus-influxdb v0.0.0-20181102202715-663e2683a27c h1:3pM6OrLfkfe0rKZjE6MHdcTaI0ohcHbRUZJeJqkvPb4= github.com/kpacha/opencensus-influxdb v0.0.0-20181102202715-663e2683a27c/go.mod h1:ESXZSm2iaF+1P5o6VFEWpeARTQpcil4e1DwumnTopdg= 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/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -732,7 +713,6 @@ 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/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/libp2p/go-addr-util v0.0.1 h1:TpTQm9cXVRVSKsYbgQ7GKc3KbbHVTnbostgGaDEP+88= github.com/libp2p/go-addr-util v0.0.1/go.mod h1:4ac6O7n9rIAKB1dnd+s8IbbMXkt+oBpzX4/+RACcnlQ= github.com/libp2p/go-addr-util v0.0.2 h1:7cWK5cdA5x72jX0g8iLrQWm5TRJZ6CzGdPEhWj7plWU= github.com/libp2p/go-addr-util v0.0.2/go.mod h1:Ecd6Fb3yIuLzq4bD7VcywcVSBtefcAwnUISBM3WG15E= @@ -746,7 +726,6 @@ github.com/libp2p/go-conn-security-multistream v0.1.0/go.mod h1:aw6eD7LOsHEX7+2h github.com/libp2p/go-conn-security-multistream v0.2.0 h1:uNiDjS58vrvJTg9jO6bySd1rMKejieG7v45ekqHbZ1M= github.com/libp2p/go-conn-security-multistream v0.2.0/go.mod h1:hZN4MjlNetKD3Rq5Jb/P5ohUnFLNzEAR4DLSzpn2QLU= github.com/libp2p/go-eventbus v0.0.2/go.mod h1:Hr/yGlwxA/stuLnpMiu82lpNKpvRy3EaJxPu40XYOwk= -github.com/libp2p/go-eventbus v0.1.0 h1:mlawomSAjjkk97QnYiEmHsLu7E136+2oCWSHRUvMfzQ= github.com/libp2p/go-eventbus v0.1.0/go.mod h1:vROgu5cs5T7cv7POWlWxBaVLxfSegC5UGQf8A2eEmx4= github.com/libp2p/go-eventbus v0.2.1 h1:VanAdErQnpTioN2TowqNcOijf6YwhuODe4pPKSDpxGc= github.com/libp2p/go-eventbus v0.2.1/go.mod h1:jc2S4SoEVPP48H9Wpzm5aiGwUCBMfGhVhhBjyhhCJs8= @@ -765,7 +744,6 @@ github.com/libp2p/go-libp2p v0.6.1/go.mod h1:CTFnWXogryAHjXAKEbOf1OWY+VeAP3lDMZk github.com/libp2p/go-libp2p v0.7.0/go.mod h1:hZJf8txWeCduQRDC/WSqBGMxaTHCOYHt2xSU1ivxn0k= github.com/libp2p/go-libp2p v0.7.4/go.mod h1:oXsBlTLF1q7pxr+9w6lqzS1ILpyHsaBPniVO7zIHGMw= github.com/libp2p/go-libp2p v0.8.2/go.mod h1:NQDA/F/qArMHGe0J7sDScaKjW8Jh4y/ozQqBbYJ+BnA= -github.com/libp2p/go-libp2p v0.8.3 h1:IFWeNzxkBaNO1N8stN9ayFGdC6RmVuSsKd5bou7qpK0= github.com/libp2p/go-libp2p v0.8.3/go.mod h1:EsH1A+8yoWK+L4iKcbPYu6MPluZ+CHWI9El8cTaefiM= github.com/libp2p/go-libp2p v0.9.2/go.mod h1:cunHNLDVus66Ct9iXXcjKRLdmHdFdHVe1TAnbubJQqQ= github.com/libp2p/go-libp2p v0.10.0 h1:7ooOvK1wi8eLpyTppy8TeH43UHy5uI75GAHGJxenUi0= @@ -776,7 +754,6 @@ github.com/libp2p/go-libp2p-autonat v0.1.0/go.mod h1:1tLf2yXxiE/oKGtDwPYWTSYG3Pt github.com/libp2p/go-libp2p-autonat v0.1.1/go.mod h1:OXqkeGOY2xJVWKAGV2inNF5aKN/djNA3fdpCWloIudE= github.com/libp2p/go-libp2p-autonat v0.2.0/go.mod h1:DX+9teU4pEEoZUqR1PiMlqliONQdNbfzE1C718tcViI= github.com/libp2p/go-libp2p-autonat v0.2.1/go.mod h1:MWtAhV5Ko1l6QBsHQNSuM6b1sRkXrpk0/LqCr+vCVxI= -github.com/libp2p/go-libp2p-autonat v0.2.2 h1:4dlgcEEugTFWSvdG2UIFxhnOMpX76QaZSRAtXmYB8n4= github.com/libp2p/go-libp2p-autonat v0.2.2/go.mod h1:HsM62HkqZmHR2k1xgX34WuWDzk/nBwNHoeyyT4IWV6A= github.com/libp2p/go-libp2p-autonat v0.2.3 h1:w46bKK3KTOUWDe5mDYMRjJu1uryqBp8HCNDp/TWMqKw= github.com/libp2p/go-libp2p-autonat v0.2.3/go.mod h1:2U6bNWCNsAG9LEbwccBDQbjzQ8Krdjge1jLTE9rdoMM= @@ -784,7 +761,6 @@ github.com/libp2p/go-libp2p-autonat-svc v0.1.0/go.mod h1:fqi8Obl/z3R4PFVLm8xFtZ6 github.com/libp2p/go-libp2p-blankhost v0.0.1/go.mod h1:Ibpbw/7cPPYwFb7PACIWdvxxv0t0XCCI10t7czjAjTc= github.com/libp2p/go-libp2p-blankhost v0.1.1/go.mod h1:pf2fvdLJPsC1FsVrNP3DUUvMzUts2dsLLBEpo1vW1ro= github.com/libp2p/go-libp2p-blankhost v0.1.3/go.mod h1:KML1//wiKR8vuuJO0y3LUd1uLv+tlkGTAr3jC0S5cLg= -github.com/libp2p/go-libp2p-blankhost v0.1.4 h1:I96SWjR4rK9irDHcHq3XHN6hawCRTPUADzkJacgZLvk= github.com/libp2p/go-libp2p-blankhost v0.1.4/go.mod h1:oJF0saYsAXQCSfDq254GMNmLNz6ZTHTOvtF4ZydUvwU= github.com/libp2p/go-libp2p-blankhost v0.1.6 h1:CkPp1/zaCrCnBo0AdsQA0O1VkUYoUOtyHOnoa8gKIcE= github.com/libp2p/go-libp2p-blankhost v0.1.6/go.mod h1:jONCAJqEP+Z8T6EQviGL4JsQcLx1LgTGtVqFNY8EMfQ= @@ -795,13 +771,10 @@ github.com/libp2p/go-libp2p-circuit v0.1.1/go.mod h1:Ahq4cY3V9VJcHcn1SBXjr78AbFk github.com/libp2p/go-libp2p-circuit v0.1.3/go.mod h1:Xqh2TjSy8DD5iV2cCOMzdynd6h8OTBGoV1AWbWor3qM= github.com/libp2p/go-libp2p-circuit v0.1.4/go.mod h1:CY67BrEjKNDhdTk8UgBX1Y/H5c3xkAcs3gnksxY7osU= github.com/libp2p/go-libp2p-circuit v0.2.1/go.mod h1:BXPwYDN5A8z4OEY9sOfr2DUQMLQvKt/6oku45YUmjIo= -github.com/libp2p/go-libp2p-circuit v0.2.2 h1:87RLabJ9lrhoiSDDZyCJ80ZlI5TLJMwfyoGAaWXzWqA= github.com/libp2p/go-libp2p-circuit v0.2.2/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= github.com/libp2p/go-libp2p-circuit v0.2.3 h1:3Uw1fPHWrp1tgIhBz0vSOxRUmnKL8L/NGUyEd5WfSGM= github.com/libp2p/go-libp2p-circuit v0.2.3/go.mod h1:nkG3iE01tR3FoQ2nMm06IUrCpCyJp1Eo4A1xYdpjfs4= -github.com/libp2p/go-libp2p-connmgr v0.1.1 h1:BIul1BPoN1vPAByMh6CeD33NpGjD+PkavmUjTS7uai8= github.com/libp2p/go-libp2p-connmgr v0.1.1/go.mod h1:wZxh8veAmU5qdrfJ0ZBLcU8oJe9L82ciVP/fl1VHjXk= -github.com/libp2p/go-libp2p-connmgr v0.2.3 h1:v7skKI9n+0obPpzMIO6aIlOSdQOmhxTf40cbpzqaGMQ= github.com/libp2p/go-libp2p-connmgr v0.2.3/go.mod h1:Gqjg29zI8CwXX21zRxy6gOg8VYu3zVerJRt2KyktzH4= github.com/libp2p/go-libp2p-connmgr v0.2.4 h1:TMS0vc0TCBomtQJyWr7fYxcVYYhx+q/2gF++G5Jkl/w= github.com/libp2p/go-libp2p-connmgr v0.2.4/go.mod h1:YV0b/RIm8NGPnnNWM7hG9Q38OeQiQfKhHCCs1++ufn0= @@ -821,12 +794,10 @@ github.com/libp2p/go-libp2p-core v0.4.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZas github.com/libp2p/go-libp2p-core v0.5.0/go.mod h1:49XGI+kc38oGVwqSBhDEwytaAxgZasHhFfQKibzTls0= github.com/libp2p/go-libp2p-core v0.5.1/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.5.2/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= -github.com/libp2p/go-libp2p-core v0.5.3 h1:b9W3w7AZR2n/YJhG8d0qPFGhGhCWKIvPuJgp4hhc4MM= github.com/libp2p/go-libp2p-core v0.5.3/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.5.4/go.mod h1:uN7L2D4EvPCvzSH5SrhR72UWbnSGpt5/a35Sm4upn4Y= github.com/libp2p/go-libp2p-core v0.5.5/go.mod h1:vj3awlOr9+GMZJFH9s4mpt9RHHgGqeHCopzbYKZdRjM= github.com/libp2p/go-libp2p-core v0.5.6/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= -github.com/libp2p/go-libp2p-core v0.5.7 h1:QK3xRwFxqd0Xd9bSZL+8yZ8ncZZbl6Zngd/+Y+A6sgQ= github.com/libp2p/go-libp2p-core v0.5.7/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= github.com/libp2p/go-libp2p-core v0.6.0 h1:u03qofNYTBN+yVg08PuAKylZogVf0xcTEeM8skGf+ak= github.com/libp2p/go-libp2p-core v0.6.0/go.mod h1:txwbVEhHEXikXn9gfC7/UDDw7rkxuX0bJvM49Ykaswo= @@ -886,16 +857,13 @@ github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVd github.com/libp2p/go-libp2p-peerstore v0.2.0/go.mod h1:N2l3eVIeAitSg3Pi2ipSrJYnqhVnMNQZo9nkSCuAbnQ= github.com/libp2p/go-libp2p-peerstore v0.2.1/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= github.com/libp2p/go-libp2p-peerstore v0.2.2/go.mod h1:NQxhNjWxf1d4w6PihR8btWIRjwRLBr4TYKfNgrUkOPA= -github.com/libp2p/go-libp2p-peerstore v0.2.3 h1:MofRq2l3c15vQpEygTetV+zRRrncz+ktiXW7H2EKoEQ= github.com/libp2p/go-libp2p-peerstore v0.2.3/go.mod h1:K8ljLdFn590GMttg/luh4caB/3g0vKuY01psze0upRw= -github.com/libp2p/go-libp2p-peerstore v0.2.4 h1:jU9S4jYN30kdzTpDAR7SlHUD+meDUjTODh4waLWF1ws= github.com/libp2p/go-libp2p-peerstore v0.2.4/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-peerstore v0.2.6 h1:2ACefBX23iMdJU9Ke+dcXt3w86MIryes9v7In4+Qq3U= github.com/libp2p/go-libp2p-peerstore v0.2.6/go.mod h1:ss/TWTgHZTMpsU/oKVVPQCGuDHItOpf2W8RxAi50P2s= github.com/libp2p/go-libp2p-pnet v0.2.0 h1:J6htxttBipJujEjz1y0a5+eYoiPcFHhSYHH6na5f0/k= github.com/libp2p/go-libp2p-pnet v0.2.0/go.mod h1:Qqvq6JH/oMZGwqs3N1Fqhv8NVhrdYcO0BW4wssv21LA= github.com/libp2p/go-libp2p-protocol v0.0.1/go.mod h1:Af9n4PiruirSDjHycM1QuiMi/1VZNHYcK8cLgFJLZ4s= -github.com/libp2p/go-libp2p-protocol v0.1.0 h1:HdqhEyhg0ToCaxgMhnOmUO8snQtt/kQlcjVk3UoJU3c= github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk= github.com/libp2p/go-libp2p-pubsub v0.1.1/go.mod h1:ZwlKzRSe1eGvSIdU5bD7+8RZN/Uzw0t1Bp9R1znpR/Q= github.com/libp2p/go-libp2p-pubsub v0.3.2-0.20200527132641-c0712c6e92cf/go.mod h1:TxPOBuo1FPdsTjFnv+FGZbNbWYsp74Culx+4ViQpato= @@ -903,7 +871,6 @@ github.com/libp2p/go-libp2p-pubsub v0.3.2 h1:k3cJm5JW5mjaWZkobS50sJLJWaB2mBi0HW4 github.com/libp2p/go-libp2p-pubsub v0.3.2/go.mod h1:Uss7/Cfz872KggNb+doCVPHeCDmXB7z500m/R8DaAUk= github.com/libp2p/go-libp2p-pubsub-tracer v0.0.0-20200626141350-e730b32bf1e6 h1:2lH7rMlvDPSvXeOR+g7FE6aqiEwxtpxWKQL8uigk5fQ= github.com/libp2p/go-libp2p-pubsub-tracer v0.0.0-20200626141350-e730b32bf1e6/go.mod h1:8ZodgKS4qRLayfw9FDKDd9DX4C16/GMofDxSldG8QPI= -github.com/libp2p/go-libp2p-quic-transport v0.1.1 h1:MFMJzvsxIEDEVKzO89BnB/FgvMj9WI4GDGUW2ArDPUA= github.com/libp2p/go-libp2p-quic-transport v0.1.1/go.mod h1:wqG/jzhF3Pu2NrhJEvE+IE0NTHNXslOPn9JQzyCAxzU= github.com/libp2p/go-libp2p-quic-transport v0.5.0 h1:BUN1lgYNUrtv4WLLQ5rQmC9MCJ6uEXusezGvYRNoJXE= github.com/libp2p/go-libp2p-quic-transport v0.5.0/go.mod h1:IEcuC5MLxvZ5KuHKjRu+dr3LjCT1Be3rcD/4d8JrX8M= @@ -928,7 +895,6 @@ github.com/libp2p/go-libp2p-swarm v0.0.6/go.mod h1:s5GZvzg9xXe8sbeESuFpjt8CJPTCa github.com/libp2p/go-libp2p-swarm v0.1.0/go.mod h1:wQVsCdjsuZoc730CgOvh5ox6K8evllckjebkdiY5ta4= github.com/libp2p/go-libp2p-swarm v0.2.1/go.mod h1:x07b4zkMFo2EvgPV2bMTlNmdQc8i+74Jjio7xGvsTgU= github.com/libp2p/go-libp2p-swarm v0.2.2/go.mod h1:fvmtQ0T1nErXym1/aa1uJEyN7JzaTNyBcHImCxRpPKU= -github.com/libp2p/go-libp2p-swarm v0.2.3 h1:uVkCb8Blfg7HQ/f30TyHn1g/uCwXsAET7pU0U59gx/A= github.com/libp2p/go-libp2p-swarm v0.2.3/go.mod h1:P2VO/EpxRyDxtChXz/VPVXyTnszHvokHKRhfkEgFKNM= github.com/libp2p/go-libp2p-swarm v0.2.4/go.mod h1:/xIpHFPPh3wmSthtxdGbkHZ0OET1h/GGZes8Wku/M5Y= github.com/libp2p/go-libp2p-swarm v0.2.7 h1:4lV/sf7f0NuVqunOpt1I11+Z54+xp+m0eeAvxj/LyRc= @@ -948,7 +914,6 @@ github.com/libp2p/go-libp2p-transport v0.0.5/go.mod h1:StoY3sx6IqsP6XKoabsPnHCwq github.com/libp2p/go-libp2p-transport-upgrader v0.0.1/go.mod h1:NJpUAgQab/8K6K0m+JmZCe5RUXG10UMEx4kWe9Ipj5c= github.com/libp2p/go-libp2p-transport-upgrader v0.0.4/go.mod h1:RGq+tupk+oj7PzL2kn/m1w6YXxcIAYJYeI90h6BGgUc= github.com/libp2p/go-libp2p-transport-upgrader v0.1.1/go.mod h1:IEtA6or8JUbsV07qPW4r01GnTenLW4oi3lOPbUMGJJA= -github.com/libp2p/go-libp2p-transport-upgrader v0.2.0 h1:5EhPgQhXZNyfL22ERZTUoVp9UVVbNowWNVtELQaKCHk= github.com/libp2p/go-libp2p-transport-upgrader v0.2.0/go.mod h1:mQcrHj4asu6ArfSoMuyojOdjx73Q47cYD7s5+gZOlns= github.com/libp2p/go-libp2p-transport-upgrader v0.3.0 h1:q3ULhsknEQ34eVDhv4YwKS8iet69ffs9+Fir6a7weN4= github.com/libp2p/go-libp2p-transport-upgrader v0.3.0/go.mod h1:i+SKzbRnvXdVbU3D1dwydnTmKRPXiAR/fyvi1dXuL4o= @@ -958,13 +923,11 @@ github.com/libp2p/go-libp2p-yamux v0.2.0/go.mod h1:Db2gU+XfLpm6E4rG5uGCFX6uXA8ME github.com/libp2p/go-libp2p-yamux v0.2.1/go.mod h1:1FBXiHDk1VyRM1C0aez2bCfHQ4vMZKkAQzZbkSQt5fI= github.com/libp2p/go-libp2p-yamux v0.2.2/go.mod h1:lIohaR0pT6mOt0AZ0L2dFze9hds9Req3OfS+B+dv4qw= github.com/libp2p/go-libp2p-yamux v0.2.5/go.mod h1:Zpgj6arbyQrmZ3wxSZxfBmbdnWtbZ48OpsfmQVTErwA= -github.com/libp2p/go-libp2p-yamux v0.2.7 h1:vzKu0NVtxvEIDGCv6mjKRcK0gipSgaXmJZ6jFv0d/dk= github.com/libp2p/go-libp2p-yamux v0.2.7/go.mod h1:X28ENrBMU/nm4I3Nx4sZ4dgjZ6VhLEn0XhIoZ5viCwU= github.com/libp2p/go-libp2p-yamux v0.2.8 h1:0s3ELSLu2O7hWKfX1YjzudBKCP0kZ+m9e2+0veXzkn4= github.com/libp2p/go-libp2p-yamux v0.2.8/go.mod h1:/t6tDqeuZf0INZMTgd0WxIRbtK2EzI2h7HbFm9eAKI4= github.com/libp2p/go-maddr-filter v0.0.1/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= github.com/libp2p/go-maddr-filter v0.0.4/go.mod h1:6eT12kSQMA9x2pvFQa+xesMKUBlj9VImZbj3B9FBH/Q= -github.com/libp2p/go-maddr-filter v0.0.5 h1:CW3AgbMO6vUvT4kf87y4N+0P8KUl2aqLYhrGyDUbLSg= github.com/libp2p/go-maddr-filter v0.0.5/go.mod h1:Jk+36PMfIqCJhAnaASRH83bdAvfDRp/w6ENFaC9bG+M= github.com/libp2p/go-maddr-filter v0.1.0 h1:4ACqZKw8AqiuJfwFGq1CYDFugfXTOos+qQ3DETkhtCE= github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU= @@ -988,7 +951,6 @@ github.com/libp2p/go-netroute v0.1.2 h1:UHhB35chwgvcRI392znJA3RCBtZ3MpE3ahNCN5MR github.com/libp2p/go-netroute v0.1.2/go.mod h1:jZLDV+1PE8y5XxBySEBgbuVAXbhtuHSdmLPL2n9MKbk= github.com/libp2p/go-openssl v0.0.2/go.mod h1:v8Zw2ijCSWBQi8Pq5GAixw6DbFfa9u6VIYDXnvOXkc0= github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= -github.com/libp2p/go-openssl v0.0.4 h1:d27YZvLoTyMhIN4njrkr8zMDOM4lfpHIp6A+TK9fovg= github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= github.com/libp2p/go-openssl v0.0.5 h1:pQkejVhF0xp08D4CQUcw8t+BFJeXowja6RVcb5p++EA= github.com/libp2p/go-openssl v0.0.5/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= @@ -998,7 +960,6 @@ github.com/libp2p/go-reuseport-transport v0.0.1/go.mod h1:YkbSDrvjUVDL6b8XqriyA2 github.com/libp2p/go-reuseport-transport v0.0.2/go.mod h1:YkbSDrvjUVDL6b8XqriyA20obEtsW9BLkuOUyQAOCbs= github.com/libp2p/go-reuseport-transport v0.0.3 h1:zzOeXnTooCkRvoH+bSXEfXhn76+LAiwoneM0gnXjF2M= github.com/libp2p/go-reuseport-transport v0.0.3/go.mod h1:Spv+MPft1exxARzP2Sruj2Wb5JSyHNncjf1Oi2dEbzM= -github.com/libp2p/go-sockaddr v0.0.2 h1:tCuXfpA9rq7llM/v834RKc/Xvovy/AqM9kHvTV/jY/Q= github.com/libp2p/go-sockaddr v0.0.2/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= github.com/libp2p/go-sockaddr v0.1.0 h1:Y4s3/jNoryVRKEBrkJ576F17CPOaMIzUeCsg7dlTDj0= github.com/libp2p/go-sockaddr v0.1.0/go.mod h1:syPvOmNs24S3dFVGJA1/mrqdeijPxLV2Le3BRLKd68k= @@ -1029,15 +990,12 @@ github.com/libp2p/go-yamux v1.2.2/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZ github.com/libp2p/go-yamux v1.2.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.0/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.3/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.3.5 h1:ibuz4naPAully0pN6J/kmUARiqLpnDQIzI/8GCOrljg= github.com/libp2p/go-yamux v1.3.5/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= -github.com/libp2p/go-yamux v1.3.6 h1:O5qcBXRcfqecvQ/My9NqDNHB3/5t58yuJYqthcKhhgE= github.com/libp2p/go-yamux v1.3.6/go.mod h1:FGTiPvoV/3DVdgWpX+tM0OW3tsM+W5bSE3gZwqQTcow= github.com/libp2p/go-yamux v1.3.7 h1:v40A1eSPJDIZwz2AvrV3cxpTZEGDP11QJbukmEhYyQI= github.com/libp2p/go-yamux v1.3.7/go.mod h1:fr7aVgmdNGJK+N1g+b6DW6VxzbRCjCOejR/hkmpooHE= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lucas-clemente/quic-go v0.11.2 h1:Mop0ac3zALaBR3wGs6j8OYe/tcFvFsxTUFMkE/7yUOI= github.com/lucas-clemente/quic-go v0.11.2/go.mod h1:PpMmPfPKO9nKJ/psF49ESTAGQSdfXxlg1otPbEB2nOw= github.com/lucas-clemente/quic-go v0.16.0 h1:jJw36wfzGJhmOhAOaOC2lS36WgeqXQszH47A7spo1LI= github.com/lucas-clemente/quic-go v0.16.0/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE= @@ -1048,7 +1006,6 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= -github.com/marten-seemann/qtls v0.2.3 h1:0yWJ43C62LsZt08vuQJDK1uC1czUc3FJeCLPoNAI4vA= github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= github.com/marten-seemann/qtls v0.9.1 h1:O0YKQxNVPaiFgMng0suWEOY2Sb4LT2sRn9Qimq3Z1IQ= github.com/marten-seemann/qtls v0.9.1/go.mod h1:T1MmAdDPyISzxlK6kjRr0pcZFBVd1OZbBb/j3cvzHhk= @@ -1061,7 +1018,6 @@ github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/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/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= @@ -1123,7 +1079,6 @@ github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lg github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= -github.com/multiformats/go-multiaddr v0.2.1 h1:SgG/cw5vqyB5QQe5FPe2TqggU9WtrA9X4nZw7LlVqOI= github.com/multiformats/go-multiaddr v0.2.1/go.mod h1:s/Apk6IyxfvMjDafnhJgJ3/46z7tZ04iMk5wP4QMGGE= github.com/multiformats/go-multiaddr v0.2.2 h1:XZLDTszBIJe6m0zF6ITBrEcZR73OPUhCBBS9rYAuUzI= github.com/multiformats/go-multiaddr v0.2.2/go.mod h1:NtfXiOtHvghW9KojvtySjH5y0u0xW5UouOmQQrn6a3Y= @@ -1144,9 +1099,7 @@ github.com/multiformats/go-multiaddr-net v0.1.3/go.mod h1:ilNnaM9HbmVFqsb/qcNysj github.com/multiformats/go-multiaddr-net v0.1.4/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= github.com/multiformats/go-multiaddr-net v0.1.5 h1:QoRKvu0xHN1FCFJcMQLbG/yQE2z441L5urvG3+qyz7g= github.com/multiformats/go-multiaddr-net v0.1.5/go.mod h1:ilNnaM9HbmVFqsb/qcNysjCu4PVONlrBZpHIrw/qQuA= -github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= -github.com/multiformats/go-multibase v0.0.2 h1:2pAgScmS1g9XjH7EtAfNhTuyrWYEWcxy0G5Wo85hWDA= github.com/multiformats/go-multibase v0.0.2/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= @@ -1188,16 +1141,13 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= @@ -1232,7 +1182,6 @@ github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= 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= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1254,7 +1203,6 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A= github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4= @@ -1271,7 +1219,6 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= @@ -1283,7 +1230,6 @@ github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.1.0 h1:jhMy6QXfi3y2HEzFoyuCj40z4OZIIHHPtFyCMftmvKA= @@ -1348,12 +1294,10 @@ github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHei github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= -github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a/go.mod h1:LeFCbQYJ3KJlPs/FvPz2dy1tkpxyeNESVyCNNzRXFR0= @@ -1378,16 +1322,13 @@ github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3 github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 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.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 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/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= @@ -1395,8 +1336,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/testground/sdk-go v0.2.3-0.20200630131002-c16b558f6ca9 h1:4whMCXEdgHQkg4i5OTE2fqDFIPbpiE5y8uOMfiGSEBg= -github.com/testground/sdk-go v0.2.3-0.20200630131002-c16b558f6ca9/go.mod h1:3auzMDXaoK7NQ+CLQS3pqp4hmREECWO9V+TJi/IWmms= +github.com/testground/sdk-go v0.2.3-0.20200630140907-cda3c5ac055b h1:W8EDNshcIaO7LaGVFc7DI9VlAnhGzRDVmGx+h9Mer8g= +github.com/testground/sdk-go v0.2.3-0.20200630140907-cda3c5ac055b/go.mod h1:3auzMDXaoK7NQ+CLQS3pqp4hmREECWO9V+TJi/IWmms= github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= diff --git a/lotus-soup/main.go b/lotus-soup/main.go index 051f51eb6..042310eb7 100644 --- a/lotus-soup/main.go +++ b/lotus-soup/main.go @@ -1,27 +1,119 @@ package main import ( + "context" "fmt" + "io/ioutil" + "math/rand" + "os" + "time" + "github.com/filecoin-project/lotus/api" "github.com/testground/sdk-go/run" - "github.com/testground/sdk-go/runtime" + + "github.com/filecoin-project/oni/lotus-soup/testkit" ) -var testplans = map[string]interface{}{ - "lotus-baseline": doRun(basicRoles), +var cases = map[string]interface{}{ + "deals-e2e": testkit.WrapTestEnvironment(dealsE2E), } func main() { - run.InvokeMap(testplans) + run.InvokeMap(cases) } -func doRun(roles map[string]func(*TestEnvironment) error) run.InitializedTestCaseFn { - return func(runenv *runtime.RunEnv, initCtx *run.InitContext) error { - role := runenv.StringParam("role") - proc, ok := roles[role] - if ok { - return proc(&TestEnvironment{RunEnv: runenv, InitContext: initCtx}) - } - return fmt.Errorf("Unknown role: %s", role) +// This is the baseline test; Filecoin 101. +// +// A network with a bootstrapper, a number of miners, and a number of clients/full nodes +// is constructed and connected through the bootstrapper. +// Some funds are allocated to each node and a number of sectors are presealed in the genesis block. +// +// The test plan: +// One or more clients store content to one or more miners, testing storage deals. +// The plan ensures that the storage deals hit the blockchain and measure the time it took. +// Verification: one or more clients retrieve and verify the hashes of stored content. +// The plan ensures that all (previously) published content can be correctly retrieved +// and measures the time it took. +// +// Preparation of the genesis block: this is the responsibility of the bootstrapper. +// In order to compute the genesis block, we need to collect identities and presealed +// sectors from each node. +// Then we create a genesis block that allocates some funds to each node and collects +// the presealed sectors. +func dealsE2E(t *testkit.TestEnvironment) error { + // Dispatch/forward non-client roles to defaults. + if t.Role != "client" { + return testkit.HandleDefaultRole(t) } + + cl, err := testkit.PrepareClient(t) + if err != nil { + return err + } + + // This is a client role + t.RecordMessage("running client") + + ctx := context.Background() + client := cl.FullApi + + // select a random miner + minerAddr := cl.MinerAddrs[rand.Intn(len(cl.MinerAddrs))] + if err := client.NetConnect(ctx, minerAddr.PeerAddr); err != nil { + return err + } + t.D().Counter(fmt.Sprintf("send-data-to,miner=%s", minerAddr.ActorAddr)).Inc(1) + + t.RecordMessage("selected %s as the miner", minerAddr.ActorAddr) + + time.Sleep(2 * time.Second) + + // generate 1600 bytes of random data + data := make([]byte, 1600) + rand.New(rand.NewSource(time.Now().UnixNano())).Read(data) + + file, err := ioutil.TempFile("/tmp", "data") + if err != nil { + return err + } + defer os.Remove(file.Name()) + + _, err = file.Write(data) + if err != nil { + return err + } + + fcid, err := client.ClientImport(ctx, api.FileRef{Path: file.Name(), IsCAR: false}) + if err != nil { + return err + } + t.RecordMessage("file cid: %s", fcid) + + // start deal + t1 := time.Now() + deal := testkit.StartDeal(ctx, minerAddr.ActorAddr, client, fcid) + t.RecordMessage("started deal: %s", deal) + + // TODO: this sleep is only necessary because deals don't immediately get logged in the dealstore, we should fix this + time.Sleep(2 * time.Second) + + t.RecordMessage("waiting for deal to be sealed") + testkit.WaitDealSealed(t, ctx, client, deal) + t.D().ResettingHistogram("deal.sealed").Update(int64(time.Since(t1))) + + carExport := true + + t.RecordMessage("trying to retrieve %s", fcid) + testkit.RetrieveData(t, ctx, err, client, fcid, carExport, data) + t.D().ResettingHistogram("deal.retrieved").Update(int64(time.Since(t1))) + + t.SyncClient.MustSignalEntry(ctx, testkit.StateStopMining) + + time.Sleep(10 * time.Second) // wait for metrics to be emitted + + // TODO broadcast published content CIDs to other clients + // TODO select a random piece of content published by some other client and retrieve it + + t.SyncClient.MustSignalAndWait(ctx, testkit.StateDone, t.TestInstanceCount) + return nil } diff --git a/lotus-soup/manifest.toml b/lotus-soup/manifest.toml index 7227fdd35..291b7a76f 100644 --- a/lotus-soup/manifest.toml +++ b/lotus-soup/manifest.toml @@ -17,15 +17,15 @@ enabled = true enabled = true [[testcases]] -name = "lotus-baseline" +name = "deals-e2e" instances = { min = 1, max = 100, default = 5 } [testcases.params] - clients = { type = "int", default = 1 } - miners = { type = "int", default = 1 } - balance = { type = "int", default = 1 } - sectors = { type = "int", default = 1 } - role = { type = "string" } + clients = { type = "int", default = 1 } + miners = { type = "int", default = 1 } + balance = { type = "int", default = 1 } + sectors = { type = "int", default = 1 } + role = { type = "string" } genesis_timestamp_offset = { type = "int", default = 0 } @@ -35,9 +35,9 @@ instances = { min = 1, max = 100, default = 5 } # in the same composition group. There must be at least threshold drand nodes. # To get lotus nodes to actually use the drand nodes, you must set random_beacon_type="local-drand" # for the lotus node groups. - drand_period = { type = "duration", default="10s" } - drand_threshold = { type = "int", default = 2 } - drand_gossip_relay = { type = "bool", default = true } + drand_period = { type = "duration", default="10s" } + drand_threshold = { type = "int", default = 2 } + drand_gossip_relay = { type = "bool", default = true } # Params relevant to pubsub tracing enable_pubsub_tracer = { type = "bool", default = false } diff --git a/lotus-soup/role_client.go b/lotus-soup/role_client.go deleted file mode 100644 index b3cbe4b02..000000000 --- a/lotus-soup/role_client.go +++ /dev/null @@ -1,194 +0,0 @@ -package main - -import ( - "context" - "fmt" - "io/ioutil" - "math/rand" - "net/http" - "os" - "time" - - "github.com/filecoin-project/go-jsonrpc" - "github.com/filecoin-project/go-jsonrpc/auth" - "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/api/apistruct" - "github.com/filecoin-project/lotus/chain/wallet" - "github.com/filecoin-project/lotus/node" - "github.com/filecoin-project/lotus/node/repo" - - "github.com/filecoin-project/specs-actors/actors/crypto" -) - -func runBaselineClient(t *TestEnvironment) error { - t.RecordMessage("running client") - cl, err := prepareClient(t) - if err != nil { - return err - } - - ctx := context.Background() - addrs, err := collectMinerAddrs(t, ctx, t.IntParam("miners")) - if err != nil { - return err - } - t.RecordMessage("got %v miner addrs", len(addrs)) - - client := cl.fullApi - - // select a random miner - minerAddr := addrs[rand.Intn(len(addrs))] - if err := client.NetConnect(ctx, minerAddr.PeerAddr); err != nil { - return err - } - t.D().Counter(fmt.Sprintf("send-data-to,miner=%s", minerAddr.ActorAddr)).Inc(1) - - t.RecordMessage("selected %s as the miner", minerAddr.ActorAddr) - - time.Sleep(2 * time.Second) - - // generate 1600 bytes of random data - data := make([]byte, 1600) - rand.New(rand.NewSource(time.Now().UnixNano())).Read(data) - - file, err := ioutil.TempFile("/tmp", "data") - if err != nil { - return err - } - defer os.Remove(file.Name()) - - _, err = file.Write(data) - if err != nil { - return err - } - - fcid, err := client.ClientImport(ctx, api.FileRef{Path: file.Name(), IsCAR: false}) - if err != nil { - return err - } - t.RecordMessage("file cid: %s", fcid) - - // start deal - t1 := time.Now() - deal := startDeal(ctx, minerAddr.ActorAddr, client, fcid) - t.RecordMessage("started deal: %s", deal) - - // TODO: this sleep is only necessary because deals don't immediately get logged in the dealstore, we should fix this - time.Sleep(2 * time.Second) - - t.RecordMessage("waiting for deal to be sealed") - waitDealSealed(t, ctx, client, deal) - t.D().ResettingHistogram("deal.sealed").Update(int64(time.Since(t1))) - - carExport := true - - t.RecordMessage("trying to retrieve %s", fcid) - retrieveData(t, ctx, err, client, fcid, carExport, data) - t.D().ResettingHistogram("deal.retrieved").Update(int64(time.Since(t1))) - - t.SyncClient.MustSignalEntry(ctx, stateStopMining) - - time.Sleep(10 * time.Second) // wait for metrics to be emitted - - // TODO broadcast published content CIDs to other clients - // TODO select a random piece of content published by some other client and retrieve it - - t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount) - return nil -} - -func prepareClient(t *TestEnvironment) (*Node, error) { - ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout) - defer cancel() - - pubsubTracer, err := getPubsubTracerMaddr(ctx, t) - if err != nil { - return nil, err - } - - drandOpt, err := getDrandOpts(ctx, t) - if err != nil { - return nil, err - } - - // first create a wallet - walletKey, err := wallet.GenerateKey(crypto.SigTypeBLS) - if err != nil { - return nil, err - } - - // publish the account ID/balance - balance := t.IntParam("balance") - balanceMsg := &InitialBalanceMsg{Addr: walletKey.Address, Balance: balance} - t.SyncClient.Publish(ctx, balanceTopic, balanceMsg) - - // then collect the genesis block and bootstrapper address - genesisMsg, err := waitForGenesis(t, ctx) - if err != nil { - return nil, err - } - - clientIP := t.NetClient.MustGetDataNetworkIP().String() - - nodeRepo := repo.NewMemory(nil) - - // create the node - n := &Node{} - stop, err := node.New(context.Background(), - node.FullAPI(&n.fullApi), - node.Online(), - node.Repo(nodeRepo), - withApiEndpoint("/ip4/127.0.0.1/tcp/1234"), - withGenesis(genesisMsg.Genesis), - withListenAddress(clientIP), - withBootstrapper(genesisMsg.Bootstrapper), - withPubsubConfig(false, pubsubTracer), - drandOpt, - ) - if err != nil { - return nil, err - } - n.stop = stop - - // set the wallet - err = n.setWallet(ctx, walletKey) - if err != nil { - stop(context.TODO()) - return nil, err - } - - err = startClientAPIServer(nodeRepo, n.fullApi) - if err != nil { - return nil, err - } - - registerAndExportMetrics(fmt.Sprintf("client_%d", t.GroupSeq)) - - t.RecordMessage("publish our address to the clients addr topic") - addrinfo, err := n.fullApi.NetAddrsListen(ctx) - if err != nil { - return nil, err - } - t.SyncClient.MustPublish(ctx, clientsAddrsTopic, addrinfo) - - t.RecordMessage("waiting for all nodes to be ready") - t.SyncClient.MustSignalAndWait(ctx, stateReady, t.TestInstanceCount) - - return n, nil -} - -func startClientAPIServer(repo *repo.MemRepo, api api.FullNode) error { - rpcServer := jsonrpc.NewServer() - rpcServer.Register("Filecoin", apistruct.PermissionedFullAPI(api)) - - ah := &auth.Handler{ - Verify: api.AuthVerify, - Next: rpcServer.ServeHTTP, - } - - http.Handle("/rpc/v0", ah) - - srv := &http.Server{Handler: http.DefaultServeMux} - - return startServer(repo, srv) -} diff --git a/lotus-soup/roles.go b/lotus-soup/roles.go deleted file mode 100644 index a5d77db5a..000000000 --- a/lotus-soup/roles.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -// This is the baseline test; Filecoin 101. -// -// A network with a bootstrapper, a number of miners, and a number of clients/full nodes -// is constructed and connected through the bootstrapper. -// Some funds are allocated to each node and a number of sectors are presealed in the genesis block. -// -// The test plan: -// One or more clients store content to one or more miners, testing storage deals. -// The plan ensures that the storage deals hit the blockchain and measure the time it took. -// Verification: one or more clients retrieve and verify the hashes of stored content. -// The plan ensures that all (previously) published content can be correctly retrieved -// and measures the time it took. -// -// Preparation of the genesis block: this is the responsibility of the bootstrapper. -// In order to compute the genesis block, we need to collect identities and presealed -// sectors from each node. -// Then we create a genesis block that allocates some funds to each node and collects -// the presealed sectors. -var basicRoles = map[string]func(*TestEnvironment) error{ - "bootstrapper": runBootstrapper, - "miner": runMiner, - "client": runBaselineClient, - "drand": runDrandNode, - "pubsub-tracer": runPubsubTracer, -} diff --git a/lotus-soup/deals.go b/lotus-soup/testkit/deals.go similarity index 89% rename from lotus-soup/deals.go rename to lotus-soup/testkit/deals.go index 5ae2699a5..f019aca81 100644 --- a/lotus-soup/deals.go +++ b/lotus-soup/testkit/deals.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "context" @@ -12,7 +12,7 @@ import ( "github.com/ipfs/go-cid" ) -func startDeal(ctx context.Context, minerActorAddr address.Address, client api.FullNode, fcid cid.Cid) *cid.Cid { +func StartDeal(ctx context.Context, minerActorAddr address.Address, client api.FullNode, fcid cid.Cid) *cid.Cid { addr, err := client.WalletDefaultAddress(ctx) if err != nil { panic(err) @@ -31,7 +31,7 @@ func startDeal(ctx context.Context, minerActorAddr address.Address, client api.F return deal } -func waitDealSealed(t *TestEnvironment, ctx context.Context, client api.FullNode, deal *cid.Cid) { +func WaitDealSealed(t *TestEnvironment, ctx context.Context, client api.FullNode, deal *cid.Cid) { loop: for { di, err := client.ClientGetDealInfo(ctx, *deal) diff --git a/lotus-soup/testkit/defaults.go b/lotus-soup/testkit/defaults.go new file mode 100644 index 000000000..a0681f37c --- /dev/null +++ b/lotus-soup/testkit/defaults.go @@ -0,0 +1,55 @@ +package testkit + +import "fmt" + +type RoleName = string + +var DefaultRoles = map[RoleName]func(*TestEnvironment) error{ + "bootstrapper": func(t *TestEnvironment) error { + b, err := PrepareBootstrapper(t) + if err != nil { + return err + } + return b.RunDefault() + }, + "miner": func(t *TestEnvironment) error { + m, err := PrepareMiner(t) + if err != nil { + return err + } + return m.RunDefault() + }, + "client": func(t *TestEnvironment) error { + c, err := PrepareClient(t) + if err != nil { + return err + } + return c.RunDefault() + }, + "drand": func(t *TestEnvironment) error { + d, err := PrepareDrandInstance(t) + if err != nil { + return err + } + return d.RunDefault() + }, + "pubsub-tracer": func(t *TestEnvironment) error { + tr, err := PreparePubsubTracer(t) + if err != nil { + return err + } + return tr.RunDefault() + }, +} + +// HandleDefaultRole handles a role by running its default behaviour. +// +// This function is suitable to forward to when a test case doesn't need to +// explicitly handle/alter a role. +func HandleDefaultRole(t *TestEnvironment) error { + f, ok := DefaultRoles[t.Role] + if !ok { + panic(fmt.Sprintf("unrecognized role: %s", t.Role)) + } + return f(t) +} diff --git a/lotus-soup/lotus_opts.go b/lotus-soup/testkit/lotus_opts.go similarity index 99% rename from lotus-soup/lotus_opts.go rename to lotus-soup/testkit/lotus_opts.go index a02befb56..baf93bc71 100644 --- a/lotus-soup/lotus_opts.go +++ b/lotus-soup/testkit/lotus_opts.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "fmt" diff --git a/lotus-soup/node.go b/lotus-soup/testkit/node.go similarity index 75% rename from lotus-soup/node.go rename to lotus-soup/testkit/node.go index 95a628607..83427a1a3 100644 --- a/lotus-soup/node.go +++ b/lotus-soup/testkit/node.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "context" @@ -6,7 +6,6 @@ import ( "net/http" "os" "sort" - "strings" "time" "github.com/filecoin-project/lotus/api" @@ -28,16 +27,14 @@ import ( "github.com/libp2p/go-libp2p-core/peer" manet "github.com/multiformats/go-multiaddr-net" - "github.com/testground/sdk-go/run" - "github.com/testground/sdk-go/runtime" "go.opencensus.io/stats" "go.opencensus.io/stats/view" ) func init() { - logging.SetLogLevel("*", "ERROR") + _ = logging.SetLogLevel("*", "ERROR") - os.Setenv("BELLMAN_NO_GPU", "1") + _ = os.Setenv("BELLMAN_NO_GPU", "1") build.InsecurePoStValidation = true build.DisableBuiltinAssets = true @@ -51,38 +48,20 @@ func init() { var PrepareNodeTimeout = time.Minute -type TestEnvironment struct { - *runtime.RunEnv - *run.InitContext -} - -// workaround for default params being wrapped in quote chars -func (t *TestEnvironment) StringParam(name string) string { - return strings.Trim(t.RunEnv.StringParam(name), "\"") -} - -func (t *TestEnvironment) DurationParam(name string) time.Duration { - d, err := time.ParseDuration(t.StringParam(name)) - if err != nil { - panic(fmt.Errorf("invalid duration value for param '%s': %w", name, err)) - } - return d -} - -type Node struct { - fullApi api.FullNode - minerApi api.StorageMiner - stop node.StopFunc +type LotusNode struct { + FullApi api.FullNode + MinerApi api.StorageMiner + StopFn node.StopFunc MineOne func(context.Context, func(bool)) error } -func (n *Node) setWallet(ctx context.Context, walletKey *wallet.Key) error { - _, err := n.fullApi.WalletImport(ctx, &walletKey.KeyInfo) +func (n *LotusNode) setWallet(ctx context.Context, walletKey *wallet.Key) error { + _, err := n.FullApi.WalletImport(ctx, &walletKey.KeyInfo) if err != nil { return err } - err = n.fullApi.WalletSetDefault(ctx, walletKey.Address) + err = n.FullApi.WalletSetDefault(ctx, walletKey.Address) if err != nil { return err } @@ -90,9 +69,9 @@ func (n *Node) setWallet(ctx context.Context, walletKey *wallet.Key) error { return nil } -func waitForBalances(t *TestEnvironment, ctx context.Context, nodes int) ([]*InitialBalanceMsg, error) { +func WaitForBalances(t *TestEnvironment, ctx context.Context, nodes int) ([]*InitialBalanceMsg, error) { ch := make(chan *InitialBalanceMsg) - sub := t.SyncClient.MustSubscribe(ctx, balanceTopic, ch) + sub := t.SyncClient.MustSubscribe(ctx, BalanceTopic, ch) balances := make([]*InitialBalanceMsg, 0, nodes) for i := 0; i < nodes; i++ { @@ -107,9 +86,9 @@ func waitForBalances(t *TestEnvironment, ctx context.Context, nodes int) ([]*Ini return balances, nil } -func collectPreseals(t *TestEnvironment, ctx context.Context, miners int) ([]*PresealMsg, error) { +func CollectPreseals(t *TestEnvironment, ctx context.Context, miners int) ([]*PresealMsg, error) { ch := make(chan *PresealMsg) - sub := t.SyncClient.MustSubscribe(ctx, presealTopic, ch) + sub := t.SyncClient.MustSubscribe(ctx, PresealTopic, ch) preseals := make([]*PresealMsg, 0, miners) for i := 0; i < miners; i++ { @@ -128,9 +107,9 @@ func collectPreseals(t *TestEnvironment, ctx context.Context, miners int) ([]*Pr return preseals, nil } -func waitForGenesis(t *TestEnvironment, ctx context.Context) (*GenesisMsg, error) { +func WaitForGenesis(t *TestEnvironment, ctx context.Context) (*GenesisMsg, error) { genesisCh := make(chan *GenesisMsg) - sub := t.SyncClient.MustSubscribe(ctx, genesisTopic, genesisCh) + sub := t.SyncClient.MustSubscribe(ctx, GenesisTopic, genesisCh) select { case genesisMsg := <-genesisCh: @@ -140,9 +119,9 @@ func waitForGenesis(t *TestEnvironment, ctx context.Context) (*GenesisMsg, error } } -func collectMinerAddrs(t *TestEnvironment, ctx context.Context, miners int) ([]MinerAddressesMsg, error) { +func CollectMinerAddrs(t *TestEnvironment, ctx context.Context, miners int) ([]MinerAddressesMsg, error) { ch := make(chan MinerAddressesMsg) - sub := t.SyncClient.MustSubscribe(ctx, minersAddrsTopic, ch) + sub := t.SyncClient.MustSubscribe(ctx, MinersAddrsTopic, ch) addrs := make([]MinerAddressesMsg, 0, miners) for i := 0; i < miners; i++ { @@ -157,9 +136,9 @@ func collectMinerAddrs(t *TestEnvironment, ctx context.Context, miners int) ([]M return addrs, nil } -func collectClientAddrs(t *TestEnvironment, ctx context.Context, clients int) ([]peer.AddrInfo, error) { +func CollectClientAddrs(t *TestEnvironment, ctx context.Context, clients int) ([]peer.AddrInfo, error) { ch := make(chan peer.AddrInfo) - sub := t.SyncClient.MustSubscribe(ctx, clientsAddrsTopic, ch) + sub := t.SyncClient.MustSubscribe(ctx, ClientsAddrsTopic, ch) addrs := make([]peer.AddrInfo, 0, clients) for i := 0; i < clients; i++ { @@ -174,13 +153,13 @@ func collectClientAddrs(t *TestEnvironment, ctx context.Context, clients int) ([ return addrs, nil } -func getPubsubTracerMaddr(ctx context.Context, t *TestEnvironment) (string, error) { +func GetPubsubTracerMaddr(ctx context.Context, t *TestEnvironment) (string, error) { if !t.BooleanParam("enable_pubsub_tracer") { return "", nil } ch := make(chan *PubsubTracerMsg) - sub := t.SyncClient.MustSubscribe(ctx, pubsubTracerTopic, ch) + sub := t.SyncClient.MustSubscribe(ctx, PubsubTracerTopic, ch) select { case m := <-ch: @@ -190,7 +169,7 @@ func getPubsubTracerMaddr(ctx context.Context, t *TestEnvironment) (string, erro } } -func getDrandOpts(ctx context.Context, t *TestEnvironment) (node.Option, error) { +func GetRandomBeaconOpts(ctx context.Context, t *TestEnvironment) (node.Option, error) { beaconType := t.StringParam("random_beacon_type") switch beaconType { case "external-drand": diff --git a/lotus-soup/retrieval.go b/lotus-soup/testkit/retrieval.go similarity index 91% rename from lotus-soup/retrieval.go rename to lotus-soup/testkit/retrieval.go index 97cadaca6..352cf513d 100644 --- a/lotus-soup/retrieval.go +++ b/lotus-soup/testkit/retrieval.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "bytes" @@ -19,7 +19,7 @@ import ( "github.com/ipld/go-car" ) -func retrieveData(t *TestEnvironment, ctx context.Context, err error, client api.FullNode, fcid cid.Cid, carExport bool, data []byte) { +func RetrieveData(t *TestEnvironment, ctx context.Context, err error, client api.FullNode, fcid cid.Cid, carExport bool, data []byte) { t1 := time.Now() offers, err := client.ClientFindData(ctx, fcid) if err != nil { @@ -62,7 +62,7 @@ func retrieveData(t *TestEnvironment, ctx context.Context, err error, client api } if carExport { - rdata = extractCarData(ctx, rdata, rpath) + rdata = ExtractCarData(ctx, rdata, rpath) } if !bytes.Equal(rdata, data) { @@ -72,7 +72,7 @@ func retrieveData(t *TestEnvironment, ctx context.Context, err error, client api t.RecordMessage("retrieved successfully") } -func extractCarData(ctx context.Context, rdata []byte, rpath string) []byte { +func ExtractCarData(ctx context.Context, rdata []byte, rpath string) []byte { bserv := dstest.Bserv() ch, err := car.LoadCar(bserv.Blockstore(), bytes.NewReader(rdata)) if err != nil { diff --git a/lotus-soup/role_bootstrapper.go b/lotus-soup/testkit/role_bootstrapper.go similarity index 74% rename from lotus-soup/role_bootstrapper.go rename to lotus-soup/testkit/role_bootstrapper.go index a6bfa42c3..d7d6e293b 100644 --- a/lotus-soup/role_bootstrapper.go +++ b/lotus-soup/testkit/role_bootstrapper.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "bytes" @@ -19,45 +19,43 @@ import ( ma "github.com/multiformats/go-multiaddr" ) -func runBootstrapper(t *TestEnvironment) error { - t.RecordMessage("running bootstrapper") - _, err := prepareBootstrapper(t) - if err != nil { - return err - } +// Bootstrapper is a special kind of process that produces a genesis block with +// the initial wallet balances and preseals for all enlisted miners and clients. +type Bootstrapper struct { + *LotusNode - ctx := context.Background() - t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount) - return nil + t *TestEnvironment } -func prepareBootstrapper(t *TestEnvironment) (*Node, error) { +func PrepareBootstrapper(t *TestEnvironment) (*Bootstrapper, error) { + var ( + clients = t.IntParam("clients") + miners = t.IntParam("miners") + nodes = clients + miners + ) + ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout) defer cancel() - pubsubTracer, err := getPubsubTracerMaddr(ctx, t) + pubsubTracerMaddr, err := GetPubsubTracerMaddr(ctx, t) if err != nil { return nil, err } - clients := t.IntParam("clients") - miners := t.IntParam("miners") - nodes := clients + miners - - drandOpt, err := getDrandOpts(ctx, t) + randomBeaconOpt, err := GetRandomBeaconOpts(ctx, t) if err != nil { return nil, err } // the first duty of the boostrapper is to construct the genesis block // first collect all client and miner balances to assign initial funds - balances, err := waitForBalances(t, ctx, nodes) + balances, err := WaitForBalances(t, ctx, nodes) if err != nil { return nil, err } // then collect all preseals from miners - preseals, err := collectPreseals(t, ctx, miners) + preseals, err := CollectPreseals(t, ctx, miners) if err != nil { return nil, err } @@ -101,26 +99,26 @@ func prepareBootstrapper(t *TestEnvironment) (*Node, error) { bootstrapperIP := t.NetClient.MustGetDataNetworkIP().String() - n := &Node{} + n := &LotusNode{} stop, err := node.New(context.Background(), - node.FullAPI(&n.fullApi), + node.FullAPI(&n.FullApi), node.Online(), node.Repo(repo.NewMemory(nil)), node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genesisBuffer, genesisTemplate)), withApiEndpoint("/ip4/127.0.0.1/tcp/1234"), withListenAddress(bootstrapperIP), withBootstrapper(nil), - withPubsubConfig(true, pubsubTracer), - drandOpt, + withPubsubConfig(true, pubsubTracerMaddr), + randomBeaconOpt, ) if err != nil { return nil, err } - n.stop = stop + n.StopFn = stop var bootstrapperAddr ma.Multiaddr - bootstrapperAddrs, err := n.fullApi.NetAddrsListen(ctx) + bootstrapperAddrs, err := n.FullApi.NetAddrsListen(ctx) if err != nil { stop(context.TODO()) return nil, err @@ -152,10 +150,18 @@ func prepareBootstrapper(t *TestEnvironment) (*Node, error) { Genesis: genesisBuffer.Bytes(), Bootstrapper: bootstrapperAddr.Bytes(), } - t.SyncClient.MustPublish(ctx, genesisTopic, genesisMsg) + t.SyncClient.MustPublish(ctx, GenesisTopic, genesisMsg) t.RecordMessage("waiting for all nodes to be ready") - t.SyncClient.MustSignalAndWait(ctx, stateReady, t.TestInstanceCount) + t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount) - return n, nil + return &Bootstrapper{n, t}, nil +} + +// RunDefault runs a default bootstrapper. +func (b *Bootstrapper) RunDefault() error { + b.t.RecordMessage("running bootstrapper") + ctx := context.Background() + b.t.SyncClient.MustSignalAndWait(ctx, StateDone, b.t.TestInstanceCount) + return nil } diff --git a/lotus-soup/testkit/role_client.go b/lotus-soup/testkit/role_client.go new file mode 100644 index 000000000..399023306 --- /dev/null +++ b/lotus-soup/testkit/role_client.go @@ -0,0 +1,139 @@ +package testkit + +import ( + "context" + "fmt" + "net/http" + + "github.com/filecoin-project/go-jsonrpc" + "github.com/filecoin-project/go-jsonrpc/auth" + "github.com/filecoin-project/lotus/api" + "github.com/filecoin-project/lotus/api/apistruct" + "github.com/filecoin-project/lotus/chain/wallet" + "github.com/filecoin-project/lotus/node" + "github.com/filecoin-project/lotus/node/repo" + + "github.com/filecoin-project/specs-actors/actors/crypto" +) + +type LotusClient struct { + *LotusNode + + t *TestEnvironment + MinerAddrs []MinerAddressesMsg +} + +func PrepareClient(t *TestEnvironment) (*LotusClient, error) { + ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout) + defer cancel() + + pubsubTracer, err := GetPubsubTracerMaddr(ctx, t) + if err != nil { + return nil, err + } + + drandOpt, err := GetRandomBeaconOpts(ctx, t) + if err != nil { + return nil, err + } + + // first create a wallet + walletKey, err := wallet.GenerateKey(crypto.SigTypeBLS) + if err != nil { + return nil, err + } + + // publish the account ID/balance + balance := t.IntParam("balance") + balanceMsg := &InitialBalanceMsg{Addr: walletKey.Address, Balance: balance} + t.SyncClient.Publish(ctx, BalanceTopic, balanceMsg) + + // then collect the genesis block and bootstrapper address + genesisMsg, err := WaitForGenesis(t, ctx) + if err != nil { + return nil, err + } + + clientIP := t.NetClient.MustGetDataNetworkIP().String() + + nodeRepo := repo.NewMemory(nil) + + // create the node + n := &LotusNode{} + stop, err := node.New(context.Background(), + node.FullAPI(&n.FullApi), + node.Online(), + node.Repo(nodeRepo), + withApiEndpoint("/ip4/127.0.0.1/tcp/1234"), + withGenesis(genesisMsg.Genesis), + withListenAddress(clientIP), + withBootstrapper(genesisMsg.Bootstrapper), + withPubsubConfig(false, pubsubTracer), + drandOpt, + ) + if err != nil { + return nil, err + } + n.StopFn = stop + + // set the wallet + err = n.setWallet(ctx, walletKey) + if err != nil { + _ = stop(context.TODO()) + return nil, err + } + + err = startClientAPIServer(nodeRepo, n.FullApi) + if err != nil { + return nil, err + } + + registerAndExportMetrics(fmt.Sprintf("client_%d", t.GroupSeq)) + + t.RecordMessage("publish our address to the clients addr topic") + addrinfo, err := n.FullApi.NetAddrsListen(ctx) + if err != nil { + return nil, err + } + t.SyncClient.MustPublish(ctx, ClientsAddrsTopic, addrinfo) + + t.RecordMessage("waiting for all nodes to be ready") + t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount) + + // collect miner addresses. + addrs, err := CollectMinerAddrs(t, ctx, t.IntParam("miners")) + if err != nil { + return nil, err + } + t.RecordMessage("got %v miner addrs", len(addrs)) + + cl := &LotusClient{ + t: t, + LotusNode: n, + MinerAddrs: addrs, + } + return cl, nil +} + +func (c *LotusClient) RunDefault() error { + // run forever + c.t.RecordMessage("running default client forever") + c.t.WaitUntilAllDone() + return nil +} + +func startClientAPIServer(repo *repo.MemRepo, api api.FullNode) error { + rpcServer := jsonrpc.NewServer() + rpcServer.Register("Filecoin", apistruct.PermissionedFullAPI(api)) + + ah := &auth.Handler{ + Verify: api.AuthVerify, + Next: rpcServer.ServeHTTP, + } + + http.Handle("/rpc/v0", ah) + + srv := &http.Server{Handler: http.DefaultServeMux} + + return startServer(repo, srv) +} diff --git a/lotus-soup/role_drand.go b/lotus-soup/testkit/role_drand.go similarity index 87% rename from lotus-soup/role_drand.go rename to lotus-soup/testkit/role_drand.go index bd855c69a..ec285b9f9 100644 --- a/lotus-soup/role_drand.go +++ b/lotus-soup/testkit/role_drand.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "bytes" @@ -26,6 +26,8 @@ import ( var PrepareDrandTimeout = time.Minute type DrandInstance struct { + t *TestEnvironment + Node node.Node GossipRelay *lp2p.GossipRelayNode @@ -36,40 +38,38 @@ func (d *DrandInstance) Cleanup() error { return os.RemoveAll(d.stateDir) } -func runDrandNode(t *TestEnvironment) error { - t.RecordMessage("running drand node") - dr, err := prepareDrandNode(t) - if err != nil { - return err - } - defer dr.Cleanup() +func (d *DrandInstance) RunDefault() error { + d.t.RecordMessage("running drand node") + defer d.Cleanup() // TODO add ability to halt / recover on demand - ctx := context.Background() - t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount) + d.t.WaitUntilAllDone() return nil } -// prepareDrandNode starts a drand instance and runs a DKG with the other members of the composition group. -// Once the chain is running, the leader publishes the chain info needed by lotus nodes on -// drandConfigTopic -func prepareDrandNode(t *TestEnvironment) (*DrandInstance, error) { +// PrepareDrandInstance starts a drand instance and runs a DKG with the other +// members of the composition group. +// +// Once the chain is running, the leader publishes the chain info needed by +// lotus nodes on DrandConfigTopic. +func PrepareDrandInstance(t *TestEnvironment) (*DrandInstance, error) { + var ( + startTime = time.Now() + seq = t.GroupSeq + isLeader = seq == 1 + nNodes = t.TestGroupInstanceCount + + myAddr = t.NetClient.MustGetDataNetworkIP() + period = t.DurationParam("drand_period") + threshold = t.IntParam("drand_threshold") + runGossipRelay = t.BooleanParam("drand_gossip_relay") + + beaconOffset = 3 + ) + ctx, cancel := context.WithTimeout(context.Background(), PrepareDrandTimeout) defer cancel() - startTime := time.Now() - - seq := t.GroupSeq - isLeader := seq == 1 - nNodes := t.TestGroupInstanceCount - - myAddr := t.NetClient.MustGetDataNetworkIP() - period := t.DurationParam("drand_period") - threshold := t.IntParam("drand_threshold") - runGossipRelay := t.BooleanParam("drand_gossip_relay") - - beaconOffset := 3 - stateDir, err := ioutil.TempDir("", fmt.Sprintf("drand-%d", t.GroupSeq)) if err != nil { return nil, err @@ -85,6 +85,7 @@ func prepareDrandNode(t *TestEnvironment) (*DrandInstance, error) { PublicAddr string IsLeader bool } + addrTopic := sync.NewTopic("drand-addrs", &NodeAddr{}) var publicAddrs []string var leaderAddr string @@ -94,6 +95,7 @@ func prepareDrandNode(t *TestEnvironment) (*DrandInstance, error) { PublicAddr: n.PublicAddr(), IsLeader: isLeader, }, ch) + for i := 0; i < nNodes; i++ { select { case msg := <-ch: @@ -105,6 +107,7 @@ func prepareDrandNode(t *TestEnvironment) (*DrandInstance, error) { return nil, fmt.Errorf("unable to read drand addrs from sync service: %w", err) } } + if leaderAddr == "" { return nil, fmt.Errorf("got %d drand addrs, but no leader", len(publicAddrs)) } @@ -216,10 +219,11 @@ func prepareDrandNode(t *TestEnvironment) (*DrandInstance, error) { } dump, _ := json.Marshal(cfg) t.RecordMessage("publishing drand config on sync topic: %s", string(dump)) - t.SyncClient.MustPublish(ctx, drandConfigTopic, &cfg) + t.SyncClient.MustPublish(ctx, DrandConfigTopic, &cfg) } return &DrandInstance{ + t: t, Node: n, GossipRelay: gossipRelay, stateDir: stateDir, @@ -230,7 +234,7 @@ func prepareDrandNode(t *TestEnvironment) (*DrandInstance, error) { // you can use the returned dtypes.DrandConfig to override the default production config. func waitForDrandConfig(ctx context.Context, client sync.Client) (*DrandRuntimeInfo, error) { ch := make(chan *DrandRuntimeInfo, 1) - sub := client.MustSubscribe(ctx, drandConfigTopic, ch) + sub := client.MustSubscribe(ctx, DrandConfigTopic, ch) select { case cfg := <-ch: return cfg, nil diff --git a/lotus-soup/role_miner.go b/lotus-soup/testkit/role_miner.go similarity index 80% rename from lotus-soup/role_miner.go rename to lotus-soup/testkit/role_miner.go index fa022592c..200d0ef39 100644 --- a/lotus-soup/role_miner.go +++ b/lotus-soup/testkit/role_miner.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "context" @@ -24,101 +24,33 @@ import ( "github.com/filecoin-project/lotus/node/impl" "github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/repo" - "github.com/gorilla/mux" - libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto" - "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/builtin" saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/specs-actors/actors/crypto" - + "github.com/gorilla/mux" "github.com/ipfs/go-datastore" + libp2pcrypto "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/peer" - "github.com/testground/sdk-go/sync" ) -func runMiner(t *TestEnvironment) error { - t.RecordMessage("running miner") - miner, err := prepareMiner(t) - if err != nil { - return err - } +type LotusMiner struct { + *LotusNode - t.RecordMessage("block delay: %v", build.BlockDelay) - t.D().Gauge("miner.block-delay").Update(build.BlockDelay) - - ctx := context.Background() - - clients := t.IntParam("clients") - miners := t.IntParam("miners") - - myActorAddr, err := miner.minerApi.ActorAddress(ctx) - if err != nil { - return err - } - - // mine / stop mining - mine := true - done := make(chan struct{}) - - if miner.MineOne != nil { - go func() { - defer t.RecordMessage("shutting down mining") - defer close(done) - - var i int - for i = 0; mine; i++ { - // synchronize all miners to mine the next block - t.RecordMessage("synchronizing all miners to mine next block [%d]", i) - stateMineNext := sync.State(fmt.Sprintf("mine-block-%d", i)) - t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners) - - ch := make(chan struct{}) - err := miner.MineOne(ctx, func(mined bool) { - if mined { - t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1) - } - close(ch) - }) - if err != nil { - panic(err) - } - <-ch - } - - // signal the last block to make sure no miners are left stuck waiting for the next block signal - // while the others have stopped - stateMineLast := sync.State(fmt.Sprintf("mine-block-%d", i)) - t.SyncClient.MustSignalEntry(ctx, stateMineLast) - }() - } else { - close(done) - } - - // wait for a signal from all clients to stop mining - err = <-t.SyncClient.MustBarrier(ctx, stateStopMining, clients).C - if err != nil { - return err - } - - mine = false - <-done - - t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount) - return nil + t *TestEnvironment } -func prepareMiner(t *TestEnvironment) (*Node, error) { +func PrepareMiner(t *TestEnvironment) (*LotusMiner, error) { ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout) defer cancel() - pubsubTracer, err := getPubsubTracerMaddr(ctx, t) + pubsubTracer, err := GetPubsubTracerMaddr(ctx, t) if err != nil { return nil, err } - drandOpt, err := getDrandOpts(ctx, t) + drandOpt, err := GetRandomBeaconOpts(ctx, t) if err != nil { return nil, err } @@ -132,10 +64,10 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { // publish the account ID/balance balance := t.IntParam("balance") balanceMsg := &InitialBalanceMsg{Addr: walletKey.Address, Balance: balance} - t.SyncClient.Publish(ctx, balanceTopic, balanceMsg) + t.SyncClient.Publish(ctx, BalanceTopic, balanceMsg) // create and publish the preseal commitment - priv, _, err := libp2p_crypto.GenerateEd25519Key(rand.Reader) + priv, _, err := libp2pcrypto.GenerateEd25519Key(rand.Reader) if err != nil { return nil, err } @@ -146,7 +78,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { } // pick unique sequence number for each miner, no matter in which group they are - seq := t.SyncClient.MustSignalAndWait(ctx, stateMinerPickSeqNum, t.IntParam("miners")) + seq := t.SyncClient.MustSignalAndWait(ctx, StateMinerPickSeqNum, t.IntParam("miners")) minerAddr, err := address.NewIDAddress(genesis_chain.MinerStart + uint64(seq-1)) if err != nil { @@ -168,10 +100,10 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { t.RecordMessage("Miner Info: Owner: %s Worker: %s", genMiner.Owner, genMiner.Worker) presealMsg := &PresealMsg{Miner: *genMiner, Seqno: seq} - t.SyncClient.Publish(ctx, presealTopic, presealMsg) + t.SyncClient.Publish(ctx, PresealTopic, presealMsg) // then collect the genesis block and bootstrapper address - genesisMsg, err := waitForGenesis(t, ctx) + genesisMsg, err := WaitForGenesis(t, ctx) if err != nil { return nil, err } @@ -229,12 +161,12 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { // create the node // we need both a full node _and_ and storage miner node - n := &Node{} + n := &LotusNode{} nodeRepo := repo.NewMemory(nil) stop1, err := node.New(context.Background(), - node.FullAPI(&n.fullApi), + node.FullAPI(&n.FullApi), node.Online(), node.Repo(nodeRepo), withGenesis(genesisMsg.Genesis), @@ -255,10 +187,10 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { } minerOpts := []node.Option{ - node.StorageMiner(&n.minerApi), + node.StorageMiner(&n.MinerApi), node.Online(), node.Repo(minerRepo), - node.Override(new(api.FullNode), n.fullApi), + node.Override(new(api.FullNode), n.FullApi), withApiEndpoint("/ip4/127.0.0.1/tcp/1234"), withMinerListenAddress(minerIP), } @@ -282,7 +214,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { stop1(context.TODO()) return nil, err } - n.stop = func(ctx context.Context) error { + n.StopFn = func(ctx context.Context) error { // TODO use a multierror for this err2 := stop2(ctx) err1 := stop1(ctx) @@ -295,25 +227,20 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { registerAndExportMetrics(minerAddr.String()) // Bootstrap with full node - remoteAddrs, err := n.fullApi.NetAddrsListen(ctx) + remoteAddrs, err := n.FullApi.NetAddrsListen(ctx) if err != nil { panic(err) } - err = n.minerApi.NetConnect(ctx, remoteAddrs) + err = n.MinerApi.NetConnect(ctx, remoteAddrs) if err != nil { panic(err) } - err = startStorMinerAPIServer(minerRepo, n.minerApi) - if err != nil { - return nil, err - } - // add local storage for presealed sectors - err = n.minerApi.StorageAddLocal(ctx, presealDir) + err = n.MinerApi.StorageAddLocal(ctx, presealDir) if err != nil { - n.stop(context.TODO()) + n.StopFn(context.TODO()) return nil, err } @@ -333,30 +260,105 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { GasLimit: 1000000, } - _, err = n.fullApi.MpoolPushMessage(ctx, changeMinerID) + _, err = n.FullApi.MpoolPushMessage(ctx, changeMinerID) if err != nil { - n.stop(context.TODO()) + n.StopFn(context.TODO()) return nil, err } t.RecordMessage("publish our address to the miners addr topic") - actoraddress, err := n.minerApi.ActorAddress(ctx) + actoraddress, err := n.MinerApi.ActorAddress(ctx) if err != nil { return nil, err } - addrinfo, err := n.minerApi.NetAddrsListen(ctx) + addrinfo, err := n.MinerApi.NetAddrsListen(ctx) if err != nil { return nil, err } - t.SyncClient.MustPublish(ctx, minersAddrsTopic, MinerAddressesMsg{addrinfo, actoraddress}) + t.SyncClient.MustPublish(ctx, MinersAddrsTopic, MinerAddressesMsg{addrinfo, actoraddress}) t.RecordMessage("waiting for all nodes to be ready") - t.SyncClient.MustSignalAndWait(ctx, stateReady, t.TestInstanceCount) + t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount) - return n, err + m := &LotusMiner{n, t} + + err = m.startStorageMinerAPIServer(minerRepo, n.MinerApi) + if err != nil { + return nil, err + } + + return m, err } -func startStorMinerAPIServer(repo *repo.MemRepo, minerApi api.StorageMiner) error { +func (m *LotusMiner) RunDefault() error { + var ( + t = m.t + clients = t.IntParam("clients") + miners = t.IntParam("miners") + ) + + t.RecordMessage("running miner") + t.RecordMessage("block delay: %v", build.BlockDelay) + t.D().Gauge("miner.block-delay").Update(build.BlockDelay) + + ctx := context.Background() + myActorAddr, err := m.MinerApi.ActorAddress(ctx) + if err != nil { + return err + } + + // mine / stop mining + mine := true + done := make(chan struct{}) + + if m.MineOne != nil { + go func() { + defer t.RecordMessage("shutting down mining") + defer close(done) + + var i int + for i = 0; mine; i++ { + // synchronize all miners to mine the next block + t.RecordMessage("synchronizing all miners to mine next block [%d]", i) + stateMineNext := sync.State(fmt.Sprintf("mine-block-%d", i)) + t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners) + + ch := make(chan struct{}) + err := m.MineOne(ctx, func(mined bool) { + if mined { + t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1) + } + close(ch) + }) + if err != nil { + panic(err) + } + <-ch + } + + // signal the last block to make sure no miners are left stuck waiting for the next block signal + // while the others have stopped + stateMineLast := sync.State(fmt.Sprintf("mine-block-%d", i)) + t.SyncClient.MustSignalEntry(ctx, stateMineLast) + }() + } else { + close(done) + } + + // wait for a signal from all clients to stop mining + err = <-t.SyncClient.MustBarrier(ctx, StateStopMining, clients).C + if err != nil { + return err + } + + mine = false + <-done + + t.SyncClient.MustSignalAndWait(ctx, StateDone, t.TestInstanceCount) + return nil +} + +func (m *LotusMiner) startStorageMinerAPIServer(repo *repo.MemRepo, minerApi api.StorageMiner) error { mux := mux.NewRouter() rpcServer := jsonrpc.NewServer() diff --git a/lotus-soup/role_pubsub_tracer.go b/lotus-soup/testkit/role_pubsub_tracer.go similarity index 68% rename from lotus-soup/role_pubsub_tracer.go rename to lotus-soup/testkit/role_pubsub_tracer.go index e91e94847..5b13e6b81 100644 --- a/lotus-soup/role_pubsub_tracer.go +++ b/lotus-soup/testkit/role_pubsub_tracer.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "context" @@ -14,16 +14,12 @@ import ( ) type PubsubTracer struct { + t *TestEnvironment host host.Host traced *traced.TraceCollector } -func (tr *PubsubTracer) Stop() error { - tr.traced.Stop() - return tr.host.Close() -} - -func preparePubsubTracer(t *TestEnvironment) (*PubsubTracer, error) { +func PreparePubsubTracer(t *TestEnvironment) (*PubsubTracer, error) { ctx := context.Background() privk, _, err := crypto.GenerateEd25519Key(rand.Reader) @@ -54,29 +50,30 @@ func preparePubsubTracer(t *TestEnvironment) (*PubsubTracer, error) { _ = ma.StringCast(tracedMultiaddrStr) tracedMsg := &PubsubTracerMsg{Multiaddr: tracedMultiaddrStr} - t.SyncClient.MustPublish(ctx, pubsubTracerTopic, tracedMsg) + t.SyncClient.MustPublish(ctx, PubsubTracerTopic, tracedMsg) t.RecordMessage("waiting for all nodes to be ready") - t.SyncClient.MustSignalAndWait(ctx, stateReady, t.TestInstanceCount) + t.SyncClient.MustSignalAndWait(ctx, StateReady, t.TestInstanceCount) - return &PubsubTracer{host: host, traced: traced}, nil + tracer := &PubsubTracer{t: t, host: host, traced: traced} + return tracer, nil } -func runPubsubTracer(t *TestEnvironment) error { - t.RecordMessage("running pubsub tracer") - tracer, err := preparePubsubTracer(t) - if err != nil { - return err - } +func (tr *PubsubTracer) RunDefault() error { + tr.t.RecordMessage("running pubsub tracer") defer func() { - err := tracer.Stop() + err := tr.Stop() if err != nil { - t.RecordMessage("error stoping tracer: %s", err) + tr.t.RecordMessage("error stoping tracer: %s", err) } }() - ctx := context.Background() - t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount) + tr.t.WaitUntilAllDone() return nil } + +func (tr *PubsubTracer) Stop() error { + tr.traced.Stop() + return tr.host.Close() +} diff --git a/lotus-soup/sync.go b/lotus-soup/testkit/sync.go similarity index 51% rename from lotus-soup/sync.go rename to lotus-soup/testkit/sync.go index 099d31283..0ca4327bc 100644 --- a/lotus-soup/sync.go +++ b/lotus-soup/testkit/sync.go @@ -1,4 +1,4 @@ -package main +package testkit import ( "github.com/filecoin-project/go-address" @@ -9,20 +9,20 @@ import ( ) var ( - genesisTopic = sync.NewTopic("genesis", &GenesisMsg{}) - balanceTopic = sync.NewTopic("balance", &InitialBalanceMsg{}) - presealTopic = sync.NewTopic("preseal", &PresealMsg{}) - clientsAddrsTopic = sync.NewTopic("clientsAddrsTopic", &peer.AddrInfo{}) - minersAddrsTopic = sync.NewTopic("minersAddrsTopic", &MinerAddressesMsg{}) - pubsubTracerTopic = sync.NewTopic("pubsubTracer", &PubsubTracerMsg{}) - drandConfigTopic = sync.NewTopic("drand-config", &DrandRuntimeInfo{}) + GenesisTopic = sync.NewTopic("genesis", &GenesisMsg{}) + BalanceTopic = sync.NewTopic("balance", &InitialBalanceMsg{}) + PresealTopic = sync.NewTopic("preseal", &PresealMsg{}) + ClientsAddrsTopic = sync.NewTopic("clients_addrs", &peer.AddrInfo{}) + MinersAddrsTopic = sync.NewTopic("miners_addrs", &MinerAddressesMsg{}) + PubsubTracerTopic = sync.NewTopic("pubsub_tracer", &PubsubTracerMsg{}) + DrandConfigTopic = sync.NewTopic("drand_config", &DrandRuntimeInfo{}) ) var ( - stateReady = sync.State("ready") - stateDone = sync.State("done") - stateStopMining = sync.State("stop-mining") - stateMinerPickSeqNum = sync.State("miner-pick-seq-num") + StateReady = sync.State("ready") + StateDone = sync.State("done") + StateStopMining = sync.State("stop-mining") + StateMinerPickSeqNum = sync.State("miner-pick-seq-num") ) type InitialBalanceMsg struct { diff --git a/lotus-soup/testkit/testenv.go b/lotus-soup/testkit/testenv.go new file mode 100644 index 000000000..d770d3dd3 --- /dev/null +++ b/lotus-soup/testkit/testenv.go @@ -0,0 +1,48 @@ +package testkit + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/testground/sdk-go/run" + "github.com/testground/sdk-go/runtime" +) + +type TestEnvironment struct { + *runtime.RunEnv + *run.InitContext + + Role string +} + +// workaround for default params being wrapped in quote chars +func (t *TestEnvironment) StringParam(name string) string { + return strings.Trim(t.RunEnv.StringParam(name), "\"") +} + +func (t *TestEnvironment) DurationParam(name string) time.Duration { + d, err := time.ParseDuration(t.StringParam(name)) + if err != nil { + panic(fmt.Errorf("invalid duration value for param '%s': %w", name, err)) + } + return d +} + +// WaitUntilAllDone waits until all instances in the test case are done. +func (t *TestEnvironment) WaitUntilAllDone() { + ctx := context.Background() + t.SyncClient.MustSignalAndWait(ctx, StateDone, t.TestInstanceCount) +} + +// WrapTestEnvironment takes a test case function that accepts a +// *TestEnvironment, and adapts it to the original unwrapped SDK style +// (run.InitializedTestCaseFn). +func WrapTestEnvironment(f func(t *TestEnvironment) error) run.InitializedTestCaseFn { + return func(runenv *runtime.RunEnv, initCtx *run.InitContext) error { + t := &TestEnvironment{RunEnv: runenv, InitContext: initCtx} + t.Role = t.StringParam("role") + return f(t) + } +}