diff --git a/go.mod b/go.mod index 5e3ac2e..8d2c4ac 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,27 @@ go 1.13 require ( github.com/filecoin-project/filecoin-ffi v0.0.0-20191204125133-ebb3e13addf1 - github.com/ipfs/go-cid v0.0.3 + github.com/filecoin-project/go-amt-ipld v0.0.0-20191205011053-79efc22d6cdc + github.com/gogo/protobuf v1.3.1 // indirect + github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect + github.com/hashicorp/golang-lru v0.5.3 // indirect + github.com/ipfs/go-cid v0.0.4-0.20191112011718-79e75dffeb10 + github.com/ipfs/go-datastore v0.1.0 + github.com/ipfs/go-hamt-ipld v0.0.12-0.20190910032255-ee6e898f0456 + github.com/ipfs/go-ipfs-blockstore v0.1.0 github.com/ipfs/go-ipld-cbor v0.0.3 github.com/ipfs/go-ipld-format v0.0.2 // indirect - github.com/libp2p/go-libp2p-core v0.0.2 + github.com/ipfs/go-log v1.0.0 // indirect + github.com/libp2p/go-libp2p-core v0.2.4 github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 - github.com/minio/sha256-simd v0.1.0 // indirect - github.com/multiformats/go-multihash v0.0.5 + github.com/multiformats/go-multihash v0.0.9 github.com/multiformats/go-varint v0.0.1 - github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 + github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a + github.com/smartystreets/assertions v1.0.1 // indirect + github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect github.com/stretchr/testify v1.4.0 - github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d - golang.org/x/sys v0.0.0-20190524122548-abf6ff778158 // indirect + github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830 // indirect + github.com/whyrusleeping/cbor-gen v0.0.0-20191208220313-d43e400b4942 + golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 // indirect golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 ) diff --git a/go.sum b/go.sum index 70eccbe..84b1726 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,20 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c h1:aEbSeNALREWXk0G7UdNhR3ayBV7tZ4M2PNmnrCAph6Q= -github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3 h1:A/EVblehb75cUgXA5njHPn0kLAsykn6mJGz7rnmW5W0= +github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -16,25 +23,62 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/filecoin-project/filecoin-ffi v0.0.0-20191204125133-ebb3e13addf1 h1:VCH2UVdLmpQc5BKLGSW4YzCHB7JMXgPU/6yXGpbkNnU= github.com/filecoin-project/filecoin-ffi v0.0.0-20191204125133-ebb3e13addf1/go.mod h1:yA6YM1jzYoKaPrFjJIKV3ZmcGZJlo8rpmxfzBRNlLwM= +github.com/filecoin-project/go-amt-ipld v0.0.0-20191205011053-79efc22d6cdc h1:cODZD2YzpTUtrOSxbEnWFcQHidNRZiRdvLxySjGvG/M= +github.com/filecoin-project/go-amt-ipld v0.0.0-20191205011053-79efc22d6cdc/go.mod h1:KsFPWjF+UUYl6n9A+qbg4bjFgAOneicFZtDH/LQEX2U= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +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/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1 h1:SheiaIt0sda5K+8FLz952/1iWS9zrnKsEJaOJu4ZbSc= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk= +github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= +github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= +github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/baNLgayt4pFc= github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE= github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3 h1:UIAh32wymBpStoe83YCzwVQQ5Oy/H0FdxvUS6DJDzms= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= +github.com/ipfs/go-cid v0.0.4-0.20191112011718-79e75dffeb10 h1:5mRf2p8Bv2iKiuPsGrQUrx38rdBm2T/03JCM6VWzoMc= +github.com/ipfs/go-cid v0.0.4-0.20191112011718-79e75dffeb10/go.mod h1:/BYOuUoxkE+0f6tGzlzMvycuN+5l35VOR4Bpg2sCmds= +github.com/ipfs/go-datastore v0.0.1/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= +github.com/ipfs/go-datastore v0.1.0 h1:TOxI04l8CmO4zGtesENhzm4PwkFwJXY3rKiYaaMf9fI= +github.com/ipfs/go-datastore v0.1.0/go.mod h1:d4KVXhMt913cLBEI/PXAy6ko+W7e9AhyAKBGh803qeE= +github.com/ipfs/go-hamt-ipld v0.0.12-0.20190910032255-ee6e898f0456 h1:I0DHyyygfm9fxWK3dZ6XAXBHVY2u93ske4kprAmm4og= +github.com/ipfs/go-hamt-ipld v0.0.12-0.20190910032255-ee6e898f0456/go.mod h1:oVAOWGetjaaAPloFDCudyhxofsSG/WijXMJLTA0kRhM= +github.com/ipfs/go-ipfs-blockstore v0.1.0 h1:V1GZorHFUIB6YgTJQdq7mcaIpUfCM3fCyVi+MTo9O88= +github.com/ipfs/go-ipfs-blockstore v0.1.0/go.mod h1:5aD0AvHPi7mZc6Ci1WCAhiBQu2IsfTduLl+422H6Rqw= +github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= +github.com/ipfs/go-ipfs-ds-help v0.0.1 h1:QBg+Ts2zgeemK/dB0saiF/ykzRGgfoFMT90Rzo0OnVU= +github.com/ipfs/go-ipfs-ds-help v0.0.1/go.mod h1:gtP9xRaZXqIQRh1HRpp595KbBEdgqWFxefeVKOV8sxo= 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-ipld-cbor v0.0.3 h1:ENsxvybwkmke7Z/QJOmeJfoguj6GH3Y0YOaGrfy9Q0I= @@ -42,104 +86,195 @@ github.com/ipfs/go-ipld-cbor v0.0.3/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= github.com/ipfs/go-ipld-format v0.0.2 h1:OVAGlyYT6JPZ0pEfGntFPS40lfrDmaDbQwNHEY2G9Zs= github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k= +github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= +github.com/ipfs/go-log v1.0.0 h1:BW3LQIiZzpNyolt84yvKNCd3FU+AK4VDw1hnHR+1aiI= +github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA= +github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= +github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= +github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atqi3INF5s= github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8= -github.com/libp2p/go-libp2p-core v0.0.2 h1:86uOwW+O6Uc7NbaK4diuLZo2/Ikvqw2rgyV03VcSbLE= -github.com/libp2p/go-libp2p-core v0.0.2/go.mod h1:9dAcntw/n46XycV4RnlBq3BpgrmyUi9LuoTNdPrbUco= +github.com/libp2p/go-libp2p-core v0.2.4 h1:Et6ykkTwI6PU44tr8qUF9k43vP0aduMNniShAbUJJw8= +github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= +github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= +github.com/libp2p/go-openssl v0.0.3 h1:wjlG7HvQkt4Fq4cfH33Ivpwp0omaElYEi9z26qaIkIk= +github.com/libp2p/go-openssl v0.0.3/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +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/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16 h1:5W7KhL8HVF3XCFOweFD3BNESdnO8ewyYTFT2R+/b8FQ= github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.0.0-20190328051042-05b4dd3047e5/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= -github.com/minio/sha256-simd v0.1.0 h1:U41/2erhAKcmSI14xh/ZTUdBPOzDOIfS93ibzUSl8KM= -github.com/minio/sha256-simd v0.1.0/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= +github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/mr-tron/base58 v1.1.0 h1:Y51FGVJ91WBqCEabAi5OPUz38eAx8DakuAm5svLcsfQ= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2 h1:ZEw4I2EgPKDJ2iEw0cNmLB3ROrEmkOtXIkaG7wZg+78= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-multiaddr v0.0.4 h1:WgMSI84/eRLdbptXMkMWDXPjPq7SPLIgGUVm2eroyU4= -github.com/multiformats/go-multiaddr v0.0.4/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= +github.com/multiformats/go-multiaddr v0.1.1 h1:rVAztJYMhCQ7vEFr8FvxW3mS+HF2eY/oPbOMeS0ZDnE= +github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= 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-multihash v0.0.1 h1:HHwN1K12I+XllBCrqKnhX949Orn4oawPkegHMu2vDqQ= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= -github.com/multiformats/go-multihash v0.0.5 h1:1wxmCvTXAifAepIMyF39vZinRw5sbqjPs/UIi93+uik= -github.com/multiformats/go-multihash v0.0.5/go.mod h1:lt/HCbqlQwlPBz7lv0sQCdtfcMtlJvakRUn/0Ual8po= +github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= +github.com/multiformats/go-multihash v0.0.9 h1:aoijQXYYl7Xtb2pUUP68R+ys1TlnlR3eX6wmozr0Hp4= +github.com/multiformats/go-multihash v0.0.9/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= github.com/multiformats/go-varint v0.0.1 h1:TR/0rdQtnNxuN2IhiB639xC3tWM4IUi7DkTBVTdGW/M= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= 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/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992 h1:bzMe+2coZJYHnhGgVlcQKuRy4FSny4ds8dLQjw5P1XE= github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= +github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a h1:hjZfReYVLbqFkAtr2us7vdy04YWz3LVAirzP7reh8+M= +github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= +github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a h1:/eS3yfGjQKG+9kayBkj0ip1BGhq6zJ3eaVksphxAaek= -github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7AyxJNCJ7SBZ1MfVQCWD6Uqo2oubI2Eq2y2eqf+A5r0= +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/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.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/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc= github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d h1:NRa/Vs7+b91GdXrp0AqsG7pspWV6CLk5Gk7i46L4tGo= -github.com/whyrusleeping/cbor-gen v0.0.0-20191116002219-891f55cd449d/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= +github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830 h1:8kxMKmKzXXL4Ru1nyhvdms/JjWt+3YLpvRb/bAjO/y0= +github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= +github.com/whyrusleeping/cbor-gen v0.0.0-20190910031516-c1cbffdb01bb/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= +github.com/whyrusleeping/cbor-gen v0.0.0-20190917003517-d78d67427694/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= +github.com/whyrusleeping/cbor-gen v0.0.0-20191208220313-d43e400b4942 h1:EIKesTogdQi76lVOmZleTRQtNNIXSy037QVBVMZ8rug= +github.com/whyrusleeping/cbor-gen v0.0.0-20191208220313-d43e400b4942/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY= +github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= +github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= +go.opencensus.io v0.22.1 h1:8dP3SGL7MPB94crU3bEPplMPe83FI4EouesJUeFHv50= +go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA= +go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo= -golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190524122548-abf6ff778158 h1:v73Zw0Y1htnV0qaOAYSNiuIAviPSBkNtdy1tPi1+zpY= -golang.org/x/sys v0.0.0-20190524122548-abf6ff778158/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8= +gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/chain/message.go b/pkg/chain/message.go index 4f9aab0..b9d7142 100644 --- a/pkg/chain/message.go +++ b/pkg/chain/message.go @@ -172,6 +172,18 @@ func (mp *MessageProducer) BuildFull(from, to address.Address, method MethodID, return fm, nil } +// +// Helper methods until spec defines these +// + +func (mp *MessageProducer) SingletonAddress(id actors.SingletonActorID) address.Address { + return mp.factory.FromSingletonAddress(id) +} + +func (mp *MessageProducer) ActorCid(c actors.ActorCodeID) cid.Cid { + return mp.factory.FromActorCodeCid(c) +} + // // Sugar methods for type-checked construction of specific messages. // @@ -230,6 +242,24 @@ func (mp *MessageProducer) StoragePowerUpdateStorage(from address.Address, nonce return mp.Build(from, spaAddr, nonce, StoragePowerUpdatePower, params, opts...) } +func (mp *MessageProducer) StoragePowerPledgeCollateralForSize(from address.Address, nonce uint64, size types.BigInt, opts ...MsgOpt) (interface{}, error) { + params, err := types.Serialize(&strgpwr.PledgeCollateralParams{Size: size}) + if err != nil { + return nil, err + } + spaAddr := mp.factory.FromSingletonAddress(actors.StoragePowerAddress) + return mp.Build(from, spaAddr, nonce, StoragePowerUpdatePower, params, opts...) +} + +func (mp *MessageProducer) StoragePowerLookupPower(from address.Address, nonce uint64, miner address.Address, opts ...MsgOpt) (interface{}, error) { + params, err := types.Serialize(&strgpwr.PowerLookupParams{Miner: miner}) + if err != nil { + return nil, err + } + spaAddr := mp.factory.FromSingletonAddress(actors.StoragePowerAddress) + return mp.Build(from, spaAddr, nonce, StoragePowerUpdatePower, params, opts...) +} + // // Storage Miner Actor Methods // diff --git a/pkg/gen/main.go b/pkg/gen/main.go index e666327..9c81d67 100644 --- a/pkg/gen/main.go +++ b/pkg/gen/main.go @@ -45,6 +45,9 @@ func main() { if err := gen.WriteTupleEncodersToFile("../state/actors/strgpwr/cbor_gen.go", "strgpwr", strgpwr.CreateStorageMinerParams{}, strgpwr.UpdateStorageParams{}, + strgpwr.StoragePowerState{}, + strgpwr.PledgeCollateralParams{}, + strgpwr.PowerLookupParams{}, ); err != nil { panic(err) } diff --git a/pkg/state/actors/initialize/cbor_gen.go b/pkg/state/actors/initialize/cbor_gen.go index e925a5b..b4aea8a 100644 --- a/pkg/state/actors/initialize/cbor_gen.go +++ b/pkg/state/actors/initialize/cbor_gen.go @@ -70,10 +70,10 @@ func (t *ExecParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Params: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Params: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } diff --git a/pkg/state/actors/multsig/cbor_gen.go b/pkg/state/actors/multsig/cbor_gen.go index 502142a..9291f0a 100644 --- a/pkg/state/actors/multsig/cbor_gen.go +++ b/pkg/state/actors/multsig/cbor_gen.go @@ -90,7 +90,8 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -165,7 +166,8 @@ func (t *MultiSigActorState) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Transactions: array too large (%d)", extra) } @@ -326,10 +328,10 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Params: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Params: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -343,7 +345,8 @@ func (t *MTransaction) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Approved: array too large (%d)", extra) } @@ -506,7 +509,8 @@ func (t *MultiSigConstructorParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Signers: array too large (%d)", extra) } @@ -741,10 +745,10 @@ func (t *MultiSigProposeParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Params: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Params: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } diff --git a/pkg/state/actors/paych/cbor_gen.go b/pkg/state/actors/paych/cbor_gen.go index bfef351..d7b14c7 100644 --- a/pkg/state/actors/paych/cbor_gen.go +++ b/pkg/state/actors/paych/cbor_gen.go @@ -120,7 +120,8 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Vouchers: array too large (%d)", extra) } @@ -510,10 +511,10 @@ func (t *PaymentChannelUpdateParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Secret: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Secret: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -527,10 +528,10 @@ func (t *PaymentChannelUpdateParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -589,10 +590,10 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Extra: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Extra: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -606,10 +607,10 @@ func (t *PaymentVerifyParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Proof: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Proof: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } diff --git a/pkg/state/actors/strgminr/cbor_gen.go b/pkg/state/actors/strgminr/cbor_gen.go index 96cb03b..ce07536 100644 --- a/pkg/state/actors/strgminr/cbor_gen.go +++ b/pkg/state/actors/strgminr/cbor_gen.go @@ -504,10 +504,10 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.CommR: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.CommR: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -531,7 +531,8 @@ func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.DealIDs: array too large (%d)", extra) } diff --git a/pkg/state/actors/strgpwr/cbor_gen.go b/pkg/state/actors/strgpwr/cbor_gen.go index 3dd92b5..d8a6184 100644 --- a/pkg/state/actors/strgpwr/cbor_gen.go +++ b/pkg/state/actors/strgpwr/cbor_gen.go @@ -175,3 +175,198 @@ func (t *UpdateStorageParams) UnmarshalCBOR(r io.Reader) error { t.PreviousProvingPeriodEnd = uint64(extra) return nil } + +func (t *StoragePowerState) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if _, err := w.Write([]byte{133}); err != nil { + return err + } + + // t.t.Miners (cid.Cid) (struct) + + if err := cbg.WriteCid(w, t.Miners); err != nil { + return xerrors.Errorf("failed to write cid field t.Miners: %w", err) + } + + // t.t.ProvingBuckets (cid.Cid) (struct) + + if err := cbg.WriteCid(w, t.ProvingBuckets); err != nil { + return xerrors.Errorf("failed to write cid field t.ProvingBuckets: %w", err) + } + + // t.t.MinerCount (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.MinerCount))); err != nil { + return err + } + + // t.t.LastMinerCheck (uint64) (uint64) + if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.LastMinerCheck))); err != nil { + return err + } + + // t.t.TotalStorage (types.BigInt) (struct) + if err := t.TotalStorage.MarshalCBOR(w); err != nil { + return err + } + return nil +} + +func (t *StoragePowerState) UnmarshalCBOR(r io.Reader) error { + br := cbg.GetPeeker(r) + + maj, extra, err := cbg.CborReadHeader(br) + if err != nil { + return err + } + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 5 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.t.Miners (cid.Cid) (struct) + + { + + c, err := cbg.ReadCid(br) + if err != nil { + return xerrors.Errorf("failed to read cid field t.Miners: %w", err) + } + + t.Miners = c + + } + // t.t.ProvingBuckets (cid.Cid) (struct) + + { + + c, err := cbg.ReadCid(br) + if err != nil { + return xerrors.Errorf("failed to read cid field t.ProvingBuckets: %w", err) + } + + t.ProvingBuckets = c + + } + // t.t.MinerCount (uint64) (uint64) + + maj, extra, err = cbg.CborReadHeader(br) + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.MinerCount = uint64(extra) + // t.t.LastMinerCheck (uint64) (uint64) + + maj, extra, err = cbg.CborReadHeader(br) + if err != nil { + return err + } + if maj != cbg.MajUnsignedInt { + return fmt.Errorf("wrong type for uint64 field") + } + t.LastMinerCheck = uint64(extra) + // t.t.TotalStorage (types.BigInt) (struct) + + { + + if err := t.TotalStorage.UnmarshalCBOR(br); err != nil { + return err + } + + } + return nil +} + +func (t *PledgeCollateralParams) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if _, err := w.Write([]byte{129}); err != nil { + return err + } + + // t.t.Size (types.BigInt) (struct) + if err := t.Size.MarshalCBOR(w); err != nil { + return err + } + return nil +} + +func (t *PledgeCollateralParams) UnmarshalCBOR(r io.Reader) error { + br := cbg.GetPeeker(r) + + maj, extra, err := cbg.CborReadHeader(br) + if err != nil { + return err + } + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.t.Size (types.BigInt) (struct) + + { + + if err := t.Size.UnmarshalCBOR(br); err != nil { + return err + } + + } + return nil +} + +func (t *PowerLookupParams) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if _, err := w.Write([]byte{129}); err != nil { + return err + } + + // t.t.Miner (address.Address) (struct) + if err := t.Miner.MarshalCBOR(w); err != nil { + return err + } + return nil +} + +func (t *PowerLookupParams) UnmarshalCBOR(r io.Reader) error { + br := cbg.GetPeeker(r) + + maj, extra, err := cbg.CborReadHeader(br) + if err != nil { + return err + } + if maj != cbg.MajArray { + return fmt.Errorf("cbor input should be of type array") + } + + if extra != 1 { + return fmt.Errorf("cbor input had wrong number of fields") + } + + // t.t.Miner (address.Address) (struct) + + { + + if err := t.Miner.UnmarshalCBOR(br); err != nil { + return err + } + + } + return nil +} diff --git a/pkg/state/actors/strgpwr/storage_power.go b/pkg/state/actors/strgpwr/storage_power.go index e939699..8f192fd 100644 --- a/pkg/state/actors/strgpwr/storage_power.go +++ b/pkg/state/actors/strgpwr/storage_power.go @@ -1,13 +1,34 @@ package strgpwr import ( + "bytes" + "context" + "io" + "testing" + + "github.com/filecoin-project/go-amt-ipld" "github.com/ipfs/go-cid" + ds "github.com/ipfs/go-datastore" + "github.com/ipfs/go-hamt-ipld" + blockstore "github.com/ipfs/go-ipfs-blockstore" "github.com/libp2p/go-libp2p-core/peer" + "github.com/stretchr/testify/require" + cbg "github.com/whyrusleeping/cbor-gen" "github.com/filecoin-project/chain-validation/pkg/state/address" "github.com/filecoin-project/chain-validation/pkg/state/types" ) +const SlashablePowerDelay = 200 + +var ( + SectorSizes = []uint64{ + 16 << 20, + 256 << 20, + 1 << 30, + } +) + type StoragePowerState struct { Miners cid.Cid ProvingBuckets cid.Cid // amt[ProvingPeriodBucket]hamt[minerAddress]struct{} @@ -29,3 +50,206 @@ type UpdateStorageParams struct { NextProvingPeriodEnd uint64 PreviousProvingPeriodEnd uint64 } + +type PowerLookupParams struct { + Miner address.Address +} + +type PledgeCollateralParams struct { + Size types.BigInt +} + +// +// Helpers for calculating power actor's Miner CID and ProvingBuckets CID +// + +// used to calculate storage power state Miner and ProvingBucket Cid's. +func NewMinerSet(tb testing.TB) *minerSet { + mds := ds.NewMapDatastore() + bs := blockstore.NewBlockstore(mds) + + s := hamt.CSTFromBstore(bs) + nd := hamt.NewNode(s) + c, err := s.Put(context.Background(), nd) + require.NoError(tb, err) + + blks := amt.WrapBlockstore(bs) + emptyamt, err := amt.FromArray(blks, nil) + require.NoError(tb, err) + + return &minerSet{ + hamtStore: s, + MinerCid: c, + amtStore: blks, + ProvingBucketsCid: emptyamt, + bs: bs, + T: tb, + } +} + +type minerSet struct { + hamtStore *hamt.CborIpldStore + MinerCid cid.Cid + + amtStore amt.Blocks + ProvingBucketsCid cid.Cid + + bs blockstore.Blockstore + + T testing.TB +} + +func (m *minerSet) MinerSetAdd(maddr address.Address) { + ctx := context.Background() + nd, err := hamt.LoadNode(ctx, m.hamtStore, m.MinerCid) + require.NoError(m.T, err) + + mkey := string(maddr.Bytes()) + err = nd.Find(ctx, mkey, nil) + require.NotNil(m.T, err) + require.Equal(m.T, hamt.ErrNotFound, err) + + err = nd.Set(ctx, mkey, uint64(1)) + require.NoError(m.T, err) + + err = nd.Flush(ctx) + require.NoError(m.T, err) + + c, err := m.hamtStore.Put(ctx, nd) + require.NoError(m.T, err) + + m.MinerCid = c +} + +func (m *minerSet) MinerSetRemove(maddr address.Address) { + ctx := context.Background() + nd, err := hamt.LoadNode(ctx, m.hamtStore, m.MinerCid) + require.NoError(m.T, err) + + mkey := string(maddr.Bytes()) + err = nd.Delete(ctx, mkey) + require.NoError(m.T, err) + + err = nd.Flush(ctx) + require.NoError(m.T, err) + + c, err := m.hamtStore.Put(ctx, nd) + require.NoError(m.T, err) + + m.MinerCid = c +} + +func (m *minerSet) CalculateBuckets(maddr address.Address, pppe, nppe uint64) { + previousBucket := pppe % SlashablePowerDelay + nextBucket := nppe % SlashablePowerDelay + + if previousBucket == nextBucket && pppe != 0 { + return // noop + } + + buckets, err := amt.LoadAMT(m.amtStore, m.ProvingBucketsCid) + require.NoError(m.T, err) + + if pppe != 0 { // delete from previous bucket + m.deleteMinerFromBucket(maddr, buckets, previousBucket) + } + + m.addMinerToBucket(maddr, buckets, nextBucket) + + newBucketCid, err := buckets.Flush() + require.NoError(m.T, err) + + m.ProvingBucketsCid = newBucketCid +} + +func (m *minerSet) addMinerToBucket(minerAddr address.Address, buckets *amt.Root, nextBucket uint64) { + ctx := context.Background() + var bhamt *hamt.Node + var bucket cid.Cid + + err := buckets.Get(nextBucket, &bucket) + switch err.(type) { + case *amt.ErrNotFound: + bhamt = hamt.NewNode(m.hamtStore) + case nil: + bhamt, err = hamt.LoadNode(ctx, m.hamtStore, bucket) + require.NoError(m.T, err) + default: + require.Fail(m.T, "getting proving bucket") + } + + err = bhamt.Set(ctx, string(minerAddr.Bytes()), cborNull) + require.NoError(m.T, err) + + err = bhamt.Flush(ctx) + require.NoError(m.T, err) + + bucket, err = m.hamtStore.Put(ctx, bhamt) + require.NoError(m.T, err) + + err = buckets.Set(nextBucket, bucket) + + require.NoError(m.T, err) + m.ProvingBucketsCid = bucket +} + +func (m *minerSet) deleteMinerFromBucket(minerAddr address.Address, buckets *amt.Root, previousBucket uint64) cid.Cid { + ctx := context.Background() + var bucket cid.Cid + err := buckets.Get(previousBucket, &bucket) + switch err.(type) { + case *amt.ErrNotFound: + require.NoError(m.T, err) + case nil: // noop + default: + require.Fail(m.T, "failed to get bucket") + } + + bhamt, err := hamt.LoadNode(ctx, m.hamtStore, bucket) + require.NoError(m.T, err) + + err = bhamt.Delete(ctx, string(minerAddr.Bytes())) + require.NoError(m.T, err) + + err = bhamt.Flush(ctx) + require.NoError(m.T, err) + + bucket, err = m.hamtStore.Put(ctx, bhamt) + require.NoError(m.T, err) + + err = buckets.Set(previousBucket, bucket) + require.NoError(m.T, err) + + m.ProvingBucketsCid = bucket + return bucket +} + +type cbgNull struct{} + +var cborNull = &cbgNull{} + +func (cbgNull) MarshalCBOR(w io.Writer) error { + n, err := w.Write(cbg.CborNull) + if err != nil { + panic(err) + } + if n != 1 { + panic("expected to write 1 byte") + } + return nil +} + +func (cbgNull) UnmarshalCBOR(r io.Reader) error { + b := [1]byte{} + n, err := r.Read(b[:]) + if err != nil { + panic(err) + } + if n != 1 { + panic("expected 1 byte") + } + if !bytes.Equal(b[:], cbg.CborNull) { + panic("expected cbor null") + } + return nil +} diff --git a/pkg/state/types/cbor_gen.go b/pkg/state/types/cbor_gen.go index 22d36e9..0fb3227 100644 --- a/pkg/state/types/cbor_gen.go +++ b/pkg/state/types/cbor_gen.go @@ -107,10 +107,10 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.SecretPreimage: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.SecretPreimage: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } @@ -184,7 +184,8 @@ func (t *SignedVoucher) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { + + if extra > cbg.MaxLength { return fmt.Errorf("t.Merges: array too large (%d)", extra) } @@ -356,10 +357,10 @@ func (t *ModVerifyParams) UnmarshalCBOR(r io.Reader) error { if err != nil { return err } - if extra > 8192 { - return fmt.Errorf("t.Data: array too large (%d)", extra) - } + if extra > cbg.ByteArrayMaxLen { + return fmt.Errorf("t.Data: byte array too large (%d)", extra) + } if maj != cbg.MajByteString { return fmt.Errorf("expected byte array") } diff --git a/pkg/state/types/types.go b/pkg/state/types/types.go index 4db3d32..7ad9c73 100644 --- a/pkg/state/types/types.go +++ b/pkg/state/types/types.go @@ -12,7 +12,6 @@ type ( GasUnit uint64 PubKey []byte - PeerID string ) func Serialize(i cbg.CBORMarshaler) ([]byte, error) { diff --git a/pkg/suites/driver.go b/pkg/suites/driver.go index d5d8e9e..7b3a684 100644 --- a/pkg/suites/driver.go +++ b/pkg/suites/driver.go @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/chain-validation/pkg/state/actors/multsig" "github.com/filecoin-project/chain-validation/pkg/state/actors/paych" "github.com/filecoin-project/chain-validation/pkg/state/actors/strgminr" + "github.com/filecoin-project/chain-validation/pkg/state/actors/strgpwr" "github.com/filecoin-project/chain-validation/pkg/state/address" "github.com/filecoin-project/chain-validation/pkg/state/types" ) @@ -129,5 +130,22 @@ func (d *StateDriver) AssertPayChState(paychAddr address.Address, expected paych for k, _ := range expected.LaneStates { assert.Equal(d.tb, expected.LaneStates[k], paychState.LaneStates[k], fmt.Sprintf("expected LaneStates: %v, actual LaneStates: %v", expected.LaneStates, paychState.LaneStates)) } +} + +func (d *StateDriver) AssertStoragePowerState(spAddr address.Address, expected strgpwr.StoragePowerState) { + spActor, err := d.State().Actor(spAddr) + require.NoError(d.tb, err) + + spStorage, err := d.State().Storage(spAddr) + require.NoError(d.tb, err) + + var spState strgpwr.StoragePowerState + require.NoError(d.tb, spStorage.Get(spActor.Head(), &spState)) + assert.NotNil(d.tb, spState) + assert.Equal(d.tb, expected.Miners, spState.Miners, fmt.Sprintf("expected Miners: %v, actual Miners: %v", expected.Miners, spState.Miners)) + assert.Equal(d.tb, expected.MinerCount, spState.MinerCount, fmt.Sprintf("expected MinerCount: %v, actual MinerCount: %v", expected.MinerCount, spState.MinerCount)) + assert.Equal(d.tb, expected.LastMinerCheck, spState.LastMinerCheck, fmt.Sprintf("expected LastMinerCheck: %v, actual LastMinerCheck: %v", expected.LastMinerCheck, spState.LastMinerCheck)) + assert.Equal(d.tb, expected.ProvingBuckets, spState.ProvingBuckets, fmt.Sprintf("expected ProvingBuckets: %v, actual ProvingBuckets: %v", expected.ProvingBuckets, spState.ProvingBuckets)) + assert.Equal(d.tb, expected.TotalStorage, spState.TotalStorage, fmt.Sprintf("expected TotalStorage: %v, actual TotalStorage: %v", expected.TotalStorage, spState.TotalStorage)) } diff --git a/pkg/suites/storageminertest.go b/pkg/suites/storageminertest.go index 00c0e34..a76993a 100644 --- a/pkg/suites/storageminertest.go +++ b/pkg/suites/storageminertest.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/chain-validation/pkg/chain" "github.com/filecoin-project/chain-validation/pkg/state/actors" "github.com/filecoin-project/chain-validation/pkg/state/actors/strgminr" + "github.com/filecoin-project/chain-validation/pkg/state/actors/strgpwr" "github.com/filecoin-project/chain-validation/pkg/state/address" "github.com/filecoin-project/chain-validation/pkg/state/types" ) @@ -22,12 +23,6 @@ const ( var ( TotalNetworkBalance = types.NewInt(types.NewInt(1).Mul(types.NewInt(totalFilecoin).Int, types.NewInt(0).SetUint64(filecoinPrecision)).Uint64()) - - sectorSizes = []uint64{ - 16 << 20, - 256 << 20, - 1 << 30, - } ) func testSetup(t testing.TB, factory Factories) (*StateDriver, types.BigInt, types.GasUnit) { @@ -63,7 +58,7 @@ func CreateStorageMinerAndUpdatePeerID(t testing.TB, factory Factories) { // // sector size of the miner created - sectorSize := types.NewInt(sectorSizes[0]) + sectorSize := types.NewInt(strgpwr.SectorSizes[0]) // peerID of the miner created peerID := RequireIntPeerID(t, 1) diff --git a/pkg/suites/storagepower.go b/pkg/suites/storagepower.go new file mode 100644 index 0000000..0a8e479 --- /dev/null +++ b/pkg/suites/storagepower.go @@ -0,0 +1,165 @@ +package suites + +import ( + "testing" + + "github.com/libp2p/go-libp2p-core/peer" + "github.com/stretchr/testify/require" + + "github.com/filecoin-project/chain-validation/pkg/chain" + "github.com/filecoin-project/chain-validation/pkg/state/actors" + "github.com/filecoin-project/chain-validation/pkg/state/actors/strgpwr" + "github.com/filecoin-project/chain-validation/pkg/state/address" + "github.com/filecoin-project/chain-validation/pkg/state/types" +) + +type strgpwrWrapper struct { + T testing.TB + Driver *StateDriver + Producer *chain.MessageProducer + Validator *chain.Validator + ExeCtx *chain.ExecutionContext +} + +func strgpwrTestSetup(t testing.TB, factory Factories) *strgpwrWrapper { + drv := NewStateDriver(t, factory.NewState()) + gasPrice := types.NewInt(1) + gasLimit := types.GasUnit(1000000) + + _, _, err := drv.State().SetSingletonActor(actors.InitAddress, types.NewInt(0)) + require.NoError(t, err) + _, _, err = drv.State().SetSingletonActor(actors.BurntFundsAddress, types.NewInt(0)) + require.NoError(t, err) + _, _, err = drv.State().SetSingletonActor(actors.NetworkAddress, TotalNetworkBalance) + require.NoError(t, err) + + producer := chain.NewMessageProducer(factory.NewMessageFactory(drv.State()), gasLimit, gasPrice) + validator := chain.NewValidator(factory) + + testMiner := drv.NewAccountActor(0) + exeCtx := chain.NewExecutionContext(1, testMiner) + + return &strgpwrWrapper{ + T: t, + Driver: drv, + Producer: producer, + Validator: validator, + ExeCtx: exeCtx, + } + +} + +func StoragePowerActorConstructor(t testing.TB, factory Factories) { + w := strgpwrTestSetup(t, factory) + mustCreateStoragePowerActor(w) +} + +func StoragePowerActorCreateStorageMiner(t testing.TB, factory Factories) { + // 2,000,000,000,000,000,000,000,000 + const initialBal = "2000000000000000000000000" + + w := strgpwrTestSetup(t, factory) + spAddr := mustCreateStoragePowerActor(w) + + alice := w.Driver.NewAccountActorBigBalance(types.NewIntFromString(initialBal)) + peerID0 := RequireIntPeerID(t, 0) + minerAddr, err := address.NewIDAddress(102) + require.NoError(t, err) + + ms := strgpwr.NewMinerSet(t) + ms.MinerSetAdd(minerAddr) + + mustCreateStorageMiner(w, 0, strgpwr.SectorSizes[0], types.NewIntFromString("1999999995415053581179420"), minerAddr, alice, alice, alice, peerID0) + w.Driver.AssertStoragePowerState(spAddr, strgpwr.StoragePowerState{ + Miners: ms.MinerCid, + ProvingBuckets: ms.ProvingBucketsCid, + MinerCount: 1, + LastMinerCheck: 0, + TotalStorage: types.NewInt(0), + }) +} + +func StoragePowerActorUpdateStorage(t testing.TB, factory Factories) { + // 2,000,000,000,000,000,000,000,000 + const initialBal = "2000000000000000000000000" + const updateSize = 100 + const nextPpEnd = uint64(10) + const prevPpEnd = uint64(0) + + w := strgpwrTestSetup(t, factory) + spAddr := mustCreateStoragePowerActor(w) + + alice := w.Driver.NewAccountActorBigBalance(types.NewIntFromString(initialBal)) + peerID0 := RequireIntPeerID(t, 0) + minerAddr, err := address.NewIDAddress(102) + require.NoError(t, err) + + ms := strgpwr.NewMinerSet(t) + // calculate the cid of Miners + ms.MinerSetAdd(minerAddr) + + mustCreateStorageMiner(w, 0, strgpwr.SectorSizes[0], types.NewIntFromString("1999999995415053581179420"), minerAddr, alice, alice, alice, peerID0) + w.Driver.AssertStoragePowerState(spAddr, strgpwr.StoragePowerState{ + Miners: ms.MinerCid, + ProvingBuckets: ms.ProvingBucketsCid, + MinerCount: 1, + LastMinerCheck: 0, + TotalStorage: types.NewInt(0), + }) + + mustUpdateStoragePower(w, 0, 0, updateSize, nextPpEnd, prevPpEnd, minerAddr) + // calculate the cid of ProvingBuckets + ms.CalculateBuckets(minerAddr, prevPpEnd, nextPpEnd) + w.Driver.AssertStoragePowerState(spAddr, strgpwr.StoragePowerState{ + Miners: ms.MinerCid, + ProvingBuckets: ms.ProvingBucketsCid, + MinerCount: 1, + LastMinerCheck: 0, + TotalStorage: types.NewInt(updateSize), + }) +} + +func mustUpdateStoragePower(w *strgpwrWrapper, nonce, value, delta, nextPpEnd, prevPpEnd uint64, minerAddr address.Address) { + msg, err := w.Producer.StoragePowerUpdateStorage(minerAddr, nonce, types.NewInt(delta), nextPpEnd, prevPpEnd, chain.Value(value)) + require.NoError(w.T, err) + + msgReceipt, err := w.Validator.ApplyMessage(w.ExeCtx, w.Driver.State(), msg) + require.NoError(w.T, err) + w.Driver.AssertReceipt(msgReceipt, chain.MessageReceipt{ + ExitCode: 0, + ReturnValue: nil, + GasUsed: 0, + }) + +} + +func mustCreateStorageMiner(w *strgpwrWrapper, nonce, sectorSize uint64, value types.BigInt, minerAddr, from, owner, worker address.Address, pid peer.ID) { + msg, err := w.Producer.StoragePowerCreateStorageMiner(from, nonce, owner, worker, sectorSize, pid, chain.BigValue(value)) + require.NoError(w.T, err) + + msgReceipt, err := w.Validator.ApplyMessage(w.ExeCtx, w.Driver.State(), msg) + require.NoError(w.T, err) + + w.Driver.AssertReceipt(msgReceipt, chain.MessageReceipt{ + ExitCode: 0, + ReturnValue: minerAddr.Bytes(), + GasUsed: 0, + }) +} + +func mustCreateStoragePowerActor(w *strgpwrWrapper) address.Address { + // Storage Power Actor is a singleton actor, requires special setup. + _, _, err := w.Driver.State().SetSingletonActor(actors.StoragePowerAddress, types.NewInt(0)) + require.NoError(w.T, err) + + ms := strgpwr.NewMinerSet(w.T) + spAddr := w.Producer.SingletonAddress(actors.StoragePowerAddress) + w.Driver.AssertStoragePowerState(spAddr, strgpwr.StoragePowerState{ + Miners: ms.MinerCid, + ProvingBuckets: ms.ProvingBucketsCid, + MinerCount: 0, + LastMinerCheck: 0, + TotalStorage: types.NewInt(0), + }) + return spAddr +}