diff --git a/go.mod b/go.mod index fbfc8bce0e..814b58f0a1 100644 --- a/go.mod +++ b/go.mod @@ -24,10 +24,9 @@ require ( github.com/ipfs/interface-go-ipfs-core v0.4.0 github.com/lazyledger/lazyledger-core/p2p/ipld/plugin v0.0.0-20210219190522-0eccfb24e2aa github.com/lazyledger/nmt v0.3.1 - github.com/lazyledger/rsmt2d v0.1.1-0.20210327010029-ef1d6c54461e + github.com/lazyledger/rsmt2d v0.1.1-0.20210406153014-e1fd589bdb09 github.com/libp2p/go-buffer-pool v0.0.2 github.com/minio/highwayhash v1.0.1 - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.8.0 @@ -39,12 +38,10 @@ require ( github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.7.0 github.com/tendermint/tm-db v0.6.4 - golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad - golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect - golang.org/x/net v0.0.0-20201021035429-f5854403a974 + golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 + golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 // indirect google.golang.org/grpc v1.35.0 - gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect ) replace ( diff --git a/go.sum b/go.sum index cf47a97370..615e43a484 100644 --- a/go.sum +++ b/go.sum @@ -151,6 +151,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -221,7 +222,6 @@ github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclK github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= 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/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= @@ -595,14 +595,20 @@ github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfo github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/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/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lazyledger/go-ipfs v0.8.0-lazypatch h1:8Dkw7Or6d0BmpFYFcxwgqWZ047BPGCsWtG7v9+H0ofk= github.com/lazyledger/go-ipfs v0.8.0-lazypatch/go.mod h1:CE4cJkjUmwW5LwJP26KKEAZ11ZED0DxzSryfv5RMf6E= github.com/lazyledger/go-leopard v0.0.0-20200604113236-298f93361181 h1:mUeCGuCgjZVadW4CzA2dMBq7p2BqaoCfpnKjxMmSaSE= github.com/lazyledger/go-leopard v0.0.0-20200604113236-298f93361181/go.mod h1:v1o1CRihQ9i7hizx23KK4aR79lxA6VDUIzUCfDva0XQ= +github.com/lazyledger/go-leopard v0.0.0-20200724211609-50ec4b3fab41 h1:DTQODNWI71ZtqCT3wQg+RXl4K/zpu+hu5usISUhDq/E= +github.com/lazyledger/go-leopard v0.0.0-20200724211609-50ec4b3fab41/go.mod h1:v1o1CRihQ9i7hizx23KK4aR79lxA6VDUIzUCfDva0XQ= github.com/lazyledger/go-verifcid v0.0.1-lazypatch h1:jAVwUw+DhuCzx5IcYpFh6d6HWxRRz8nhJ3rQo+vlFAc= github.com/lazyledger/go-verifcid v0.0.1-lazypatch/go.mod h1:kXPYu0XqTNUKWA1h3M95UHjUqBzDwXVVt/RXZDjKJmQ= github.com/lazyledger/merkletree v0.0.0-20201214195110-6901c4c3c75f h1:jbyPAH6o6hGte4RtZBaqWs2n4Fl6hS7qJGXX3qnjiy4= @@ -611,6 +617,8 @@ github.com/lazyledger/nmt v0.3.1 h1:zP172RR33Es4dhb88GmUr9kBpAkH6Wcl7nQGJ3HQzu4= github.com/lazyledger/nmt v0.3.1/go.mod h1:tY7ypPX26Sbkt6F8EbPl3AT33B5N0BJe4OVPbq849YI= github.com/lazyledger/rsmt2d v0.1.1-0.20210327010029-ef1d6c54461e h1:3mwa4b4v9puYIFsfRN6TsXMbUagvhLtIzXWHN2GFHB4= github.com/lazyledger/rsmt2d v0.1.1-0.20210327010029-ef1d6c54461e/go.mod h1:ORR2U7THCNr1fpUhwYqZN7QCFJ20iR2uiIWfXKz3KJ4= +github.com/lazyledger/rsmt2d v0.1.1-0.20210406153014-e1fd589bdb09 h1:5wpWhlalAm1vNpkR/L1BlWHyn8GT5XNieIZqTlKG9hc= +github.com/lazyledger/rsmt2d v0.1.1-0.20210406153014-e1fd589bdb09/go.mod h1:EbB1gGbX51gBNm0hC5lMcbkgEyO3Wj2RYwba9mCUvPA= 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= @@ -1006,8 +1014,6 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= @@ -1225,6 +1231,8 @@ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49u github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/vivint/infectious v0.0.0-20190108171102-2455b059135b h1:dLkqBELopfQNhe8S9ucnSf+HhiUCgK/hPIjVG0f9GlY= github.com/vivint/infectious v0.0.0-20190108171102-2455b059135b/go.mod h1:5oyMAv4hrBEKqBwORFsiqIrCNCmL2qcZLQTdJLYeYIc= +github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3 h1:zMsHhfK9+Wdl1F7sIKLyx3wrOFofpb3rWFbA4HgcK5k= +github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3/go.mod h1:R0Gbuw7ElaGSLOZUSwBm/GgVwMd30jWxBDdAyMOeTuc= github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a h1:G++j5e0OC488te356JvdhaM8YS6nMsjLAYF7JxCv07w= @@ -1261,6 +1269,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8 h1:gZfMjx7Jr6N8b7iJO4eUjDsn6xJqoyXg8D+ogdoAfKY= gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= +gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975 h1:L/ENs/Ar1bFzUeKx6m3XjlmBgIUlykX9dzvp5k9NGxc= +gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 h1:dizWJqTWjwyD8KGcMOwgrkqu1JIkofYgKkmDeNE7oAs= gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40/go.mod h1:rOnSnoRyxMI3fe/7KIbVcsHRGxe30OONv8dEgo+vCfA= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -1336,8 +1346,8 @@ golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1349,8 +1359,6 @@ golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 h1:FR+oGxGfbQu1d+jglI3rCkjAjUnhRSZcUxr+DqlDLNo= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1371,7 +1379,6 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -1414,6 +1421,8 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1466,7 +1475,6 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1489,7 +1497,10 @@ golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1629,8 +1640,8 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks 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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -1654,6 +1665,8 @@ gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/p2p/ipld/race_detector_file.go b/p2p/ipld/race_detector_file.go new file mode 100644 index 0000000000..85da7b27bb --- /dev/null +++ b/p2p/ipld/race_detector_file.go @@ -0,0 +1,7 @@ +// +build race + +package ipld + +func init() { + raceDetectorActive = true +} diff --git a/p2p/ipld/read.go b/p2p/ipld/read.go index 6469b8dbfe..12e7d4bb8f 100644 --- a/p2p/ipld/read.go +++ b/p2p/ipld/read.go @@ -3,16 +3,224 @@ package ipld import ( "context" "errors" + "fmt" "math" + "math/rand" "github.com/ipfs/go-cid" coreiface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/path" + "github.com/lazyledger/lazyledger-core/p2p/ipld/plugin/nodes" + "github.com/lazyledger/lazyledger-core/types" + "github.com/lazyledger/rsmt2d" ) -// ///////////////////////////////////// +// ////////////////////////////////////// +// Retrieve Block Data +// //////////////////////////////////// + +const baseErrorMsg = "failure to retrieve block data:" + +var ErrEncounteredTooManyErrors = fmt.Errorf("%s %s", baseErrorMsg, "encountered too many errors") +var ErrTimeout = fmt.Errorf("%s %s", baseErrorMsg, "timeout") + +// RetrieveBlockData asynchronously fetches block data using the minimum number +// of requests to IPFS. It fails if one of the random samples sampled is not available. +func RetrieveBlockData( + ctx context.Context, + dah *types.DataAvailabilityHeader, + api coreiface.CoreAPI, + codec rsmt2d.CodecType, +) (types.Data, error) { + edsWidth := len(dah.RowsRoots) + sc := newshareCounter(ctx, uint32(edsWidth)) + + // convert the row and col roots into Cids + rowRoots := dah.RowsRoots.Bytes() + colRoots := dah.ColumnRoots.Bytes() + + // sample 1/4 of the total extended square by sampling half of the leaves in + // half of the rows + for _, row := range uniqueRandNumbers(edsWidth/2, edsWidth) { + for _, col := range uniqueRandNumbers(edsWidth/2, edsWidth) { + rootCid, err := nodes.CidFromNamespacedSha256(rowRoots[row]) + if err != nil { + return types.Data{}, err + } + + go sc.retrieveShare(rootCid, true, row, col, api) + } + } + + // wait until enough data has been collected, too many errors encountered, + // or the timeout is reached + err := sc.wait() + if err != nil { + return types.Data{}, err + } + + // flatten the square + flattened := sc.flatten() + + tree := NewErasuredNamespacedMerkleTree(uint64(edsWidth) / 2) + + // repair the square + eds, err := rsmt2d.RepairExtendedDataSquare(rowRoots, colRoots, flattened, codec, tree.Constructor) + if err != nil { + return types.Data{}, err + } + + blockData, err := types.DataFromSquare(eds) + if err != nil { + return types.Data{}, err + } + + return blockData, nil +} + +// uniqueRandNumbers generates count unique random numbers with a max of max +func uniqueRandNumbers(count, max int) []uint32 { + if count > max { + panic(fmt.Sprintf("cannot create %d unique samples from a max of %d", count, max)) + } + samples := make(map[uint32]struct{}, count) + for i := 0; i < count; { + // nolint:gosec // G404: Use of weak random number generator + sample := uint32(rand.Intn(max)) + if _, has := samples[sample]; has { + continue + } + samples[sample] = struct{}{} + i++ + } + out := make([]uint32, count) + counter := 0 + for s := range samples { + out[counter] = s + counter++ + } + return out +} + +type index struct { + row uint32 + col uint32 +} + +type indexedShare struct { + data []byte + index +} + +// shareCounter is a thread safe tallying mechanism for share retrieval +type shareCounter struct { + // all shares + shares map[index][]byte + // number of shares successfully collected + counter uint32 + // the width of the extended data square + edsWidth uint32 + // the minimum shares needed to repair the extended data square + minSharesNeeded uint32 + + shareChan chan indexedShare + ctx context.Context + cancel context.CancelFunc + // any errors encountered when attempting to retrieve shares + errc chan error +} + +func newshareCounter(parentCtx context.Context, edsWidth uint32) *shareCounter { + ctx, cancel := context.WithCancel(parentCtx) + + // calculate the min number of shares needed to repair the square + minSharesNeeded := (edsWidth * edsWidth / 4) + + return &shareCounter{ + shares: make(map[index][]byte), + edsWidth: edsWidth, + minSharesNeeded: minSharesNeeded, + shareChan: make(chan indexedShare, 1), + errc: make(chan error, 1), + ctx: ctx, + cancel: cancel, + } +} + +// retrieveLeaf uses GetLeafData to fetch a single leaf and counts that leaf +func (sc *shareCounter) retrieveShare( + rootCid cid.Cid, + isRow bool, + axisIdx uint32, + idx uint32, + api coreiface.CoreAPI, +) { + data, err := GetLeafData(sc.ctx, rootCid, idx, sc.edsWidth, api) + if err != nil { + select { + case <-sc.ctx.Done(): + case sc.errc <- err: + } + } + + if len(data) < types.ShareSize { + return + } + + // switch the row and col indexes if needed + rowIdx := idx + colIdx := axisIdx + if isRow { + rowIdx = axisIdx + colIdx = idx + } + + select { + case <-sc.ctx.Done(): + default: + sc.shareChan <- indexedShare{data: data[types.NamespaceSize:], index: index{row: rowIdx, col: colIdx}} + } +} + +// wait until enough data has been collected, the timeout has been reached, or +// too many errors are encountered +func (sc *shareCounter) wait() error { + defer sc.cancel() + + for { + select { + case <-sc.ctx.Done(): + return ErrTimeout + + case share := <-sc.shareChan: + _, has := sc.shares[share.index] + // add iff it does not already exists + if !has { + sc.shares[share.index] = share.data + sc.counter++ + // check finishing condition + if sc.counter >= sc.minSharesNeeded { + return nil + } + } + + case err := <-sc.errc: + return fmt.Errorf("failure to retrieve data square: %w", err) + } + } +} + +func (sc *shareCounter) flatten() [][]byte { + flattended := make([][]byte, sc.edsWidth*sc.edsWidth) + for index, data := range sc.shares { + flattended[(index.row*sc.edsWidth)+index.col] = data + } + return flattended +} + +// ////////////////////////////////////// // Get Leaf Data -// ///////////////////////////////////// +// //////////////////////////////////// // GetLeafData fetches and returns the data for leaf leafIndex of root rootCid. // It stops and returns an error if the provided context is cancelled before diff --git a/p2p/ipld/read_test.go b/p2p/ipld/read_test.go index 0262ce7d0b..b22e851db1 100644 --- a/p2p/ipld/read_test.go +++ b/p2p/ipld/read_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "crypto/sha256" + "fmt" "math" "math/rand" "sort" @@ -19,11 +20,14 @@ import ( "github.com/lazyledger/lazyledger-core/p2p/ipld/plugin/nodes" "github.com/lazyledger/lazyledger-core/types" "github.com/lazyledger/nmt" + "github.com/lazyledger/nmt/namespace" "github.com/lazyledger/rsmt2d" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +var raceDetectorActive = false + func TestLeafPath(t *testing.T) { type test struct { name string @@ -179,6 +183,7 @@ func TestBlockRecovery(t *testing.T) { }{ {"missing 1/2 shares", quarterShares, false, "", extendedShareCount / 2}, {"missing 1/4 shares", quarterShares, false, "", extendedShareCount / 4}, + {"max missing data", quarterShares, false, "", ((originalSquareWidth + 1) * (originalSquareWidth + 1))}, {"missing all but one shares", allShares, true, "failed to solve data square", extendedShareCount - 1}, } for _, tc := range testCases { @@ -217,7 +222,7 @@ func TestBlockRecovery(t *testing.T) { return } - require.NoError(t, err) + assert.NoError(t, err) // check that the squares are equal assert.Equal(t, flatten(eds), flatten(reds)) @@ -225,6 +230,103 @@ func TestBlockRecovery(t *testing.T) { } } +func TestRetrieveBlockData(t *testing.T) { + type test struct { + name string + squareSize int + expectErr bool + errStr string + } + + // create a mock node + ipfsNode, err := coremock.NewMockNode() + if err != nil { + t.Error(err) + } + + // issue a new API object + ipfsAPI, err := coreapi.NewCoreAPI(ipfsNode) + if err != nil { + t.Error(err) + } + + // the max size of messages that won't get split + adjustedMsgSize := types.MsgShareSize - 2 + + tests := []test{ + {"4 KB block", 4, false, ""}, + {"16 KB block", 8, false, ""}, + {"16 KB block timeout expected", 8, true, "timeout"}, + {"max square size", types.MaxSquareSize, false, ""}, + } + + for _, tc := range tests { + tc := tc + + t.Run(fmt.Sprintf("%s size %d", tc.name, tc.squareSize), func(t *testing.T) { + // if we're using the race detector, skip some large tests due to time and + // concurrency constraints + if raceDetectorActive && tc.squareSize > 8 { + t.Skip("Not running large test due to time and concurrency constraints while race detector is active.") + } + + background := context.Background() + blockData := generateRandomBlockData(tc.squareSize*tc.squareSize, adjustedMsgSize) + block := types.Block{ + Data: blockData, + LastCommit: &types.Commit{}, + } + + // if an error is exected, don't put the block + if !tc.expectErr { + err := block.PutBlock(background, ipfsAPI.Dag()) + if err != nil { + t.Fatal(err) + } + } + + shareData, _ := blockData.ComputeShares() + rawData := shareData.RawShares() + + tree := NewErasuredNamespacedMerkleTree(uint64(tc.squareSize)) + eds, err := rsmt2d.ComputeExtendedDataSquare(rawData, rsmt2d.RSGF8, tree.Constructor) + if err != nil { + t.Fatal(err) + } + + rawRowRoots := eds.RowRoots() + rawColRoots := eds.ColumnRoots() + rowRoots := rootsToDigests(rawRowRoots) + colRoots := rootsToDigests(rawColRoots) + + retrievalCtx, cancel := context.WithTimeout(background, time.Second*2) + defer cancel() + + rblockData, err := RetrieveBlockData( + retrievalCtx, + &types.DataAvailabilityHeader{ + RowsRoots: rowRoots, + ColumnRoots: colRoots, + }, + ipfsAPI, + rsmt2d.RSGF8, + ) + + if tc.expectErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.errStr) + return + } + + require.NoError(t, err) + + nsShares, _ := rblockData.ComputeShares() + + assert.Equal(t, rawData, nsShares.RawShares()) + }) + } +} + func flatten(eds *rsmt2d.ExtendedDataSquare) [][]byte { flattenedEDSSize := eds.Width() * eds.Width() out := make([][]byte, flattenedEDSSize) @@ -299,3 +401,49 @@ func removeRandShares(data [][]byte, d int) [][]byte { } return data } + +func rootsToDigests(roots [][]byte) []namespace.IntervalDigest { + out := make([]namespace.IntervalDigest, len(roots)) + for i, root := range roots { + idigest, err := namespace.IntervalDigestFromBytes(types.NamespaceSize, root) + if err != nil { + panic(err) + } + out[i] = idigest + } + return out +} + +func generateRandomBlockData(msgCount, msgSize int) types.Data { + var out types.Data + out.Messages = generateRandomMessages(msgCount-1, msgSize) + out.Txs = generateRandomContiguousShares(1) + return out +} + +func generateRandomMessages(count, msgSize int) types.Messages { + shares := generateRandNamespacedRawData(count, types.NamespaceSize, msgSize) + msgs := make([]types.Message, count) + for i, s := range shares { + msgs[i] = types.Message{ + Data: s[types.NamespaceSize:], + NamespaceID: s[:types.NamespaceSize], + } + } + return types.Messages{MessagesList: msgs} +} + +func generateRandomContiguousShares(count int) types.Txs { + // the size of a length delimited tx that takes up an entire share + const adjustedTxSize = types.TxShareSize - 2 + txs := make(types.Txs, count) + for i := 0; i < count; i++ { + tx := make([]byte, adjustedTxSize) + _, err := rand.Read(tx) + if err != nil { + panic(err) + } + txs[i] = types.Tx(tx) + } + return txs +} diff --git a/types/share_merging.go b/types/share_merging.go index 296e66b016..b776fbaffa 100644 --- a/types/share_merging.go +++ b/types/share_merging.go @@ -240,7 +240,6 @@ func parseMsgShares(shares [][]byte) ([]Message, error) { // set the first nid and current share nid := shares[0][:NamespaceSize] currentShare := shares[0][NamespaceSize:] - // find and remove the msg len delimiter currentShare, msgLen, err := parseDelimiter(currentShare) if err != nil { diff --git a/types/shares_test.go b/types/shares_test.go index 41e7ea0c0b..ac5626a8dc 100644 --- a/types/shares_test.go +++ b/types/shares_test.go @@ -450,6 +450,7 @@ func Test_parseDelimiter(t *testing.T) { // Test data generation // //////////////////////////// +// generateRandomBlockData returns randomly generated block data for testing purposes func generateRandomBlockData(t *testing.T, txCount, isrCount, evdCount, msgCount, maxSize int) Data { var out Data out.Txs = generateRandomlySizedContiguousShares(txCount, maxSize)