From 0535309beb0eb77ca14cf11ab33ad946b0f9afc1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:03:02 +0200 Subject: [PATCH 01/18] Bump github.com/spf13/viper from 1.17.0 to 1.18.2 (#95) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.17.0 to 1.18.2. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.17.0...v1.18.2) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 18 +-- go.sum | 441 +++------------------------------------------------------ 2 files changed, 32 insertions(+), 427 deletions(-) diff --git a/go.mod b/go.mod index 71485f6..f8c25e4 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/hermeznetwork/tracerr v0.3.2 github.com/mitchellh/mapstructure v1.5.0 - github.com/spf13/viper v1.16.0 + github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/urfave/cli/v2 v2.25.7 @@ -15,7 +15,7 @@ require ( require ( github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e // indirect @@ -23,16 +23,18 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/spf13/afero v1.10.0 // indirect - github.com/spf13/cast v1.5.1 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.uber.org/multierr v1.10.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 962458f..1373e8a 100644 --- a/go.sum +++ b/go.sum @@ -1,146 +1,34 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -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/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -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/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -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/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -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.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -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/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hermeznetwork/tracerr v0.3.2 h1:QB3TlQxO/4XHyixsg+nRZPuoel/FFQlQ7oAoHDD5l1c= github.com/hermeznetwork/tracerr v0.3.2/go.mod h1:nsWC1+tc4qUEbUGRv4DcPJJTjLsedlPajlFmpJoohK4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e h1:9MlwzLdW7QSDrhDjFlsEYmxpFyIoXmYRon3dt0io31k= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= @@ -159,33 +47,29 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= -github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= @@ -198,338 +82,57 @@ github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -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-20200119233911-0405dc783f0a/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-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -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= -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-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -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/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -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/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= +golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/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-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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/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-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -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/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/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-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -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/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= 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.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 6d26e771b8ff07f8c2e341c0ad368fd0a6f540fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:03:42 +0200 Subject: [PATCH 02/18] Bump github.com/urfave/cli/v2 from 2.25.7 to 2.27.1 (#102) Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.25.7 to 2.27.1. - [Release notes](https://github.com/urfave/cli/releases) - [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md) - [Commits](https://github.com/urfave/cli/compare/v2.25.7...v2.27.1) --- updated-dependencies: - dependency-name: github.com/urfave/cli/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f8c25e4..6e5051d 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - github.com/urfave/cli/v2 v2.25.7 + github.com/urfave/cli/v2 v2.27.1 go.uber.org/zap v1.26.0 ) diff --git a/go.sum b/go.sum index 1373e8a..48f925e 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= -github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= +github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= From d1613914d71913868ebb3455ea103578d2c2bc7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:54:26 +0200 Subject: [PATCH 03/18] Bump go.uber.org/zap from 1.26.0 to 1.27.0 (#114) Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.26.0 to 1.27.0. - [Release notes](https://github.com/uber-go/zap/releases) - [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md) - [Commits](https://github.com/uber-go/zap/compare/v1.26.0...v1.27.0) --- updated-dependencies: - dependency-name: go.uber.org/zap dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 6e5051d..becb73d 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/stretchr/testify v1.8.4 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/urfave/cli/v2 v2.27.1 - go.uber.org/zap v1.26.0 + go.uber.org/zap v1.27.0 ) require ( diff --git a/go.sum b/go.sum index 48f925e..17dbc55 100644 --- a/go.sum +++ b/go.sum @@ -82,11 +82,11 @@ github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= From 221ec61e102e25cf1d6deee123ddfa6a20489aba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2024 10:01:59 +0200 Subject: [PATCH 04/18] Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#116) Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index becb73d..c9731d2 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/hermeznetwork/tracerr v0.3.2 github.com/mitchellh/mapstructure v1.5.0 github.com/spf13/viper v1.18.2 - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/urfave/cli/v2 v2.27.1 go.uber.org/zap v1.27.0 diff --git a/go.sum b/go.sum index 17dbc55..421b102 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,9 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= From 7fe639a266a047509451619eb0a8e1d68f4f0167 Mon Sep 17 00:00:00 2001 From: agnusmor <100322135+agnusmor@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:36:19 +0200 Subject: [PATCH 05/18] Close inactive client connections (#125) * Close inactive client connections * fix inactivitytout usage description * rename "tout" to "timeout" * change log descriptions --- cmd/main.go | 27 ++++- datastreamer/config.go | 4 + datastreamer/datastreamer_test.go | 2 +- datastreamer/streamrelay.go | 4 +- datastreamer/streamserver.go | 180 +++++++++++++++++------------- relay/main.go | 42 +++++-- 6 files changed, 160 insertions(+), 99 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 9cb3531..db8d7cb 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -96,11 +96,17 @@ func main() { DefaultText: "1000000", }, &cli.Uint64Flag{ - Name: "writetout", + Name: "writetimeout", Usage: "timeout for write operations on client connections in ms (0=no timeout)", Value: 3000, // nolint:gomnd DefaultText: "3000", }, + &cli.Uint64Flag{ + Name: "inactivitytimeout", + Usage: "timeout to kill an inactive client connection in seconds (0=no timeout)", + Value: 120, // nolint:gomnd + DefaultText: "120", + }, }, Action: runServer, }, @@ -195,11 +201,17 @@ func main() { DefaultText: "info", }, &cli.Uint64Flag{ - Name: "writetout", + Name: "writetimeout", Usage: "timeout for write operations on client connections in ms (0=no timeout)", Value: 3000, // nolint:gomnd DefaultText: "3000", }, + &cli.Uint64Flag{ + Name: "inactivitytimeout", + Usage: "timeout to kill an inactive client connection in seconds (0=no timeout)", + Value: 120, // nolint:gomnd + DefaultText: "120", + }, }, Action: runRelay, }, @@ -229,13 +241,15 @@ func runServer(ctx *cli.Context) error { port := ctx.Uint64("port") sleep := ctx.Uint64("sleep") numOpersLoop := ctx.Uint64("opers") - writeTout := ctx.Uint64("writetout") + writeTimeout := ctx.Uint64("writetimeout") + inactivityTimeout := ctx.Uint64("inactivitytimeout") + if file == "" || port <= 0 { return errors.New("bad/missing parameters") } // Create stream server - s, err := datastreamer.NewServer(uint16(port), 1, 137, StSequencer, file, time.Duration(writeTout)*time.Millisecond, nil) // nolint:gomnd + s, err := datastreamer.NewServer(uint16(port), 1, 137, StSequencer, file, time.Duration(writeTimeout)*time.Millisecond, time.Duration(inactivityTimeout)*time.Second, 5*time.Second, nil) // nolint:gomnd if err != nil { return err } @@ -753,10 +767,11 @@ func runRelay(ctx *cli.Context) error { if server == "" || file == "" || port <= 0 { return errors.New("bad/missing parameters") } - writeTout := ctx.Uint64("writetout") + writeTimeout := ctx.Uint64("writetimeout") + inactivityTimeout := ctx.Uint64("inactivitytimeout") // Create relay server - r, err := datastreamer.NewRelay(server, uint16(port), 1, 137, StSequencer, file, time.Duration(writeTout)*time.Millisecond, nil) // nolint:gomnd + r, err := datastreamer.NewRelay(server, uint16(port), 1, 137, StSequencer, file, time.Duration(writeTimeout)*time.Millisecond, time.Duration(inactivityTimeout)*time.Second, 5*time.Second, nil) // nolint:gomnd if err != nil { return err } diff --git a/datastreamer/config.go b/datastreamer/config.go index e0cea20..0ab6c8c 100644 --- a/datastreamer/config.go +++ b/datastreamer/config.go @@ -14,6 +14,10 @@ type Config struct { Filename string `mapstructure:"Filename"` // WriteTimeout for write opeations on client connections WriteTimeout time.Duration + // InactivityTimeout is the timeout to kill an inactive client connection + InactivityTimeout time.Duration + // InactivityCheckInterval is the time interval to check for client connections that have reached the inactivity timeout to kill them + InactivityCheckInterval time.Duration // Log Log log.Config `mapstructure:"Log"` } diff --git a/datastreamer/datastreamer_test.go b/datastreamer/datastreamer_test.go index ff05085..9874d37 100644 --- a/datastreamer/datastreamer_test.go +++ b/datastreamer/datastreamer_test.go @@ -201,7 +201,7 @@ func TestServer(t *testing.T) { if err != nil { panic(err) } - streamServer, err = datastreamer.NewServer(config.Port, 1, 137, streamType, config.Filename, config.WriteTimeout, &config.Log) + streamServer, err = datastreamer.NewServer(config.Port, 1, 137, streamType, config.Filename, config.WriteTimeout, config.InactivityTimeout, 5*time.Second, &config.Log) // nolint:gomnd if err != nil { panic(err) } diff --git a/datastreamer/streamrelay.go b/datastreamer/streamrelay.go index 531d856..45aa5fe 100644 --- a/datastreamer/streamrelay.go +++ b/datastreamer/streamrelay.go @@ -13,7 +13,7 @@ type StreamRelay struct { } // NewRelay creates a new data stream relay -func NewRelay(server string, port uint16, version uint8, systemID uint64, streamType StreamType, fileName string, writeTimeout time.Duration, cfg *log.Config) (*StreamRelay, error) { +func NewRelay(server string, port uint16, version uint8, systemID uint64, streamType StreamType, fileName string, writeTimeout time.Duration, inactivityTimeout time.Duration, inactivityCheckInterval time.Duration, cfg *log.Config) (*StreamRelay, error) { var r StreamRelay var err error @@ -25,7 +25,7 @@ func NewRelay(server string, port uint16, version uint8, systemID uint64, stream } // Create server side - r.server, err = NewServer(port, version, systemID, streamType, fileName, writeTimeout, cfg) + r.server, err = NewServer(port, version, systemID, streamType, fileName, writeTimeout, inactivityTimeout, inactivityCheckInterval, cfg) if err != nil { log.Errorf("Error creating relay server side: %v", err) return nil, err diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index e37473b..da86b23 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -3,6 +3,7 @@ package datastreamer import ( "encoding/binary" "errors" + "fmt" "io" "math" "net" @@ -108,10 +109,12 @@ var ( // StreamServer type to manage a data stream server type StreamServer struct { - port uint16 // Server stream port - fileName string // Stream file name - writeTimeout time.Duration // Timeout for write operations on client connection - started bool // Flag server started + port uint16 // Server stream port + fileName string // Stream file name + writeTimeout time.Duration // Timeout for write operations on client connection + inactivityTimeout time.Duration // Inactivity timeout to kill a client connection + inactivityCheckInterval time.Duration // Time interval to check for client connections that have reached the inactivity timeout and kill them + started bool // Flag server started version uint8 systemID uint64 @@ -138,10 +141,15 @@ type streamAO struct { // client type for the server to manage clients type client struct { - conn net.Conn - status ClientStatus - fromEntry uint64 - clientId string + conn net.Conn + status ClientStatus + fromEntry uint64 + clientId string + lastActivity time.Time +} + +func (c *client) updateActivity() { + c.lastActivity = time.Now() } // ResultEntry type for a result entry @@ -153,13 +161,15 @@ type ResultEntry struct { } // NewServer creates a new data stream server -func NewServer(port uint16, version uint8, systemID uint64, streamType StreamType, fileName string, writeTimeout time.Duration, cfg *log.Config) (*StreamServer, error) { +func NewServer(port uint16, version uint8, systemID uint64, streamType StreamType, fileName string, writeTimeout time.Duration, inactivityTimeout time.Duration, inactivityCheckInterval time.Duration, cfg *log.Config) (*StreamServer, error) { // Create the server data stream s := StreamServer{ - port: port, - fileName: fileName, - writeTimeout: writeTimeout, - started: false, + port: port, + fileName: fileName, + writeTimeout: writeTimeout, + inactivityTimeout: inactivityTimeout, + inactivityCheckInterval: inactivityCheckInterval, + started: false, version: version, systemID: systemID, @@ -221,6 +231,9 @@ func (s *StreamServer) Start() error { // Goroutine to broadcast committed atomic operations go s.broadcastAtomicOp() + // Goroutine to check inactivity timeout in client connections + go s.checkClientInactivity() + // Goroutine to wait for clients connections log.Infof("Listening on port: %d", s.port) go s.waitConnections() @@ -231,6 +244,27 @@ func (s *StreamServer) Start() error { return nil } +// checkClientInactivity kills all the clients that reach write inactivity timeout +func (s *StreamServer) checkClientInactivity() { + for { + time.Sleep(s.inactivityCheckInterval) + + var clientsToKill = map[string]struct{}{} + s.mutexClients.Lock() + for _, client := range s.clients { + if client.lastActivity.Add(s.inactivityTimeout).Before(time.Now()) { + clientsToKill[client.clientId] = struct{}{} + } + } + s.mutexClients.Unlock() + + for clientId := range clientsToKill { + log.Infof("killing inactive client %s", clientId) + s.killClient(clientId) + } + } +} + // waitConnections waits for a new client connection and creates a goroutine to manages it func (s *StreamServer) waitConnections() { defer s.ln.Close() @@ -264,23 +298,25 @@ func (s *StreamServer) handleConnection(conn net.Conn) { log.Debugf("New connection: %s", clientId) s.mutexClients.Lock() - s.clients[clientId] = &client{ - conn: conn, - status: csStopped, - fromEntry: 0, - clientId: clientId, - } + client := &client{ + conn: conn, + status: csStopped, + fromEntry: 0, + clientId: clientId, + lastActivity: time.Now(), + } + s.clients[clientId] = client s.mutexClients.Unlock() for { // Read command - command, err := readFullUint64(conn) + command, err := readFullUint64(client) if err != nil { s.killClient(clientId) return } // Read stream type - stUint64, err := readFullUint64(conn) + stUint64, err := readFullUint64(client) if err != nil { s.killClient(clientId) return @@ -399,7 +435,7 @@ func (s *StreamServer) CommitAtomicOp() error { start := time.Now().UnixNano() defer log.Infof("CommitAtomicOp process time: %vns", time.Now().UnixNano()-start) - log.Infof("!AtomicOp COMMIT (%d)", s.atomicOp.startEntry) + log.Infof("commit datastream atomic operation, startEntry: %d", s.atomicOp.startEntry) if s.atomicOp.status != aoStarted { log.Errorf("Commit not allowed, AtomicOp is not in the started state") return ErrCommitNotAllowed @@ -421,9 +457,7 @@ func (s *StreamServer) CommitAtomicOp() error { atomic.entries = make([]FileEntry, len(s.atomicOp.entries)) copy(atomic.entries, s.atomicOp.entries) - log.Infof("[ds-debug] CommitAtomicOp before send to channel") s.stream <- atomic - log.Infof("[ds-debug] CommitAtomicOp after send to channel") // No atomic operation in progress s.clearAtomicOp() @@ -436,7 +470,7 @@ func (s *StreamServer) RollbackAtomicOp() error { start := time.Now().UnixNano() defer log.Debugf("RollbackAtomicOp process time: %vns", time.Now().UnixNano()-start) - log.Infof("!AtomicOp ROLLBACK (%d)", s.atomicOp.startEntry) + log.Infof("rollback datastream atomic operation, startEntry: %d", s.atomicOp.startEntry) if s.atomicOp.status != aoStarted { log.Errorf("Rollback not allowed, AtomicOp is not in the started state") return ErrRollbackNotAllowed @@ -648,31 +682,24 @@ func (s *StreamServer) broadcastAtomicOp() { broadcastOp := <-s.stream start := time.Now().UnixMilli() var killedClientMap = map[string]struct{}{} - log.Infof("[ds-debug] broadcastAtomicOp before mutexClients lock") s.mutexClients.Lock() // For each connected and started client - log.Infof("Clients: %d, AO-entries: %d", len(s.clients), len(broadcastOp.entries)) + log.Infof("sending %d datastream entries to %d clients", len(broadcastOp.entries), len(s.clients)) for id, cli := range s.clients { - log.Infof("Client %s status %d[%s]", id, cli.status, StrClientStatus[cli.status]) + log.Debugf("Client %s status %d[%s]", id, cli.status, StrClientStatus[cli.status]) if cli.status != csSynced { continue } // Send entries - for index, entry := range broadcastOp.entries { + for _, entry := range broadcastOp.entries { if entry.Number >= cli.fromEntry { log.Debugf("Sending data entry %d (type %d) to %s", entry.Number, entry.Type, id) binaryEntry := encodeFileEntryToBinary(entry) // Send the file data entry if cli.conn != nil { - if index == 0 { - log.Infof("[ds-debug] before conn Write %s", id) - } - _, err = TimeoutWrite(cli.conn, binaryEntry, s.writeTimeout) - if index == 0 { - log.Infof("[ds-debug] after conn Write %s", id) - } + _, err = TimeoutWrite(cli, binaryEntry, s.writeTimeout) } else { err = ErrNilConnection } @@ -686,7 +713,6 @@ func (s *StreamServer) broadcastAtomicOp() { } } s.mutexClients.Unlock() - log.Infof("[ds-debug] broadcastAtomicOp after mutexClients unlock") for k := range killedClientMap { s.killClient(k) @@ -793,7 +819,7 @@ func (s *StreamServer) processCommand(command Command, client *client) error { // processCmdStart processes the TCP Start command from the clients func (s *StreamServer) processCmdStart(client *client) error { // Read from entry number parameter - fromEntry, err := readFullUint64(client.conn) + fromEntry, err := readFullUint64(client) if err != nil { return err } @@ -827,7 +853,7 @@ func (s *StreamServer) processCmdStart(client *client) error { // processCmdStartBookmark processes the TCP Start Bookmark command from the clients func (s *StreamServer) processCmdStartBookmark(client *client) error { // Read bookmark length parameter - length, err := readFullUint32(client.conn) + length, err := readFullUint32(client) if err != nil { return err } @@ -839,7 +865,7 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { } // Read bookmark parameter - bookmark, err := readFullBytes(length, client.conn) + bookmark, err := readFullBytes(length, client) if err != nil { return err } @@ -898,7 +924,7 @@ func (s *StreamServer) processCmdHeader(client *client) error { // Send header entry to the client if client.conn != nil { - _, err = TimeoutWrite(client.conn, binaryHeader, s.writeTimeout) + _, err = TimeoutWrite(client, binaryHeader, s.writeTimeout) } else { err = ErrNilConnection } @@ -912,7 +938,7 @@ func (s *StreamServer) processCmdHeader(client *client) error { // processCmdEntry processes the TCP Entry command from the clients func (s *StreamServer) processCmdEntry(client *client) error { // Read from entry number parameter - entryNumber, err := readFullUint64(client.conn) + entryNumber, err := readFullUint64(client) if err != nil { return err } @@ -939,7 +965,7 @@ func (s *StreamServer) processCmdEntry(client *client) error { // Send entry to the client if client.conn != nil { - _, err = TimeoutWrite(client.conn, binaryEntry, s.writeTimeout) + _, err = TimeoutWrite(client, binaryEntry, s.writeTimeout) } else { err = ErrNilConnection } @@ -954,7 +980,7 @@ func (s *StreamServer) processCmdEntry(client *client) error { // processCmdBookmark processes the TCP Bookmark command from the clients func (s *StreamServer) processCmdBookmark(client *client) error { // Read bookmark length parameter - length, err := readFullUint32(client.conn) + length, err := readFullUint32(client) if err != nil { return err } @@ -966,7 +992,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { } // Read bookmark parameter - bookmark, err := readFullBytes(length, client.conn) + bookmark, err := readFullBytes(length, client) if err != nil { return err } @@ -993,7 +1019,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { // Send entry to the client if client.conn != nil { - _, err = TimeoutWrite(client.conn, binaryEntry, s.writeTimeout) + _, err = TimeoutWrite(client, binaryEntry, s.writeTimeout) } else { err = ErrNilConnection } @@ -1032,7 +1058,7 @@ func (s *StreamServer) streamingFromEntry(client *client, fromEntry uint64) erro binaryEntry := encodeFileEntryToBinary(iterator.Entry) log.Debugf("Sending data entry %d (type %d) to %s", iterator.Entry.Number, iterator.Entry.Type, client.clientId) if client.conn != nil { - _, err = TimeoutWrite(client.conn, binaryEntry, s.writeTimeout) + _, err = TimeoutWrite(client, binaryEntry, s.writeTimeout) } else { err = ErrNilConnection } @@ -1069,7 +1095,7 @@ func (s *StreamServer) sendResultEntry(errorNum uint32, errorStr string, client // Send the result entry to the client var err error if client.conn != nil { - _, err = TimeoutWrite(client.conn, binaryEntry, s.writeTimeout) + _, err = TimeoutWrite(client, binaryEntry, s.writeTimeout) } else { err = ErrNilConnection } @@ -1103,16 +1129,10 @@ func (s *StreamServer) BookmarkPrintDump() { } // readFullUint64 reads from a connection a complete uint64 -func readFullUint64(conn net.Conn) (uint64, error) { +func readFullUint64(client *client) (uint64, error) { // Read 8 bytes (uint64 value) - buffer := make([]byte, 8) // nolint:gomnd - _, err := io.ReadFull(conn, buffer) + buffer, err := readFullBytes(8, client) // nolint:gomnd if err != nil { - if err == io.EOF { - log.Debugf("Client %s close connection", conn.RemoteAddr().String()) - } else { - log.Warnf("Error reading from client: %v", err) - } return 0, err } @@ -1123,16 +1143,10 @@ func readFullUint64(conn net.Conn) (uint64, error) { } // readFullUint32 reads from a connection a complete uint32 -func readFullUint32(conn net.Conn) (uint32, error) { +func readFullUint32(client *client) (uint32, error) { // Read 4 bytes (uint32 value) - buffer := make([]byte, 4) // nolint:gomnd - _, err := io.ReadFull(conn, buffer) + buffer, err := readFullBytes(4, client) // nolint:gomnd if err != nil { - if err == io.EOF { - log.Debugf("Client %s close connection", conn.RemoteAddr().String()) - } else { - log.Warnf("Error reading from client: %v", err) - } return 0, err } @@ -1143,21 +1157,26 @@ func readFullUint32(conn net.Conn) (uint32, error) { } // readFullBytes reads from a connection number length of bytes -func readFullBytes(length uint32, conn net.Conn) ([]byte, error) { - var err error = nil +func readFullBytes(length uint32, client *client) ([]byte, error) { // Read number length of bytes buffer := make([]byte, length) - if length > 0 { - _, err := io.ReadFull(conn, buffer) - if err != nil { - if err == io.EOF { - log.Debugf("Client %s close connection", conn.RemoteAddr().String()) - } else { - log.Warnf("Error reading from client: %v", err) - } + + if length == 0 { + return buffer, fmt.Errorf("read length must be greater than 0") + } + + _, err := io.ReadFull(client.conn, buffer) + if err != nil { + if err == io.EOF { + log.Debugf("Client %s close connection", client.conn.RemoteAddr().String()) + } else { + log.Warnf("Error reading from client %s, error: %v", client.clientId, err) } + return buffer, err } - return buffer, err + + client.updateActivity() + return buffer, nil } // encodeResultEntryToBinary encodes from a result entry type to binary bytes slice @@ -1207,16 +1226,19 @@ func (c Command) IsACommand() bool { } // TimeoutWrite sets a deadline time before write -func TimeoutWrite(conn net.Conn, data []byte, timeout time.Duration) (int, error) { - err := conn.SetWriteDeadline(time.Now().Add(timeout)) +func TimeoutWrite(client *client, data []byte, timeout time.Duration) (int, error) { + err := client.conn.SetWriteDeadline(time.Now().Add(timeout)) if err != nil { log.Warnf("Error setting write deadline: %v", err) } - n, err := conn.Write(data) + n, err := client.conn.Write(data) if err != nil { if errors.Is(err, os.ErrDeadlineExceeded) { - log.Infof("[ds-debug] Write deadline exceeded! %v", err) + log.Debugf("Write deadline exceeded for client %s, error: %v", client.clientId, err) } + } else { + client.updateActivity() } + return n, err } diff --git a/relay/main.go b/relay/main.go index 5b0dd05..f6176d8 100644 --- a/relay/main.go +++ b/relay/main.go @@ -20,11 +20,12 @@ const ( ) type config struct { - Server string - Port uint64 - File string - WriteTimeout time.Duration - Log string + Server string + Port uint64 + File string + WriteTimeout time.Duration + InactivityTimeout time.Duration + Log string } func main() { @@ -61,6 +62,14 @@ func main() { Name: "log", Usage: "log level (debug|info|warn|error)", }, + &cli.Uint64Flag{ + Name: "writetimeout", + Usage: "timeout for write operations on client connections in ms (0=no timeout)", + }, + &cli.Uint64Flag{ + Name: "inactivitytimeout", + Usage: "timeout to kill an inactive client connection in seconds (0=no timeout)", + }, } app.Action = run @@ -75,11 +84,12 @@ func main() { // defaultConfig parses the default configuration values func defaultConfig() (*config, error) { cfg := config{ - Server: "127.0.0.1:6900", - Port: 7900, // nolint:gomnd - File: "datarelay.bin", - WriteTimeout: time.Duration(3 * time.Second), // nolint:gomnd - Log: "info", + Server: "127.0.0.1:6900", + Port: 7900, // nolint:gomnd + File: "datarelay.bin", + WriteTimeout: time.Duration(5 * time.Second), // nolint:gomnd + InactivityTimeout: time.Duration(120 * time.Second), // nolint:gomnd + Log: "info", } viper.SetConfigType("toml") @@ -163,6 +173,16 @@ func run(ctx *cli.Context) error { cfg.Log = logLevel } + writeTimeout := ctx.Uint64("writetimeout") + if writeTimeout != 0 { + cfg.WriteTimeout = time.Duration(writeTimeout * uint64(time.Second)) + } + + inactivityTimeout := ctx.Uint64("inactivitytimeout") + if inactivityTimeout != 0 { + cfg.InactivityTimeout = time.Duration(inactivityTimeout * uint64(time.Second)) + } + // Set log level log.Init(log.Config{ Environment: "development", @@ -173,7 +193,7 @@ func run(ctx *cli.Context) error { log.Infof(">> Relay server started: port[%d] file[%s] server[%s] log[%s]", cfg.Port, cfg.File, cfg.Server, cfg.Log) // Create relay server - r, err := datastreamer.NewRelay(cfg.Server, uint16(cfg.Port), 1, 137, StSequencer, cfg.File, cfg.WriteTimeout, nil) // nolint:gomnd + r, err := datastreamer.NewRelay(cfg.Server, uint16(cfg.Port), 1, 137, StSequencer, cfg.File, cfg.WriteTimeout, cfg.InactivityTimeout, 5*time.Second, nil) // nolint:gomnd if err != nil { log.Errorf(">> Relay server: NewRelay error! (%v)", err) return err From 8ed72770d962678c78ef425c8dffb50a26871ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= <93934272+Stefan-Ethernal@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:02:34 +0200 Subject: [PATCH 06/18] Introduce more rules to the linter configuration (#121) * Introduce new linter rules and fix the existing violations * Switch to RWMutex usage for clients map * Fix warning (don't enable already enabled truncateCmp check for gocritic) * Install the latest golangci-lint tool * Disable magic number check and unconvert time.Duration --- .golangci.yml | 71 ++++++++++-- Makefile | 2 +- cmd/main.go | 174 +++++++++++++++++++----------- datastreamer/config.go | 3 +- datastreamer/datastreamer_test.go | 26 +++-- datastreamer/streambookmark.go | 5 +- datastreamer/streamclient.go | 128 +++++++++++----------- datastreamer/streamfile.go | 65 +++++------ datastreamer/streamrelay.go | 7 +- datastreamer/streamserver.go | 155 +++++++++++++------------- log/config.go | 6 +- log/log.go | 6 +- log/log_test.go | 2 +- relay/main.go | 34 +++--- 14 files changed, 410 insertions(+), 274 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 70e7d65..1623a3d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,14 +3,34 @@ run: linters: enable: - - whitespace - - gosec - - gci - - misspell - - gomnd - - gofmt - - goimports - - revive + - gci # Gci controls Go package import order and makes it always deterministic. + - mnd # An analyzer to detect magic numbers. + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. + - whitespace # Tool for detection of leading and trailing whitespace + - wastedassign # Finds wasted assignment statements + - unconvert # Unnecessary type conversions + - tparallel # Detects inappropriate usage of t.Parallel() method in your Go test codes + - thelper # Detects golang test helpers without t.Helper() call and checks the consistency of test helpers + - stylecheck # Stylecheck is a replacement for golint + - prealloc # Finds slice declarations that could potentially be pre-allocated + - predeclared # Finds code that shadows one of Go's predeclared identifiers + - nolintlint # Ill-formed or insufficient nolint directives + - misspell # Misspelled English words in comments + - makezero # Finds slice declarations with non-zero initial length + - lll # Long lines + - importas # Enforces consistent import aliases + - gosec # Security problems + - gofmt # Whether the code was gofmt-ed + - goimports # Unused imports + - goconst # Repeated strings that could be replaced by a constant + - forcetypeassert # Finds forced type assertions + - dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f()) + - dupl # Code clone detection + - errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error + - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13 + - gocritic # Highly extensible Go source code linter providing checks currently missing from other linters. + - errcheck # Errcheck is a go lint rule for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases + - godox # Godox is a linter for TODOs and FIXMEs left in the code linters-settings: revive: @@ -19,6 +39,41 @@ linters-settings: arguments: - disableStutteringCheck + gocritic: + # The checks that should be enabled; can't be combined with 'disabled-checks'; + # See https://go-critic.github.io/overview#checks-overview + # To check which checks are enabled run `GL_DEBUG=gocritic ./build/bin/golangci-lint run` + # By default list of stable checks is used. + enabled-checks: + - ruleguard + + disabled-checks: + - regexpMust + - appendAssign + - rangeValCopy + - exitAfterDefer + - elseif + - dupBranchBody + - assignOp + - singleCaseSwitch + - unlambda + - captLocal + - commentFormatting + - ifElseChain + - importShadow + - paramTypeCombine + - builtinShadow + - typeUnparen + + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". + enabled-tags: + - performance + - diagnostic + - opinionated + disabled-tags: + - experimental + issues: include: - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments diff --git a/Makefile b/Makefile index 3f9372a..30ac4c5 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ build-docker-nc: check-docker .PHONY: install-linter install-linter: ## Installs the linter - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.52.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.59.1 .PHONY: lint lint: ## Runs the linter diff --git a/cmd/main.go b/cmd/main.go index db8d7cb..9485f13 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "math/rand" "os" "os/signal" "strconv" @@ -27,6 +26,11 @@ const ( BookmarkL2Block byte = 0 // BookmarkL2Block bookmark type BookmarkBatch byte = 1 // BookmarkBatch bookmark type + + streamerSystemID = 137 + streamerVersion = 1 + + noneType = "none" ) var ( @@ -68,7 +72,7 @@ func main() { &cli.Uint64Flag{ Name: "port", Usage: "exposed port for clients to connect", - Value: 6900, // nolint:gomnd + Value: 6900, //nolint:mnd DefaultText: "6900", }, &cli.StringFlag{ @@ -86,25 +90,25 @@ func main() { &cli.Uint64Flag{ Name: "sleep", Usage: "initial sleep and sleep between atomic operations in ms", - Value: 0, // nolint:gomnd + Value: 0, DefaultText: "0", }, &cli.Uint64Flag{ Name: "opers", Usage: "number of atomic operations (server will terminate after them)", - Value: 1000000, // nolint:gomnd + Value: 1000000, //nolint:mnd DefaultText: "1000000", }, &cli.Uint64Flag{ Name: "writetimeout", Usage: "timeout for write operations on client connections in ms (0=no timeout)", - Value: 3000, // nolint:gomnd + Value: 3000, //nolint:mnd DefaultText: "3000", }, &cli.Uint64Flag{ Name: "inactivitytimeout", Usage: "timeout to kill an inactive client connection in seconds (0=no timeout)", - Value: 120, // nolint:gomnd + Value: 120, //nolint:mnd DefaultText: "120", }, }, @@ -130,7 +134,7 @@ func main() { &cli.StringFlag{ Name: "frombookmark", Usage: "bookmark to start the sync/streaming from (0..N) (has preference over --from parameter)", - Value: "none", + Value: noneType, }, &cli.BoolFlag{ Name: "header", @@ -140,12 +144,12 @@ func main() { &cli.StringFlag{ Name: "entry", Usage: "entry number to query data (0..N)", - Value: "none", + Value: noneType, }, &cli.StringFlag{ Name: "bookmark", Usage: "entry bookmark to query entry data pointed by it (0..N)", - Value: "none", + Value: noneType, }, &cli.IntFlag{ Name: "bookmarktype", @@ -160,7 +164,7 @@ func main() { &cli.StringFlag{ Name: "dumpbatch", Usage: "batch number to dump data (0..N)", - Value: "none", + Value: noneType, }, &cli.StringFlag{ Name: "log", @@ -185,7 +189,7 @@ func main() { &cli.Uint64Flag{ Name: "port", Usage: "exposed port for clients to connect", - Value: 7900, // nolint:gomnd + Value: 7900, //nolint:mnd DefaultText: "7900", }, &cli.StringFlag{ @@ -203,13 +207,13 @@ func main() { &cli.Uint64Flag{ Name: "writetimeout", Usage: "timeout for write operations on client connections in ms (0=no timeout)", - Value: 3000, // nolint:gomnd + Value: 3000, //nolint:mnd DefaultText: "3000", }, &cli.Uint64Flag{ Name: "inactivitytimeout", Usage: "timeout to kill an inactive client connection in seconds (0=no timeout)", - Value: 120, // nolint:gomnd + Value: 120, //nolint:mnd DefaultText: "120", }, }, @@ -249,7 +253,9 @@ func runServer(ctx *cli.Context) error { } // Create stream server - s, err := datastreamer.NewServer(uint16(port), 1, 137, StSequencer, file, time.Duration(writeTimeout)*time.Millisecond, time.Duration(inactivityTimeout)*time.Second, 5*time.Second, nil) // nolint:gomnd + s, err := datastreamer.NewServer(uint16(port), streamerVersion, streamerSystemID, StSequencer, file, + time.Duration(writeTimeout)*time.Millisecond, time.Duration(inactivityTimeout)*time.Second, + 5*time.Second, nil) //nolint:mnd if err != nil { return err } @@ -267,12 +273,12 @@ func runServer(ctx *cli.Context) error { end := make(chan uint8) go func(chan uint8) { - var testRollback bool = false - var latestRollback uint64 = 0 + var ( + testRollback bool + latestRollback uint64 + ) - rand.Seed(time.Now().UnixNano()) - - init := s.GetHeader().TotalEntries / 5 // nolint:gomnd + init := s.GetHeader().TotalEntries / 5 //nolint:mnd // Atomic Operations loop for n := uint64(0); n < numOpersLoop; n++ { @@ -302,7 +308,7 @@ func runServer(ctx *cli.Context) error { return } // 4.Tx - numTx := 1 //rand.Intn(20) + 1 + numTx := 1 // rand.Intn(20) + 1 for i := 1; i <= numTx; i++ { _, err = s.AddStreamEntry(EtL2Tx, fakeDataTx()) if err != nil { @@ -348,41 +354,70 @@ func runServer(ctx *cli.Context) error { } func fakeBookmark(bookType byte, value uint64) []byte { - bookmark := []byte{bookType} // nolint:gomnd + bookmark := []byte{bookType} bookmark = binary.BigEndian.AppendUint64(bookmark, value) return bookmark } func fakeDataBlockStart(blockNum uint64) []byte { dataBlockStart := make([]byte, 0) - dataBlockStart = binary.BigEndian.AppendUint64(dataBlockStart, 101) // nolint:gomnd + dataBlockStart = binary.BigEndian.AppendUint64(dataBlockStart, 101) //nolint:mnd dataBlockStart = binary.BigEndian.AppendUint64(dataBlockStart, blockNum) dataBlockStart = binary.BigEndian.AppendUint64(dataBlockStart, uint64(time.Now().Unix())) - dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 10) // nolint:gomnd - dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 1000) // nolint:gomnd - dataBlockStart = append(dataBlockStart, []byte{10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17}...) - dataBlockStart = append(dataBlockStart, []byte{10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17}...) - dataBlockStart = append(dataBlockStart, []byte{20, 21, 22, 23, 24, 20, 21, 22, 23, 24, 20, 21, 22, 23, 24, 20, 21, 22, 23, 24}...) - dataBlockStart = binary.BigEndian.AppendUint16(dataBlockStart, 5) // nolint:gomnd - dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 137) // nolint:gomnd + dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 10) //nolint:mnd + dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 1000) //nolint:mnd + dataBlockStart = append(dataBlockStart, + []byte{ + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + }...) + dataBlockStart = append(dataBlockStart, + []byte{10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + }...) + dataBlockStart = append(dataBlockStart, + []byte{ + 20, 21, 22, 23, 24, 20, 21, 22, 23, 24, + 20, 21, 22, 23, 24, 20, 21, 22, 23, 24, + }...) + dataBlockStart = binary.BigEndian.AppendUint16(dataBlockStart, 5) //nolint:mnd + dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 137) //nolint:mnd return dataBlockStart } func fakeDataTx() []byte { - dataTx := make([]byte, 0) // nolint:gomnd - dataTx = append(dataTx, 128) // nolint:gomnd - dataTx = append(dataTx, 1) // nolint:gomnd - dataTx = append(dataTx, []byte{10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17, 10, 11, 12, 13, 14, 15, 16, 17}...) - dataTx = binary.BigEndian.AppendUint32(dataTx, 5) // nolint:gomnd - dataTx = append(dataTx, []byte{1, 2, 3, 4, 5}...) // nolint:gomnd + dataTx := make([]byte, 0) + dataTx = append(dataTx, 128, 1) //nolint:mnd + dataTx = append(dataTx, + []byte{ + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17, + 10, 11, 12, 13, 14, 15, 16, 17}...) + dataTx = binary.BigEndian.AppendUint32(dataTx, 5) //nolint:mnd + dataTx = append(dataTx, []byte{1, 2, 3, 4, 5}...) return dataTx } func fakeDataBlockEnd(blockNum uint64) []byte { dataBlockEnd := make([]byte, 0) dataBlockEnd = binary.BigEndian.AppendUint64(dataBlockEnd, blockNum) - dataBlockEnd = append(dataBlockEnd, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}...) - dataBlockEnd = append(dataBlockEnd, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}...) + dataBlockEnd = append(dataBlockEnd, []byte{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + }...) + dataBlockEnd = append(dataBlockEnd, []byte{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + }...) return dataBlockEnd } @@ -422,7 +457,7 @@ func runClient(ctx *cli.Context) error { // Set process entry callback function if !sanityCheck { - if paramDumpBatch != "none" { + if paramDumpBatch != noneType { if from == "latest" { from = "0" } @@ -459,7 +494,7 @@ func runClient(ctx *cli.Context) error { } // Query entry option - if queryEntry != "none" { + if queryEntry != noneType { qEntry, err := strconv.Atoi(queryEntry) if err != nil { return err @@ -468,23 +503,25 @@ func runClient(ctx *cli.Context) error { if err != nil { log.Infof("Error: %v", err) } else { - log.Infof("QUERY ENTRY %d: Entry[%d] Length[%d] Type[%d] Data[%v]", qEntry, entry.Number, entry.Length, entry.Type, entry.Data) + log.Infof("QUERY ENTRY %d: Entry[%d] Length[%d] Type[%d] Data[%v]", + qEntry, entry.Number, entry.Length, entry.Type, entry.Data) } return nil } // Query bookmark option - if queryBookmark != "none" { + if queryBookmark != noneType { qBookmark, err := strconv.Atoi(queryBookmark) if err != nil { return err } - qBook := []byte{bookType} // nolint:gomnd + qBook := []byte{bookType} entry, err := c.ExecCommandGetBookmark(binary.BigEndian.AppendUint64(qBook, uint64(qBookmark))) if err != nil { log.Infof("Error: %v", err) } else { - log.Infof("QUERY BOOKMARK (%d)%v: Entry[%d] Length[%d] Type[%d] Data[%v]", bookType, qBook, entry.Number, entry.Length, entry.Type, entry.Data) + log.Infof("QUERY BOOKMARK (%d)%v: Entry[%d] Length[%d] Type[%d] Data[%v]", + bookType, qBook, entry.Number, entry.Length, entry.Type, entry.Data) } return nil } @@ -495,13 +532,13 @@ func runClient(ctx *cli.Context) error { return err } - if fromBookmark != "none" { + if fromBookmark != noneType { // Command StartBookmark: Sync and start streaming receive from bookmark fromBookNum, err := strconv.Atoi(fromBookmark) if err != nil { return err } - bookmark := []byte{bookType} // nolint:gomnd + bookmark := []byte{bookType} err = c.ExecCommandStartBookmark(binary.BigEndian.AppendUint64(bookmark, uint64(fromBookNum))) if err != nil { return err @@ -509,7 +546,7 @@ func runClient(ctx *cli.Context) error { } else { // Command start: Sync and start streaming receive from entry number var fromEntry uint64 - if from == "latest" { // nolint:gomnd + if from == "latest" { fromEntry = header.TotalEntries } else { fromNum, err := strconv.Atoi(from) @@ -541,12 +578,15 @@ func runClient(ctx *cli.Context) error { // printEntryNum prints basic data of the entry func printEntryNum(e *datastreamer.FileEntry, c *datastreamer.StreamClient, s *datastreamer.StreamServer) error { - log.Infof("PROCESS entry(%s): %d | %d | %d | %d", c.Id, e.Number, e.Length, e.Type, len(e.Data)) + log.Infof("PROCESS entry(%s): %d | %d | %d | %d", c.ID, e.Number, e.Length, e.Type, len(e.Data)) return nil } // checkEntryBlockSanity checks entry, bookmark, and block sequence consistency -func checkEntryBlockSanity(e *datastreamer.FileEntry, c *datastreamer.StreamClient, s *datastreamer.StreamServer) error { +func checkEntryBlockSanity( + e *datastreamer.FileEntry, + c *datastreamer.StreamClient, + s *datastreamer.StreamServer) error { // Sanity check initialization if !initSanityEntry { initSanityEntry = true @@ -586,9 +626,11 @@ func checkEntryBlockSanity(e *datastreamer.FileEntry, c *datastreamer.StreamClie if sanityBlock > 0 { if blockNum != sanityBlock { if blockNum < sanityBlock { - log.Infof("(X) SANITY CHECK failed (%d): REPEATED blocks? Received[%d] | Block expected[%d]", e.Number, blockNum, sanityBlock) + log.Infof("(X) SANITY CHECK failed (%d): REPEATED blocks? Received[%d] | Block expected[%d]", + e.Number, blockNum, sanityBlock) } else { - log.Infof("(X) SANITY CHECK failed (%d): GAP blocks? Received[%d] | Block expected[%d]", e.Number, blockNum, sanityBlock) + log.Infof("(X) SANITY CHECK failed (%d): GAP blocks? Received[%d] | Block expected[%d]", + e.Number, blockNum, sanityBlock) } sanityBlock = blockNum } @@ -617,16 +659,19 @@ func checkEntryBlockSanity(e *datastreamer.FileEntry, c *datastreamer.StreamClie if sanityBookmark0 > 0 { if bookmarkNum != sanityBookmark0 { if bookmarkNum < sanityBookmark0 { - log.Infof("(X) SANITY CHECK failed (%d): REPEATED L2block bookmarks? Received[%d] | Bookmark expected[%d]", e.Number, bookmarkNum, sanityBookmark0) + log.Infof("(X) SANITY CHECK failed (%d): REPEATED L2block bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmark0) } else { - log.Infof("(X) SANITY CHECK failed (%d): GAP L2block bookmarks? Received[%d] | Bookmark expected[%d]", e.Number, bookmarkNum, sanityBookmark0) + log.Infof("(X) SANITY CHECK failed (%d): GAP L2block bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmark0) } sanityBookmark0 = bookmarkNum } } else { if bookmarkNum != 0 { if initSanityBookmark { - log.Infof("(X) SANITY CHECK failed (%d): L2block Bookmark received[%d] | Bookmark expected[0]", e.Number, bookmarkNum) + log.Infof("(X) SANITY CHECK failed (%d): L2block Bookmark received[%d] | Bookmark expected[0]", + e.Number, bookmarkNum) sanityBookmark0 = 0 } else { log.Infof("SANITY CHECK note (%d): First L2block Bookmark received[%d]", e.Number, bookmarkNum) @@ -641,16 +686,19 @@ func checkEntryBlockSanity(e *datastreamer.FileEntry, c *datastreamer.StreamClie if sanityBookmark1 > 0 { if bookmarkNum != sanityBookmark1 { if bookmarkNum < sanityBookmark1 { - log.Infof("(X) SANITY CHECK failed (%d): REPEATED Batch bookmarks? Received[%d] | Bookmark expected[%d]", e.Number, bookmarkNum, sanityBookmark1) + log.Infof("(X) SANITY CHECK failed (%d): REPEATED Batch bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmark1) } else { - log.Infof("(X) SANITY CHECK failed (%d): GAP Batch bookmarks? Received[%d] | Bookmark expected[%d]", e.Number, bookmarkNum, sanityBookmark1) + log.Infof("(X) SANITY CHECK failed (%d): GAP Batch bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmark1) } sanityBookmark1 = bookmarkNum } } else { if bookmarkNum != 0 { if initSanityBookmark { - log.Infof("(X) SANITY CHECK failed (%d): Batch Bookmark received[%d] | Bookmark expected[0]", e.Number, bookmarkNum) + log.Infof("(X) SANITY CHECK failed (%d): Batch Bookmark received[%d] | Bookmark expected[0]", + e.Number, bookmarkNum) sanityBookmark1 = 0 } else { log.Infof("SANITY CHECK note (%d): First Batch Bookmark received[%d]", e.Number, bookmarkNum) @@ -692,9 +740,10 @@ func doDumpBatchData(e *datastreamer.FileEntry, c *datastreamer.StreamClient, s // L2 block start if e.Type == EtL2BlockStart { batchNumber := binary.BigEndian.Uint64(e.Data[0:8]) - if batchNumber < dumpBatchNumber { + switch { + case batchNumber < dumpBatchNumber: return nil - } else if (batchNumber > dumpBatchNumber) || (e.Number+1 >= c.GetTotalEntries()) { + case (batchNumber > dumpBatchNumber) || (e.Number+1 >= c.GetTotalEntries()): log.Infof("DUMP BATCH finished! First entry[%d], last entry[%d], first block[%d], last block[%d], total tx[%d]", dumpEntryFirst, dumpEntryLast, dumpBlockFirst, dumpBlockLast, dumpTotalTx) @@ -723,7 +772,8 @@ func doDumpBatchData(e *datastreamer.FileEntry, c *datastreamer.StreamClient, s } return errors.New("dump batch finished") - } else if batchNumber == dumpBatchNumber { + + case batchNumber == dumpBatchNumber: initDumpBatch = true blockNum := binary.BigEndian.Uint64(e.Data[8:16]) @@ -743,7 +793,7 @@ func doDumpBatchData(e *datastreamer.FileEntry, c *datastreamer.StreamClient, s } dumpEntryLast = e.Number - dumpBatchData = dumpBatchData + fmt.Sprintf("%02x%08x%08x%016x%x", 2, e.Length, e.Type, e.Number, e.Data) // nolint:gomnd + dumpBatchData += fmt.Sprintf("%02x%08x%08x%016x%x", 2, e.Length, e.Type, e.Number, e.Data) //nolint:mnd } return nil } @@ -771,7 +821,9 @@ func runRelay(ctx *cli.Context) error { inactivityTimeout := ctx.Uint64("inactivitytimeout") // Create relay server - r, err := datastreamer.NewRelay(server, uint16(port), 1, 137, StSequencer, file, time.Duration(writeTimeout)*time.Millisecond, time.Duration(inactivityTimeout)*time.Second, 5*time.Second, nil) // nolint:gomnd + r, err := datastreamer.NewRelay(server, uint16(port), streamerVersion, streamerSystemID, StSequencer, file, + time.Duration(writeTimeout)*time.Millisecond, time.Duration(inactivityTimeout)*time.Second, + 5*time.Second, nil) //nolint:mnd if err != nil { return err } diff --git a/datastreamer/config.go b/datastreamer/config.go index 0ab6c8c..874ff9a 100644 --- a/datastreamer/config.go +++ b/datastreamer/config.go @@ -16,7 +16,8 @@ type Config struct { WriteTimeout time.Duration // InactivityTimeout is the timeout to kill an inactive client connection InactivityTimeout time.Duration - // InactivityCheckInterval is the time interval to check for client connections that have reached the inactivity timeout to kill them + // InactivityCheckInterval is the time interval to check for + // client connections that have reached the inactivity timeout to kill them InactivityCheckInterval time.Duration // Log Log log.Config `mapstructure:"Log"` diff --git a/datastreamer/datastreamer_test.go b/datastreamer/datastreamer_test.go index 9874d37..9239896 100644 --- a/datastreamer/datastreamer_test.go +++ b/datastreamer/datastreamer_test.go @@ -78,7 +78,7 @@ func (t TestEntry) Encode() []byte { bytes := make([]byte, 0) bytes = binary.BigEndian.AppendUint64(bytes, t.FieldA) bytes = append(bytes, t.FieldB[:]...) - bytes = append(bytes, t.FieldC[:]...) + bytes = append(bytes, t.FieldC...) return bytes } @@ -102,7 +102,7 @@ var ( Level: "debug", Outputs: []string{"stdout"}, }, - WriteTimeout: time.Duration(3 * time.Second), + WriteTimeout: 3 * time.Second, } leveldb = config.Filename[0:strings.IndexRune(config.Filename, '.')] + ".db" streamServer *datastreamer.StreamServer @@ -201,7 +201,8 @@ func TestServer(t *testing.T) { if err != nil { panic(err) } - streamServer, err = datastreamer.NewServer(config.Port, 1, 137, streamType, config.Filename, config.WriteTimeout, config.InactivityTimeout, 5*time.Second, &config.Log) // nolint:gomnd + streamServer, err = datastreamer.NewServer(config.Port, 1, 137, streamType, + config.Filename, config.WriteTimeout, config.InactivityTimeout, 5*time.Second, &config.Log) if err != nil { panic(err) } @@ -269,6 +270,7 @@ func TestServer(t *testing.T) { // Case: Get entry data of an entry number that doesn't exist -> FAIL entry, err = streamServer.GetEntry(3) require.EqualError(t, datastreamer.ErrInvalidEntryNumber, err.Error()) + require.Equal(t, datastreamer.FileEntry{}, entry) // Case: Get entry number pointed by bookmark that exists -> OK entryNumber, err = streamServer.GetBookmark(testBookmark.Encode()) @@ -357,6 +359,7 @@ func TestServer(t *testing.T) { // Case: Get entry data of previous rollback entry number (doesn't exist) -> FAIL entry, err = streamServer.GetEntry(7) require.EqualError(t, datastreamer.ErrInvalidEntryNumber, err.Error()) + require.Equal(t, datastreamer.FileEntry{}, entry) // Case: Truncate file with atomic operation in progress -> FAIL err = streamServer.StartAtomicOp() @@ -379,8 +382,10 @@ func TestServer(t *testing.T) { // Case: Get entries included in previous file truncate (don't exist) -> FAIL entry, err = streamServer.GetEntry(6) require.EqualError(t, datastreamer.ErrInvalidEntryNumber, err.Error()) + require.Equal(t, datastreamer.FileEntry{}, entry) entry, err = streamServer.GetEntry(5) require.EqualError(t, datastreamer.ErrInvalidEntryNumber, err.Error()) + require.Equal(t, datastreamer.FileEntry{}, entry) // Case: Get entry not included in previous file truncate -> OK entry, err = streamServer.GetEntry(4) @@ -394,10 +399,11 @@ func TestServer(t *testing.T) { entryLength := len(testEntries[4].Encode()) + datastreamer.FixedSizeFileEntry bytesAvailable := datastreamer.PageDataSize - (streamServer.GetHeader().TotalLength - datastreamer.PageHeaderSize) numEntries := bytesAvailable / uint64(entryLength) - log.Debugf(">>> totalLength: %d | bytesAvailable: %d | entryLength: %d | numEntries: %d", streamServer.GetHeader().TotalLength, bytesAvailable, entryLength, numEntries) + log.Debugf(">>> totalLength: %d | bytesAvailable: %d | entryLength: %d | numEntries: %d", + streamServer.GetHeader().TotalLength, bytesAvailable, entryLength, numEntries) lastEntry := entryNumber - 2 // 2 entries truncated - lastEntry = lastEntry - 1 + lastEntry-- err = streamServer.StartAtomicOp() require.NoError(t, err) @@ -405,15 +411,17 @@ func TestServer(t *testing.T) { lastEntry++ entryNumber, err = streamServer.AddStreamEntry(entryType1, testEntries[4].Encode()) require.NoError(t, err) - require.Equal(t, uint64(lastEntry), entryNumber) + require.Equal(t, lastEntry, entryNumber) } err = streamServer.CommitAtomicOp() require.NoError(t, err) - bytesAvailable = datastreamer.PageDataSize - ((streamServer.GetHeader().TotalLength - datastreamer.PageHeaderSize) % datastreamer.PageDataSize) + bytesAvailable = datastreamer.PageDataSize - + ((streamServer.GetHeader().TotalLength - datastreamer.PageHeaderSize) % datastreamer.PageDataSize) numEntries = bytesAvailable / uint64(entryLength) - log.Debugf(">>> totalLength: %d | bytesAvailable: %d | entryLength: %d | numEntries: %d", streamServer.GetHeader().TotalLength, bytesAvailable, entryLength, numEntries) + log.Debugf(">>> totalLength: %d | bytesAvailable: %d | entryLength: %d | numEntries: %d", + streamServer.GetHeader().TotalLength, bytesAvailable, entryLength, numEntries) // Case: Get latest entry stored in the first data page -> OK entry, err = streamServer.GetEntry(entryNumber) @@ -427,7 +435,7 @@ func TestServer(t *testing.T) { entryNumber, err = streamServer.AddStreamEntry(entryType1, testEntries[4].Encode()) require.NoError(t, err) - require.Equal(t, uint64(lastEntry+1), entryNumber) + require.Equal(t, lastEntry+1, entryNumber) err = streamServer.CommitAtomicOp() require.NoError(t, err) diff --git a/datastreamer/streambookmark.go b/datastreamer/streambookmark.go index 8c83196..f1e84a4 100644 --- a/datastreamer/streambookmark.go +++ b/datastreamer/streambookmark.go @@ -2,6 +2,7 @@ package datastreamer import ( "encoding/binary" + "errors" "github.com/0xPolygonHermez/zkevm-data-streamer/log" "github.com/syndtr/goleveldb/leveldb" @@ -55,11 +56,11 @@ func (b *StreamBookmark) AddBookmark(bookmark []byte, entryNum uint64) error { func (b *StreamBookmark) GetBookmark(bookmark []byte) (uint64, error) { // Get the bookmark from DB entry, err := b.db.Get(bookmark, nil) - if err == leveldb.ErrNotFound { + if errors.Is(err, leveldb.ErrNotFound) { // log.Infof("Bookmark not found [%v]: %v", bookmark, err) return 0, err } else if err != nil { - log.Errorf("Error getting bookmark [%v]: %v", bookmark, err) + log.Errorf("Error getting bookmark [%v]: %w", bookmark, err) return 0, err } diff --git a/datastreamer/streamclient.go b/datastreamer/streamclient.go index 984b25a..42a3c2e 100644 --- a/datastreamer/streamclient.go +++ b/datastreamer/streamclient.go @@ -2,6 +2,7 @@ package datastreamer import ( "encoding/binary" + "errors" "io" "net" "time" @@ -14,6 +15,8 @@ const ( headersBuffer = 32 // Buffers for the headers channel entriesBuffer = 128 // Buffers for the entries channel entryRspBuffer = 32 // Buffers for data command response + + defaultTimeout = 5 * time.Second ) // ProcessEntryFunc type of the callback function to process the received entry @@ -24,7 +27,7 @@ type StreamClient struct { server string // Server address to connect IP:port streamType StreamType conn net.Conn - Id string // Client id + ID string // Client id started bool // Flag client started connected bool // Flag client connected to server streaming bool // Flag client streaming started @@ -47,7 +50,7 @@ func NewClient(server string, streamType StreamType) (*StreamClient, error) { c := StreamClient{ server: server, streamType: streamType, - Id: "", + ID: "", started: false, connected: false, streaming: false, @@ -101,20 +104,20 @@ func (c *StreamClient) connectServer() bool { c.conn, err = net.Dial("tcp", c.server) if err != nil { log.Infof("Error connecting to server %s: %v", c.server, err) - time.Sleep(5 * time.Second) // nolint:gomnd + time.Sleep(defaultTimeout) continue } else { // Connected c.connected = true - c.Id = c.conn.LocalAddr().String() - log.Infof("%s Connected to server: %s", c.Id, c.server) + c.ID = c.conn.LocalAddr().String() + log.Infof("%s Connected to server: %s", c.ID, c.server) // Restore streaming if c.streaming { _, _, err = c.execCommand(CmdStart, true, c.nextEntry, nil) if err != nil { c.closeConnection() - time.Sleep(5 * time.Second) // nolint:gomnd + time.Sleep(defaultTimeout) continue } return true @@ -129,7 +132,7 @@ func (c *StreamClient) connectServer() bool { // closeConnection closes connection to the server func (c *StreamClient) closeConnection() { if c.conn != nil { - log.Infof("%s Close connection", c.Id) + log.Infof("%s Close connection", c.ID) c.conn.Close() } c.connected = false @@ -172,8 +175,9 @@ func (c *StreamClient) ExecCommandGetBookmark(fromBookmark []byte) (FileEntry, e } // execCommand executes a valid client TCP command with deferred command result possibility -func (c *StreamClient) execCommand(cmd Command, deferredResult bool, fromEntry uint64, fromBookmark []byte) (HeaderEntry, FileEntry, error) { - log.Infof("%s Executing command %d[%s]...", c.Id, cmd, StrCommand[cmd]) +func (c *StreamClient) execCommand(cmd Command, deferredResult bool, + fromEntry uint64, fromBookmark []byte) (HeaderEntry, FileEntry, error) { + log.Infof("%s Executing command %d[%s]...", c.ID, cmd, StrCommand[cmd]) header := HeaderEntry{} entry := FileEntry{} @@ -185,7 +189,7 @@ func (c *StreamClient) execCommand(cmd Command, deferredResult bool, fromEntry u // Check valid command if !cmd.IsACommand() { - log.Errorf("%s Invalid command %d", c.Id, cmd) + log.Errorf("%s Invalid command %d", c.ID, cmd) return header, entry, ErrInvalidCommand } @@ -203,14 +207,14 @@ func (c *StreamClient) execCommand(cmd Command, deferredResult bool, fromEntry u // Send the command parameters switch cmd { case CmdStart: - log.Infof("%s ...from entry %d", c.Id, fromEntry) + log.Infof("%s ...from entry %d", c.ID, fromEntry) // Send starting/from entry number err = writeFullUint64(fromEntry, c.conn) if err != nil { return header, entry, err } case CmdStartBookmark: - log.Infof("%s ...from bookmark [%v]", c.Id, fromBookmark) + log.Infof("%s ...from bookmark [%v]", c.ID, fromBookmark) // Send starting/from bookmark length err = writeFullUint32(uint32(len(fromBookmark)), c.conn) if err != nil { @@ -222,14 +226,14 @@ func (c *StreamClient) execCommand(cmd Command, deferredResult bool, fromEntry u return header, entry, err } case CmdEntry: - log.Infof("%s ...get entry %d", c.Id, fromEntry) + log.Infof("%s ...get entry %d", c.ID, fromEntry) // Send entry to retrieve err = writeFullUint64(fromEntry, c.conn) if err != nil { return header, entry, err } case CmdBookmark: - log.Infof("%s ...get bookmark [%v]", c.Id, fromBookmark) + log.Infof("%s ...get bookmark [%v]", c.ID, fromBookmark) // Send bookmark length err = writeFullUint32(uint32(len(fromBookmark)), c.conn) if err != nil { @@ -282,7 +286,7 @@ func (c *StreamClient) execCommand(cmd Command, deferredResult bool, fromEntry u // writeFullUint64 writes to connection a complete uint64 func writeFullUint64(value uint64, conn net.Conn) error { - buffer := make([]byte, 8) // nolint:gomnd + buffer := make([]byte, 8) //nolint:mnd binary.BigEndian.PutUint64(buffer, value) var err error @@ -300,7 +304,7 @@ func writeFullUint64(value uint64, conn net.Conn) error { // writeFullUint32 writes to connection a complete uint32 func writeFullUint32(value uint32, conn net.Conn) error { - buffer := make([]byte, 4) // nolint:gomnd + buffer := make([]byte, 4) //nolint:mnd binary.BigEndian.PutUint32(buffer, value) var err error @@ -333,18 +337,11 @@ func writeFullBytes(buffer []byte, conn net.Conn) error { // readDataEntry reads bytes from server connection and returns a data entry type func (c *StreamClient) readDataEntry() (FileEntry, error) { - d := FileEntry{} - // Read the rest of fixed size fields buffer := make([]byte, FixedSizeFileEntry-1) - _, err := io.ReadFull(c.conn, buffer) + err := c.readContent(buffer) if err != nil { - if err == io.EOF { - log.Warnf("%s Server close connection", c.Id) - } else { - log.Errorf("%s Error reading from server: %v", c.Id, err) - } - return d, err + return FileEntry{}, err } packet := []byte{PtData} buffer = append(packet, buffer...) @@ -352,24 +349,19 @@ func (c *StreamClient) readDataEntry() (FileEntry, error) { // Read variable field (data) length := binary.BigEndian.Uint32(buffer[1:5]) if length < FixedSizeFileEntry { - log.Errorf("%s Error reading data entry", c.Id) - return d, ErrReadingDataEntry + log.Errorf("%s Error reading data entry", c.ID) + return FileEntry{}, ErrReadingDataEntry } bufferAux := make([]byte, length-FixedSizeFileEntry) - _, err = io.ReadFull(c.conn, bufferAux) + err = c.readContent(bufferAux) if err != nil { - if err == io.EOF { - log.Warnf("%s Server close connection", c.Id) - } else { - log.Errorf("%s Error reading from server: %v", c.Id, err) - } - return d, err + return FileEntry{}, err } - buffer = append(buffer, bufferAux...) + buffer = append(buffer, bufferAux...) //nolint:makezero // Decode binary data to data entry struct - d, err = DecodeBinaryToFileEntry(buffer) + d, err := DecodeBinaryToFileEntry(buffer) if err != nil { return d, err } @@ -407,18 +399,16 @@ func (c *StreamClient) readHeaderEntry() (HeaderEntry, error) { // readResultEntry reads bytes from server connection and returns a result entry type func (c *StreamClient) readResultEntry() (ResultEntry, error) { - e := ResultEntry{} - // Read the rest of fixed size fields buffer := make([]byte, FixedSizeResultEntry-1) _, err := io.ReadFull(c.conn, buffer) if err != nil { - if err == io.EOF { - log.Warnf("%s Server close connection", c.Id) + if errors.Is(err, io.EOF) { + log.Warnf("%s Server close connection", c.ID) } else { - log.Errorf("%s Error reading from server: %v", c.Id, err) + log.Errorf("%s Error reading from server: %v", c.ID, err) } - return e, err + return ResultEntry{}, err } packet := []byte{PtResult} buffer = append(packet, buffer...) @@ -426,24 +416,19 @@ func (c *StreamClient) readResultEntry() (ResultEntry, error) { // Read variable field (errStr) length := binary.BigEndian.Uint32(buffer[1:5]) if length < FixedSizeResultEntry { - log.Errorf("%s Error reading result entry", c.Id) - return e, ErrReadingResultEntry + log.Errorf("%s Error reading result entry", c.ID) + return ResultEntry{}, ErrReadingResultEntry } bufferAux := make([]byte, length-FixedSizeResultEntry) - _, err = io.ReadFull(c.conn, bufferAux) + err = c.readContent(bufferAux) if err != nil { - if err == io.EOF { - log.Warnf("%s Server close connection", c.Id) - } else { - log.Errorf("%s Error reading from server: %v", c.Id, err) - } - return e, err + return ResultEntry{}, err } - buffer = append(buffer, bufferAux...) + buffer = append(buffer, bufferAux...) //nolint:makezero // Decode binary entry result - e, err = DecodeBinaryToResultEntry(buffer) + e, err := DecodeBinaryToResultEntry(buffer) if err != nil { return e, err } @@ -451,6 +436,21 @@ func (c *StreamClient) readResultEntry() (ResultEntry, error) { return e, nil } +// readContent reads raw content using the connection and places it into buffer parameter +func (c *StreamClient) readContent(buffer []byte) error { + _, err := io.ReadFull(c.conn, buffer) + if err != nil { + if errors.Is(err, io.EOF) { + log.Warnf("%s Server close connection", c.ID) + } else { + log.Errorf("%s Error reading from server: %w", c.ID, err) + } + return err + } + + return nil +} + // readEntries reads from the server all type of packets func (c *StreamClient) readEntries() { defer c.closeConnection() @@ -461,13 +461,8 @@ func (c *StreamClient) readEntries() { // Read packet type packet := make([]byte, 1) - _, err := io.ReadFull(c.conn, packet) + err := c.readContent(packet) if err != nil { - if err == io.EOF { - log.Warnf("%s Server close connection", c.Id) - } else { - log.Errorf("%s Error reading from server: %v", c.Id, err) - } c.closeConnection() continue } @@ -488,7 +483,7 @@ func (c *StreamClient) readEntries() { r := c.getResult(CmdStart) if r.errorNum != uint32(CmdErrOK) { c.closeConnection() - time.Sleep(5 * time.Second) // nolint:gomnd + time.Sleep(defaultTimeout) continue } } @@ -524,7 +519,7 @@ func (c *StreamClient) readEntries() { default: // Unknown type - log.Warnf("%s Unknown packet type %d", c.Id, packet[0]) + log.Warnf("%s Unknown packet type %d", c.ID, packet[0]) continue } } @@ -534,21 +529,22 @@ func (c *StreamClient) readEntries() { func (c *StreamClient) getResult(cmd Command) ResultEntry { // Get result entry r := <-c.results - log.Infof("%s Result %d[%s] received for command %d[%s]", c.Id, r.errorNum, r.errorStr, cmd, StrCommand[cmd]) + log.Infof("%s Result %d[%s] received for command %d[%s]", c.ID, r.errorNum, r.errorStr, cmd, StrCommand[cmd]) return r } // getHeader consumes a header entry func (c *StreamClient) getHeader() HeaderEntry { h := <-c.headers - log.Infof("%s Header received info: TotalEntries[%d], TotalLength[%d], Version[%d], SystemID[%d]", c.Id, h.TotalEntries, h.TotalLength, h.Version, h.SystemID) + log.Infof("%s Header received info: TotalEntries[%d], TotalLength[%d], Version[%d], SystemID[%d]", + c.ID, h.TotalEntries, h.TotalLength, h.Version, h.SystemID) return h } // getEntry consumes a entry from commands response func (c *StreamClient) getEntry() FileEntry { e := <-c.entryRsp - log.Infof("%s Entry received info: Number[%d]", c.Id, e.Number) + log.Infof("%s Entry received info: Number[%d]", c.ID, e.Number) return e } @@ -561,7 +557,7 @@ func (c *StreamClient) getStreaming() { // Process the data entry err := c.processEntry(&e, c, c.relayServer) if err != nil { - log.Fatalf("%s Processing entry %d: %s. HALTED!", c.Id, e.Number, err.Error()) + log.Fatalf("%s Processing entry %d: %s. HALTED!", c.ID, e.Number, err.Error()) } } } @@ -590,6 +586,6 @@ func (c *StreamClient) setProcessEntryFunc(f ProcessEntryFunc, s *StreamServer) // PrintReceivedEntry prints received entry (default callback function) func PrintReceivedEntry(e *FileEntry, c *StreamClient, s *StreamServer) error { // Log data entry fields - log.Infof("Data entry(%s): %d | %d | %d | %d", c.Id, e.Number, e.Length, e.Type, len(e.Data)) + log.Infof("Data entry(%s): %d | %d | %d | %d", c.ID, e.Number, e.Length, e.Type, len(e.Data)) return nil } diff --git a/datastreamer/streamfile.go b/datastreamer/streamfile.go index 2f9055f..705dffd 100644 --- a/datastreamer/streamfile.go +++ b/datastreamer/streamfile.go @@ -119,7 +119,8 @@ func (f *StreamFile) openCreateFile() error { // Check if file exists (otherwise create it) _, err := os.Stat(f.fileName) - if os.IsNotExist(err) { + switch { + case os.IsNotExist(err): // File does not exists so create it log.Infof("Creating new file for datastream: %s", f.fileName) f.file, err = os.Create(f.fileName) @@ -133,7 +134,7 @@ func (f *StreamFile) openCreateFile() error { } err = f.initializeFile() } - } else if err == nil { + case err == nil: // File already exists log.Infof("Using existing file for datastream: %s", f.fileName) f.file, err = os.OpenFile(f.fileName, os.O_RDWR, fileMode) @@ -143,7 +144,7 @@ func (f *StreamFile) openCreateFile() error { } err = f.openFileForHeader() - } else { + default: log.Errorf("Unable to check datastream file status %s: %v", f.fileName, err) } @@ -233,7 +234,7 @@ func (f *StreamFile) createHeaderPage() error { // Update total data length and max file length f.mutexHeader.Lock() - f.maxLength = f.maxLength + PageHeaderSize + f.maxLength += PageHeaderSize f.header.TotalLength = PageHeaderSize f.mutexHeader.Unlock() @@ -293,7 +294,7 @@ func (f *StreamFile) createPage(size uint32) error { } // Update max file length - f.maxLength = f.maxLength + uint64(size) + f.maxLength += uint64(size) return nil } @@ -415,7 +416,7 @@ func encodeHeaderEntryToBinary(e HeaderEntry) []byte { be := make([]byte, 1) be[0] = e.packetType be = binary.BigEndian.AppendUint32(be, e.headLength) - be = append(be, e.Version) + be = append(be, e.Version) //nolint:makezero be = binary.BigEndian.AppendUint64(be, e.SystemID) be = binary.BigEndian.AppendUint64(be, uint64(e.streamType)) be = binary.BigEndian.AppendUint64(be, e.TotalLength) @@ -450,7 +451,7 @@ func encodeFileEntryToBinary(e FileEntry) []byte { be = binary.BigEndian.AppendUint32(be, e.Length) be = binary.BigEndian.AppendUint32(be, uint32(e.Type)) be = binary.BigEndian.AppendUint64(be, e.Number) - be = append(be, e.Data...) + be = append(be, e.Data...) //nolint:makezero return be } @@ -508,20 +509,20 @@ func (f *StreamFile) checkMagicNumbers() error { // checkHeaderConsistency performs some header struct checks func (f *StreamFile) checkHeaderConsistency() error { - var err error = nil - - if f.header.packetType != PtHeader { + switch { + case f.header.packetType != PtHeader: log.Error("Invalid header: bad packet type") - err = ErrInvalidHeaderBadPacketType - } else if f.header.headLength != headerSize { + return ErrInvalidHeaderBadPacketType + + case f.header.headLength != headerSize: log.Error("Invalid header: bad header length") - err = ErrInvalidHeaderBadHeaderLength - } else if f.header.streamType != f.streamType { + return ErrInvalidHeaderBadHeaderLength + + case f.header.streamType != f.streamType: log.Error("Invalid header: bad stream type") - err = ErrInvalidHeaderBadStreamType + return ErrInvalidHeaderBadStreamType } - - return err + return nil } // AddFileEntry writes new data entry to the data stream file @@ -575,8 +576,8 @@ func (f *StreamFile) AddFileEntry(e FileEntry) error { // Update the current header in memory (on disk later when the commit arrives) f.mutexHeader.Lock() - f.header.TotalLength = f.header.TotalLength + entryLength - f.header.TotalEntries = f.header.TotalEntries + 1 + f.header.TotalLength += entryLength + f.header.TotalEntries++ f.mutexHeader.Unlock() // printHeaderEntry(f.header) @@ -610,7 +611,7 @@ func (f *StreamFile) fillPagePadEntries() error { // Update the current header in memory (on disk later when the commit arrives) f.mutexHeader.Lock() - f.header.TotalLength = f.header.TotalLength + pageRemaining + f.header.TotalLength += pageRemaining f.mutexHeader.Unlock() } @@ -754,7 +755,7 @@ func (f *StreamFile) iteratorNext(iterator *iteratorFile) (bool, error) { log.Errorf("Error reading entry for iterator: %v", err) return true, err } - buffer = append(packet, buffer...) + buffer = append(packet, buffer...) //nolint:makezero // Check length length := binary.BigEndian.Uint32(buffer[1:5]) @@ -772,7 +773,7 @@ func (f *StreamFile) iteratorNext(iterator *iteratorFile) (bool, error) { log.Errorf("Error reading data for iterator: %v", err) return true, err } - buffer = append(buffer, bufferAux...) + buffer = append(buffer, bufferAux...) //nolint:makezero } // Convert to data entry struct @@ -793,16 +794,19 @@ func (f *StreamFile) iteratorEnd(iterator *iteratorFile) { // seekEntry uses a file iterator to locate a data entry number using a custom binary search func (f *StreamFile) seekEntry(iterator *iteratorFile) error { // Start and end data pages - avg := 0 - beg := 0 - end := int((f.writtenHead.TotalLength - PageHeaderSize) / PageDataSize) + var ( + avg = 0 + beg = 0 + end = int((f.writtenHead.TotalLength - PageHeaderSize) / PageDataSize) + ) + if (f.writtenHead.TotalLength-PageHeaderSize)%PageDataSize == 0 { - end = end - 1 + end-- } // Custom binary search for beg <= end { - avg = beg + (end-beg)/2 // nolint:gomnd + avg = beg + (end-beg)/2 //nolint:mnd // Seek for the start of avg data page newPos := (avg * PageDataSize) + PageHeaderSize @@ -902,7 +906,7 @@ func (f *StreamFile) getFirstEntryOnNextPage(iterator *iteratorFile) (uint64, er } // Seek for the start of next data page - _, err = iterator.file.Seek(int64(forward), io.SeekCurrent) + _, err = iterator.file.Seek(forward, io.SeekCurrent) if err != nil { log.Errorf("Error seeking next data page: %v", err) return 0, err @@ -926,7 +930,7 @@ func (f *StreamFile) getFirstEntryOnNextPage(iterator *iteratorFile) (uint64, er entryNum := binary.BigEndian.Uint64(buffer[9:17]) // Restore file position - _, err = iterator.file.Seek(-int64(forward+FixedSizeFileEntry), io.SeekCurrent) + _, err = iterator.file.Seek(-(forward + FixedSizeFileEntry), io.SeekCurrent) if err != nil { log.Errorf("Error seeking current pos: %v", err) return 0, err @@ -1006,7 +1010,8 @@ func (f *StreamFile) updateEntryData(entryNum uint64, etype EntryType, data []by // Check length of data dataLength := iterator.Entry.Length - FixedSizeFileEntry if dataLength != uint32(len(data)) { - log.Infof("Updating entry data to a different length not allowed. Current[%d] Update[%d]", dataLength, uint32(len(data))) + log.Infof("Updating entry data to a different length not allowed. Current[%d] Update[%d]", + dataLength, uint32(len(data))) return ErrUpdateEntryDifferentSize } diff --git a/datastreamer/streamrelay.go b/datastreamer/streamrelay.go index 45aa5fe..253bc0b 100644 --- a/datastreamer/streamrelay.go +++ b/datastreamer/streamrelay.go @@ -13,7 +13,9 @@ type StreamRelay struct { } // NewRelay creates a new data stream relay -func NewRelay(server string, port uint16, version uint8, systemID uint64, streamType StreamType, fileName string, writeTimeout time.Duration, inactivityTimeout time.Duration, inactivityCheckInterval time.Duration, cfg *log.Config) (*StreamRelay, error) { +func NewRelay(server string, port uint16, version uint8, systemID uint64, + streamType StreamType, fileName string, writeTimeout time.Duration, + inactivityTimeout time.Duration, inactivityCheckInterval time.Duration, cfg *log.Config) (*StreamRelay, error) { var r StreamRelay var err error @@ -25,7 +27,8 @@ func NewRelay(server string, port uint16, version uint8, systemID uint64, stream } // Create server side - r.server, err = NewServer(port, version, systemID, streamType, fileName, writeTimeout, inactivityTimeout, inactivityCheckInterval, cfg) + r.server, err = NewServer(port, version, systemID, streamType, fileName, writeTimeout, + inactivityTimeout, inactivityCheckInterval, cfg) if err != nil { log.Errorf("Error creating relay server side: %v", err) return nil, err diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index da86b23..2eef65f 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -41,6 +41,8 @@ const ( maxConnections = 100 // Maximum number of connected clients streamBuffer = 256 // Buffers for the stream channel maxBookmarkLength = 16 // Maximum number of bytes for a bookmark + + timeout = 2 * time.Second ) const ( @@ -109,19 +111,21 @@ var ( // StreamServer type to manage a data stream server type StreamServer struct { - port uint16 // Server stream port - fileName string // Stream file name - writeTimeout time.Duration // Timeout for write operations on client connection - inactivityTimeout time.Duration // Inactivity timeout to kill a client connection - inactivityCheckInterval time.Duration // Time interval to check for client connections that have reached the inactivity timeout and kill them - started bool // Flag server started + port uint16 // Server stream port + fileName string // Stream file name + writeTimeout time.Duration // Timeout for write operations on client connection + inactivityTimeout time.Duration // Inactivity timeout to kill a client connection + // Time interval to check for client connections that have reached + // the inactivity timeout and kill them + inactivityCheckInterval time.Duration + started bool // Flag server started version uint8 systemID uint64 streamType StreamType ln net.Listener clients map[string]*client - mutexClients sync.Mutex // Mutex for write access to clients map + mutexClients sync.RWMutex // Mutex for write access to clients map nextEntry uint64 // Next sequential entry number initEntry uint64 // Only used by the relay (initial next entry in the master server) @@ -144,7 +148,7 @@ type client struct { conn net.Conn status ClientStatus fromEntry uint64 - clientId string + clientID string lastActivity time.Time } @@ -161,7 +165,9 @@ type ResultEntry struct { } // NewServer creates a new data stream server -func NewServer(port uint16, version uint8, systemID uint64, streamType StreamType, fileName string, writeTimeout time.Duration, inactivityTimeout time.Duration, inactivityCheckInterval time.Duration, cfg *log.Config) (*StreamServer, error) { +func NewServer(port uint16, version uint8, systemID uint64, streamType StreamType, fileName string, + writeTimeout time.Duration, inactivityTimeout time.Duration, inactivityCheckInterval time.Duration, + cfg *log.Config) (*StreamServer, error) { // Create the server data stream s := StreamServer{ port: port, @@ -190,7 +196,7 @@ func NewServer(port uint16, version uint8, systemID uint64, streamType StreamTyp // Add file extension if not present ind := strings.IndexRune(s.fileName, '.') if ind == -1 { - s.fileName = s.fileName + ".bin" + s.fileName += ".bin" } // Initialize the logger @@ -253,14 +259,14 @@ func (s *StreamServer) checkClientInactivity() { s.mutexClients.Lock() for _, client := range s.clients { if client.lastActivity.Add(s.inactivityTimeout).Before(time.Now()) { - clientsToKill[client.clientId] = struct{}{} + clientsToKill[client.clientID] = struct{}{} } } s.mutexClients.Unlock() - for clientId := range clientsToKill { - log.Infof("killing inactive client %s", clientId) - s.killClient(clientId) + for clientID := range clientsToKill { + log.Infof("killing inactive client %s", clientID) + s.killClient(clientID) } } } @@ -269,11 +275,13 @@ func (s *StreamServer) checkClientInactivity() { func (s *StreamServer) waitConnections() { defer s.ln.Close() + const timeout = 2 * time.Second + for { conn, err := s.ln.Accept() if err != nil { log.Errorf("Error accepting new connection: %v", err) - time.Sleep(2 * time.Second) // nolint:gomnd + time.Sleep(timeout) continue } @@ -281,7 +289,7 @@ func (s *StreamServer) waitConnections() { if s.getSafeClientsLen() >= maxConnections { log.Warnf("Unable to accept client connection, maximum number of connections reached (%d)", maxConnections) conn.Close() - time.Sleep(2 * time.Second) // nolint:gomnd + time.Sleep(timeout) continue } @@ -294,49 +302,49 @@ func (s *StreamServer) waitConnections() { func (s *StreamServer) handleConnection(conn net.Conn) { defer conn.Close() - clientId := conn.RemoteAddr().String() - log.Debugf("New connection: %s", clientId) + clientID := conn.RemoteAddr().String() + log.Debugf("New connection: %s", clientID) s.mutexClients.Lock() client := &client{ conn: conn, status: csStopped, fromEntry: 0, - clientId: clientId, + clientID: clientID, lastActivity: time.Now(), } - s.clients[clientId] = client + s.clients[clientID] = client s.mutexClients.Unlock() for { // Read command command, err := readFullUint64(client) if err != nil { - s.killClient(clientId) + s.killClient(clientID) return } // Read stream type stUint64, err := readFullUint64(client) if err != nil { - s.killClient(clientId) + s.killClient(clientID) return } st := StreamType(stUint64) // Check stream type if st != s.streamType { - log.Errorf("Mismatch stream type, killed: %s", clientId) - s.killClient(clientId) + log.Errorf("Mismatch stream type, killed: %s", clientID) + s.killClient(clientID) return } // Manage the requested command - log.Debugf("Command %d[%s] received from %s", command, StrCommand[Command(command)], clientId) - err = s.processCommand(Command(command), s.getSafeClient(clientId)) + log.Debugf("Command %d[%s] received from %s", command, StrCommand[Command(command)], clientID) + err = s.processCommand(Command(command), s.getSafeClient(clientID)) if err != nil { // Kill client connection - time.Sleep(2 * time.Second) // nolint:gomnd - s.killClient(clientId) + time.Sleep(timeout) + s.killClient(clientID) return } } @@ -616,7 +624,7 @@ func (s *StreamServer) GetFirstEventAfterBookmark(bookmark []byte) (FileEntry, e } // GetDataBetweenBookmarks returns the data between two bookmarks -func (s *StreamServer) GetDataBetweenBookmarks(bookmarkFrom []byte, bookmarkTo []byte) ([]byte, error) { +func (s *StreamServer) GetDataBetweenBookmarks(bookmarkFrom, bookmarkTo []byte) ([]byte, error) { var err error var response []byte @@ -682,7 +690,7 @@ func (s *StreamServer) broadcastAtomicOp() { broadcastOp := <-s.stream start := time.Now().UnixMilli() var killedClientMap = map[string]struct{}{} - s.mutexClients.Lock() + s.mutexClients.RLock() // For each connected and started client log.Infof("sending %d datastream entries to %d clients", len(broadcastOp.entries), len(s.clients)) for id, cli := range s.clients { @@ -712,7 +720,7 @@ func (s *StreamServer) broadcastAtomicOp() { } } } - s.mutexClients.Unlock() + s.mutexClients.RUnlock() for k := range killedClientMap { s.killClient(k) @@ -723,18 +731,18 @@ func (s *StreamServer) broadcastAtomicOp() { } // killClient disconnects the client and removes it from server clients struct -func (s *StreamServer) killClient(clientId string) { +func (s *StreamServer) killClient(clientID string) { s.mutexClients.Lock() - if s.clients[clientId] != nil { - if s.clients[clientId].status != csKilled { - s.clients[clientId].status = csKilled - if s.clients[clientId].conn != nil { - s.clients[clientId].conn.Close() - } - delete(s.clients, clientId) + defer s.mutexClients.Unlock() + + client := s.clients[clientID] + if client != nil && client.status != csKilled { + client.status = csKilled + if client.conn != nil { + client.conn.Close() } + delete(s.clients, clientID) } - s.mutexClients.Unlock() } // processCommand manages the received TCP commands from the clients @@ -826,11 +834,11 @@ func (s *StreamServer) processCmdStart(client *client) error { client.fromEntry = fromEntry // Log - log.Infof("Client %s command Start from %d", client.clientId, fromEntry) + log.Infof("Client %s command Start from %d", client.clientID, fromEntry) // Check received param if fromEntry > s.nextEntry && fromEntry > s.initEntry { - log.Infof("Start command invalid from entry %d for client %s", fromEntry, client.clientId) + log.Infof("Start command invalid from entry %d for client %s", fromEntry, client.clientID) err = ErrStartCommandInvalidParamFromEntry _ = s.sendResultEntry(uint32(CmdErrBadFromEntry), StrCommandErrors[CmdErrBadFromEntry], client) return err @@ -860,7 +868,8 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { // Check maximum length allowed if length > maxBookmarkLength { - log.Infof("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", client.clientId, length, maxBookmarkLength) + log.Infof("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", + client.clientID, length, maxBookmarkLength) return ErrBookmarkMaxLength } @@ -871,12 +880,12 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { } // Log - log.Infof("Client %s command StartBookmark [%v]", client.clientId, bookmark) + log.Infof("Client %s command StartBookmark [%v]", client.clientID, bookmark) // Get bookmark entryNum, err := s.bookmark.GetBookmark(bookmark) if err != nil { - log.Infof("StartBookmark command invalid from bookmark %v for client %s: %v", bookmark, client.clientId, err) + log.Infof("StartBookmark command invalid from bookmark %v for client %s: %v", bookmark, client.clientID, err) err = ErrStartBookmarkInvalidParamFromBookmark _ = s.sendResultEntry(uint32(CmdErrBadFromBookmark), StrCommandErrors[CmdErrBadFromBookmark], client) return err @@ -889,7 +898,7 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { } // Stream entries data from the entry number marked by the bookmark - log.Infof("Client %s Bookmark [%v] is the entry number [%d]", client.clientId, bookmark, entryNum) + log.Infof("Client %s Bookmark [%v] is the entry number [%d]", client.clientID, bookmark, entryNum) if entryNum < s.nextEntry { err = s.streamingFromEntry(client, entryNum) } @@ -900,7 +909,7 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { // processCmdStop processes the TCP Stop command from the clients func (s *StreamServer) processCmdStop(client *client) error { // Log - log.Infof("Client %s command Stop", client.clientId) + log.Infof("Client %s command Stop", client.clientID) // Send a command result entry OK err := s.sendResultEntry(0, "OK", client) @@ -910,7 +919,7 @@ func (s *StreamServer) processCmdStop(client *client) error { // processCmdHeader processes the TCP Header command from the clients func (s *StreamServer) processCmdHeader(client *client) error { // Log - log.Infof("Client %s command Header", client.clientId) + log.Infof("Client %s command Header", client.clientID) // Send a command result entry OK err := s.sendResultEntry(0, "OK", client) @@ -929,7 +938,7 @@ func (s *StreamServer) processCmdHeader(client *client) error { err = ErrNilConnection } if err != nil { - log.Warnf("Error sending header entry to %s: %v", client.clientId, err) + log.Warnf("Error sending header entry to %s: %v", client.clientID, err) return err } return nil @@ -944,7 +953,7 @@ func (s *StreamServer) processCmdEntry(client *client) error { } // Log - log.Infof("Client %s command Entry %d", client.clientId, entryNumber) + log.Infof("Client %s command Entry %d", client.clientID, entryNumber) // Send a command result entry OK err = s.sendResultEntry(0, "OK", client) @@ -970,7 +979,7 @@ func (s *StreamServer) processCmdEntry(client *client) error { err = ErrNilConnection } if err != nil { - log.Warnf("Error sending entry to %s: %v", client.clientId, err) + log.Warnf("Error sending entry to %s: %v", client.clientID, err) return err } @@ -987,7 +996,8 @@ func (s *StreamServer) processCmdBookmark(client *client) error { // Check maximum length allowed if length > maxBookmarkLength { - log.Infof("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", client.clientId, length, maxBookmarkLength) + log.Infof("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", + client.clientID, length, maxBookmarkLength) return ErrBookmarkMaxLength } @@ -998,7 +1008,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { } // Log - log.Infof("Client %s command Bookmark %v", client.clientId, bookmark) + log.Infof("Client %s command Bookmark %v", client.clientID, bookmark) // Send a command result entry OK err = s.sendResultEntry(0, "OK", client) @@ -1024,7 +1034,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { err = ErrNilConnection } if err != nil { - log.Warnf("Error sending entry to %s: %v", client.clientId, err) + log.Warnf("Error sending entry to %s: %v", client.clientID, err) return err } @@ -1034,7 +1044,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { // streamingFromEntry sends to the client the stream data starting from the requested entry number func (s *StreamServer) streamingFromEntry(client *client, fromEntry uint64) error { // Log - log.Infof("SYNCING %s from entry %d...", client.clientId, fromEntry) + log.Infof("SYNCING %s from entry %d...", client.clientID, fromEntry) // Start file stream iterator iterator, err := s.streamFile.iteratorFrom(fromEntry, true) @@ -1056,18 +1066,18 @@ func (s *StreamServer) streamingFromEntry(client *client, fromEntry uint64) erro // Send the file data entry binaryEntry := encodeFileEntryToBinary(iterator.Entry) - log.Debugf("Sending data entry %d (type %d) to %s", iterator.Entry.Number, iterator.Entry.Type, client.clientId) + log.Debugf("Sending data entry %d (type %d) to %s", iterator.Entry.Number, iterator.Entry.Type, client.clientID) if client.conn != nil { _, err = TimeoutWrite(client, binaryEntry, s.writeTimeout) } else { err = ErrNilConnection } if err != nil { - log.Warnf("Error sending entry %d to %s: %v", iterator.Entry.Number, client.clientId, err) + log.Warnf("Error sending entry %d to %s: %v", iterator.Entry.Number, client.clientID, err) return err } } - log.Infof("Synced %s until %d!", client.clientId, iterator.Entry.Number) + log.Infof("Synced %s until %d!", client.clientID, iterator.Entry.Number) // Close iterator s.streamFile.iteratorEnd(iterator) @@ -1086,7 +1096,6 @@ func (s *StreamServer) sendResultEntry(errorNum uint32, errorStr string, client errorNum: errorNum, errorStr: byteSlice, } - // PrintResultEntry(entry) // TODO: remove // Convert struct to binary bytes binaryEntry := encodeResultEntryToBinary(entry) @@ -1100,24 +1109,22 @@ func (s *StreamServer) sendResultEntry(errorNum uint32, errorStr string, client err = ErrNilConnection } if err != nil { - log.Warnf("Error sending result entry to %s: %v", client.clientId, err) + log.Warnf("Error sending result entry to %s: %v", client.clientID, err) return err } return nil } -func (s *StreamServer) getSafeClient(clientId string) *client { - s.mutexClients.Lock() - client := s.clients[clientId] - s.mutexClients.Unlock() - return client +func (s *StreamServer) getSafeClient(clientID string) *client { + s.mutexClients.RLock() + defer s.mutexClients.RUnlock() + return s.clients[clientID] } func (s *StreamServer) getSafeClientsLen() int { - s.mutexClients.Lock() - clientLen := len(s.clients) - s.mutexClients.Unlock() - return clientLen + s.mutexClients.RLock() + defer s.mutexClients.RUnlock() + return len(s.clients) } // BookmarkPrintDump prints all bookmarks @@ -1131,7 +1138,7 @@ func (s *StreamServer) BookmarkPrintDump() { // readFullUint64 reads from a connection a complete uint64 func readFullUint64(client *client) (uint64, error) { // Read 8 bytes (uint64 value) - buffer, err := readFullBytes(8, client) // nolint:gomnd + buffer, err := readFullBytes(8, client) //nolint:mnd if err != nil { return 0, err } @@ -1145,7 +1152,7 @@ func readFullUint64(client *client) (uint64, error) { // readFullUint32 reads from a connection a complete uint32 func readFullUint32(client *client) (uint32, error) { // Read 4 bytes (uint32 value) - buffer, err := readFullBytes(4, client) // nolint:gomnd + buffer, err := readFullBytes(4, client) //nolint:mnd if err != nil { return 0, err } @@ -1170,7 +1177,7 @@ func readFullBytes(length uint32, client *client) ([]byte, error) { if err == io.EOF { log.Debugf("Client %s close connection", client.conn.RemoteAddr().String()) } else { - log.Warnf("Error reading from client %s, error: %v", client.clientId, err) + log.Warnf("Error reading from client %s, error: %v", client.clientID, err) } return buffer, err } @@ -1185,7 +1192,7 @@ func encodeResultEntryToBinary(e ResultEntry) []byte { be[0] = e.packetType be = binary.BigEndian.AppendUint32(be, e.length) be = binary.BigEndian.AppendUint32(be, e.errorNum) - be = append(be, e.errorStr...) + be = append(be, e.errorStr...) //nolint:makezero return be } @@ -1234,7 +1241,7 @@ func TimeoutWrite(client *client, data []byte, timeout time.Duration) (int, erro n, err := client.conn.Write(data) if err != nil { if errors.Is(err, os.ErrDeadlineExceeded) { - log.Debugf("Write deadline exceeded for client %s, error: %v", client.clientId, err) + log.Debugf("Write deadline exceeded for client %s, error: %v", client.clientID, err) } } else { client.updateActivity() diff --git a/log/config.go b/log/config.go index 2f166ee..4ebbf50 100644 --- a/log/config.go +++ b/log/config.go @@ -3,11 +3,13 @@ package log // Config for log type Config struct { // Environment defining the log format ("production" or "development"). - // In development mode enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. Stacktraces are automatically included on logs of WarnLevel and above. + // In development mode enables development mode (which makes DPanicLevel logs panic), + // uses a console encoder, writes to standard error, and disables sampling. + // Stacktraces are automatically included on logs of WarnLevel and above. // Check [here](https://pkg.go.dev/go.uber.org/zap@v1.24.0#NewDevelopmentConfig) Environment LogEnvironment `mapstructure:"Environment" jsonschema:"enum=production,enum=development"` // Level of log. As lower value more logs are going to be generated - Level string `mapstructure:"Level" jsonschema:"enum=debug,enum=info,enum=warn,enum=error,enum=dpanic,enum=panic,enum=fatal"` + Level string `mapstructure:"Level" jsonschema:"enum=debug,enum=info,enum=warn,enum=error,enum=dpanic,enum=panic,enum=fatal"` //nolint:lll // Outputs Outputs []string `mapstructure:"Outputs"` } diff --git a/log/log.go b/log/log.go index 10cc60f..f0b372e 100644 --- a/log/log.go +++ b/log/log.go @@ -68,7 +68,7 @@ func NewLogger(cfg Config) (*zap.SugaredLogger, *zap.AtomicLevel, error) { var level zap.AtomicLevel err := level.UnmarshalText([]byte(cfg.Level)) if err != nil { - return nil, nil, fmt.Errorf("error on setting log level: %s", err) + return nil, nil, fmt.Errorf("error on setting log level: %w", err) } var zapCfg zap.Config @@ -91,10 +91,10 @@ func NewLogger(cfg Config) (*zap.SugaredLogger, *zap.AtomicLevel, error) { if err != nil { return nil, nil, err } - defer logger.Sync() //nolint:gosec,errcheck + defer logger.Sync() //nolint:errcheck // skip 2 callers: one for our wrapper methods and one for the package functions - withOptions := logger.WithOptions(zap.AddCallerSkip(2)) //nolint:gomnd + withOptions := logger.WithOptions(zap.AddCallerSkip(2)) //nolint:mnd return withOptions.Sugar(), &level, nil } diff --git a/log/log_test.go b/log/log_test.go index 9d33bcd..9a59660 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -20,7 +20,7 @@ func TestLog(t *testing.T) { cfg := Config{ Environment: EnvironmentDevelopment, Level: "debug", - Outputs: []string{"stderr"}, //[]string{"stdout", "test.log"} + Outputs: []string{"stderr"}, // []string{"stdout", "test.log"} } Init(cfg) diff --git a/relay/main.go b/relay/main.go index f6176d8..20a1e48 100644 --- a/relay/main.go +++ b/relay/main.go @@ -1,6 +1,7 @@ package main import ( + "errors" "os" "os/signal" "path/filepath" @@ -17,6 +18,9 @@ import ( const ( StSequencer = 1 // StSequencer sequencer stream type + + streamerSystemID = 137 + streamerVersion = 1 ) type config struct { @@ -83,17 +87,16 @@ func main() { // defaultConfig parses the default configuration values func defaultConfig() (*config, error) { - cfg := config{ + viper.SetConfigType("toml") + + return &config{ Server: "127.0.0.1:6900", - Port: 7900, // nolint:gomnd + Port: 7900, //nolint:mnd File: "datarelay.bin", - WriteTimeout: time.Duration(5 * time.Second), // nolint:gomnd - InactivityTimeout: time.Duration(120 * time.Second), // nolint:gomnd + WriteTimeout: 3 * time.Second, //nolint:mnd + InactivityTimeout: 120 * time.Second, //nolint:mnd Log: "info", - } - - viper.SetConfigType("toml") - return &cfg, nil + }, nil } // loadConfig loads the configuration @@ -122,18 +125,20 @@ func loadConfig(ctx *cli.Context) (*config, error) { err = viper.ReadInConfig() if err != nil { - _, ok := err.(viper.ConfigFileNotFoundError) - if ok { - log.Infof("config file not found") + var configErr *viper.ConfigFileNotFoundError + if errors.As(err, &configErr) { + log.Infof("%w", configErr) } else { - log.Infof("error reading config file: ", err) + log.Infof("error reading config file: %w", err) return nil, err } } decodeHooks := []viper.DecoderConfigOption{ // this allows arrays to be decoded from env var separated by ",", example: MY_VAR="value1,value2,value3" - viper.DecodeHook(mapstructure.ComposeDecodeHookFunc(mapstructure.TextUnmarshallerHookFunc(), mapstructure.StringToSliceHookFunc(","))), + viper.DecodeHook(mapstructure.ComposeDecodeHookFunc( + mapstructure.TextUnmarshallerHookFunc(), + mapstructure.StringToSliceHookFunc(","))), } err = viper.Unmarshal(&cfg, decodeHooks...) @@ -193,7 +198,8 @@ func run(ctx *cli.Context) error { log.Infof(">> Relay server started: port[%d] file[%s] server[%s] log[%s]", cfg.Port, cfg.File, cfg.Server, cfg.Log) // Create relay server - r, err := datastreamer.NewRelay(cfg.Server, uint16(cfg.Port), 1, 137, StSequencer, cfg.File, cfg.WriteTimeout, cfg.InactivityTimeout, 5*time.Second, nil) // nolint:gomnd + r, err := datastreamer.NewRelay(cfg.Server, uint16(cfg.Port), streamerVersion, streamerSystemID, + StSequencer, cfg.File, cfg.WriteTimeout, cfg.InactivityTimeout, 5*time.Second, nil) //nolint:mnd if err != nil { log.Errorf(">> Relay server: NewRelay error! (%v)", err) return err From 81bd3ec1157c0f94a8aecabfda1a98736cfbfb88 Mon Sep 17 00:00:00 2001 From: Roman Behma <13855864+begmaroman@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:02:32 +0100 Subject: [PATCH 07/18] Removed packr from Dockerfile (#128) --- Dockerfile | 3 +-- docker-compose.yml | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd70725..b1c5b69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM golang:1.21 AS build # INSTALL DEPENDENCIES -RUN go install github.com/gobuffalo/packr/v2/packr2@v2.8.3 COPY go.mod go.sum /src/ RUN cd /src && go mod download @@ -27,4 +26,4 @@ USER $USER WORKDIR $HOME EXPOSE 7900 -CMD ["/bin/sh", "-c", "/app/dsrelay"] +CMD ["/app/dsrelay"] diff --git a/docker-compose.yml b/docker-compose.yml index 4110506..b30a22e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,9 @@ version: "3.5" services: datastream-relay: container_name: datastream-relay + build: + context: . + dockerfile: Dockerfile restart: unless-stopped image: datastream-relay ports: @@ -10,7 +13,7 @@ services: volumes: - ./dist:/app - ./config/environments/${DATASTREAM_NETWORK}/config.toml:/app/config.toml - command: + command: - "/bin/sh" - "-c" - "/app/dsrelay --cfg /app/config.toml" From 95faf886bbb6932056813035038577d8f5c018c7 Mon Sep 17 00:00:00 2001 From: agnusmor <100322135+agnusmor@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:28:32 +0200 Subject: [PATCH 08/18] Refactor logs (#130) * refactor logs * fix log broadcastAtomicOP * fix clients ip log * fix typo * fix lint --- datastreamer/streamserver.go | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index 2eef65f..7bea058 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -440,12 +440,11 @@ func (s *StreamServer) addStream(desc string, etype EntryType, data []byte) (uin // CommitAtomicOp commits the current atomic operation and streams it to the clients func (s *StreamServer) CommitAtomicOp() error { - start := time.Now().UnixNano() - defer log.Infof("CommitAtomicOp process time: %vns", time.Now().UnixNano()-start) + start := time.Now() - log.Infof("commit datastream atomic operation, startEntry: %d", s.atomicOp.startEntry) + log.Debugf("committing datastream atomic operation, startEntry: %d", s.atomicOp.startEntry) if s.atomicOp.status != aoStarted { - log.Errorf("Commit not allowed, AtomicOp is not in the started state") + log.Errorf("commit not allowed, atomic operation is not in the started state") return ErrCommitNotAllowed } @@ -470,6 +469,8 @@ func (s *StreamServer) CommitAtomicOp() error { // No atomic operation in progress s.clearAtomicOp() + log.Infof("committed datastream atomic operation, startEntry: %d, time: %v", s.atomicOp.startEntry, time.Since(start)) + return nil } @@ -688,13 +689,15 @@ func (s *StreamServer) broadcastAtomicOp() { for { // Wait for new atomic operation to broadcast broadcastOp := <-s.stream - start := time.Now().UnixMilli() + start := time.Now() var killedClientMap = map[string]struct{}{} + var clientMap = map[string]struct{}{} s.mutexClients.RLock() // For each connected and started client - log.Infof("sending %d datastream entries to %d clients", len(broadcastOp.entries), len(s.clients)) + log.Debug("sending datastream entries, count: %d, clients: %d", len(broadcastOp.entries), len(s.clients)) for id, cli := range s.clients { - log.Debugf("Client %s status %d[%s]", id, cli.status, StrClientStatus[cli.status]) + log.Debugf("client %s status %d (%s)", id, cli.status, StrClientStatus[cli.status]) + clientMap[id] = struct{}{} if cli.status != csSynced { continue } @@ -702,7 +705,8 @@ func (s *StreamServer) broadcastAtomicOp() { // Send entries for _, entry := range broadcastOp.entries { if entry.Number >= cli.fromEntry { - log.Debugf("Sending data entry %d (type %d) to %s", entry.Number, entry.Type, id) + log.Debugf("sending data entry %d (type %d) to %s", entry.Number, entry.Type, id) + binaryEntry := encodeFileEntryToBinary(entry) // Send the file data entry @@ -713,7 +717,7 @@ func (s *StreamServer) broadcastAtomicOp() { } if err != nil { // Kill client connection - log.Warnf("Error sending entry to %s: %v", id, err) + log.Warnf("error sending entry to %s, error: %v", id, err) killedClientMap[id] = struct{}{} break // skip rest of entries for this client } @@ -726,7 +730,17 @@ func (s *StreamServer) broadcastAtomicOp() { s.killClient(k) } - log.Infof("broadcastAtomicOp process time: %vms", time.Now().UnixMilli()-start) + sClients := "" + for c := range clientMap { + if sClients == "" { + sClients = c + } else { + sClients += ", " + c + } + } + + log.Infof("sent datastream entries, count: %d, clients: %d, time: %v, clients-ip: {%s}", + len(broadcastOp.entries), len(s.clients), time.Since(start), sClients) } } From 3039179ecb99273ae97f8e5837748f184ff0ac0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= <93934272+Stefan-Ethernal@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:21:37 +0200 Subject: [PATCH 09/18] Introduce SonarCloud with code coverage (#131) * Introduce SonarCloud with code coverage * Remove verbose output --- .github/workflows/test.yml | 30 ++++++++ Dockerfile | 11 +-- Makefile | 4 +- cmd/main.go | 18 +++-- datastreamer/streamserver.go | 137 ++++++++++++++++++++++------------- log/log_test.go | 14 ++-- sonar-project.properties | 29 ++++++++ 7 files changed, 170 insertions(+), 73 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cbb841d..2e58fc6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,3 +27,33 @@ - name: Test run: make test working-directory: ./ + + + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + with: + name: code-coverage-report + path: coverage.out + + sonar-cloud: + needs: test + name: SonarCloud + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Download code coverage results + uses: actions/download-artifact@v3 + with: + name: code-coverage-report + + - name: SonarCloud analysis + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/Dockerfile b/Dockerfile index b1c5b69..cfebd85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,16 +2,17 @@ FROM golang:1.21 AS build # INSTALL DEPENDENCIES +RUN go install github.com/gobuffalo/packr/v2/packr2@v2.8.3 COPY go.mod go.sum /src/ -RUN cd /src && go mod download +WORKDIR /src +RUN go mod download # BUILD BINARY COPY relay /src/relay COPY datastreamer /src/datastreamer COPY log /src/log COPY Makefile version.go config/environments/testnet/config.toml /src/ -RUN cd /src && make build-dsrelay - +RUN make build-dsrelay # CONTAINER FOR RUNNING BINARY FROM alpine:3.19.0 @@ -20,10 +21,10 @@ COPY --from=build /src/dist/dsrelay /app/dsrelay COPY --from=build /src/config.toml /app/sample.config.toml ARG USER=dsrelay -ENV HOME /home/$USER +ENV HOME=/home/$USER RUN adduser -D $USER USER $USER WORKDIR $HOME EXPOSE 7900 -CMD ["/app/dsrelay"] +CMD ["/bin/sh", "-c", "/app/dsrelay"] \ No newline at end of file diff --git a/Makefile b/Makefile index 30ac4c5..03f8f92 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,6 @@ check-docker: @which docker > /dev/null || (echo "Error: docker is not installed" && exit 1) # Targets that require the checks -run-server: check-go build-dsapp: check-go build-dsrelay: check-go build-docker: check-docker @@ -45,7 +44,7 @@ build-docker-nc: ## Builds a docker image with datastream relay binary but witho .PHONY: test test: - go test -count=1 -short -race -p 1 -timeout 60s ./... + go test -coverprofile coverage.out -count=1 -short -race -p 1 -timeout 60s ./... ## Help display. ## Pulls comments from beside commands and prints a nicely formatted @@ -57,3 +56,4 @@ help: ## Prints this help @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | sort \ | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go index 9485f13..bd81fc1 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -30,7 +30,9 @@ const ( streamerSystemID = 137 streamerVersion = 1 - noneType = "none" + noneType = "none" + streamServerURL = "127.0.0.1:6900" + logLevelInfo = "log level (debug|info|warn|error)" ) var ( @@ -83,7 +85,7 @@ func main() { }, &cli.StringFlag{ Name: "log", - Usage: "log level (debug|info|warn|error)", + Usage: logLevelInfo, Value: "info", DefaultText: "info", }, @@ -122,8 +124,8 @@ func main() { &cli.StringFlag{ Name: "server", Usage: "datastream server address to connect (IP:port)", - Value: "127.0.0.1:6900", - DefaultText: "127.0.0.1:6900", + Value: streamServerURL, + DefaultText: streamServerURL, }, &cli.StringFlag{ Name: "from", @@ -168,7 +170,7 @@ func main() { }, &cli.StringFlag{ Name: "log", - Usage: "log level (debug|info|warn|error)", + Usage: logLevelInfo, Value: "info", DefaultText: "info", }, @@ -183,8 +185,8 @@ func main() { &cli.StringFlag{ Name: "server", Usage: "datastream server address to connect (IP:port)", - Value: "127.0.0.1:6900", - DefaultText: "127.0.0.1:6900", + Value: streamServerURL, + DefaultText: streamServerURL, }, &cli.Uint64Flag{ Name: "port", @@ -200,7 +202,7 @@ func main() { }, &cli.StringFlag{ Name: "log", - Usage: "log level (debug|info|warn|error)", + Usage: logLevelInfo, Value: "info", DefaultText: "info", }, diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index 7bea058..4e114bd 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -765,69 +765,25 @@ func (s *StreamServer) processCommand(command Command, client *client) error { // Manage each different kind of command request from a client var err error + switch command { case CmdStart: - if cli.status != csStopped { - log.Error("Stream to client already started!") - err = ErrClientAlreadyStarted - _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], client) - } else { - cli.status = csSyncing - err = s.processCmdStart(client) - if err == nil { - cli.status = csSynced - } - } + err = s.handleStartCommand(cli) case CmdStartBookmark: - if cli.status != csStopped { - log.Error("Stream to client already started!") - err = ErrClientAlreadyStarted - _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], client) - } else { - cli.status = csSyncing - err = s.processCmdStartBookmark(client) - if err == nil { - cli.status = csSynced - } - } + err = s.handleStartBookmarkCommand(cli) case CmdStop: - if cli.status != csSynced { - log.Error("Stream to client already stopped!") - err = ErrClientAlreadyStopped - _ = s.sendResultEntry(uint32(CmdErrAlreadyStopped), StrCommandErrors[CmdErrAlreadyStopped], client) - } else { - cli.status = csStopped - err = s.processCmdStop(client) - } + err = s.handleStopCommand(cli) case CmdHeader: - if cli.status != csStopped { - log.Error("Header command not allowed, stream started!") - err = ErrHeaderCommandNotAllowed - _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], client) - } else { - err = s.processCmdHeader(client) - } + err = s.handleHeaderCommand(cli) case CmdEntry: - if cli.status != csStopped { - log.Error("Entry command not allowed, stream started!") - err = ErrEntryCommandNotAllowed - _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], client) - } else { - err = s.processCmdEntry(client) - } + err = s.handleEntryCommand(cli) case CmdBookmark: - if cli.status != csStopped { - log.Error("Bookmark command not allowed, stream started!") - err = ErrBookmarkCommandNotAllowed - _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], client) - } else { - err = s.processCmdBookmark(client) - } + err = s.handleBookmarkCommand(cli) default: log.Error("Invalid command!") @@ -838,6 +794,85 @@ func (s *StreamServer) processCommand(command Command, client *client) error { return err } +// handleStartCommand processes the CmdStart command +func (s *StreamServer) handleStartCommand(cli *client) error { + if cli.status != csStopped { + log.Error("Stream to client already started!") + _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], cli) + return ErrClientAlreadyStarted + } + + cli.status = csSyncing + err := s.processCmdStart(cli) + if err == nil { + cli.status = csSynced + } + + return err +} + +// handleStartBookmarkCommand processes the CmdStartBookmark command +func (s *StreamServer) handleStartBookmarkCommand(cli *client) error { + if cli.status != csStopped { + log.Error("Stream to client already started!") + _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], cli) + return ErrClientAlreadyStarted + } + + cli.status = csSyncing + err := s.processCmdStartBookmark(cli) + if err == nil { + cli.status = csSynced + } + + return err +} + +// handleStopCommand processes the CmdStop command +func (s *StreamServer) handleStopCommand(cli *client) error { + if cli.status != csSynced { + log.Error("Stream to client already stopped!") + _ = s.sendResultEntry(uint32(CmdErrAlreadyStopped), StrCommandErrors[CmdErrAlreadyStopped], cli) + return ErrClientAlreadyStopped + } + + cli.status = csStopped + return s.processCmdStop(cli) +} + +// handleHeaderCommand processes the CmdHeader command +func (s *StreamServer) handleHeaderCommand(cli *client) error { + if cli.status != csStopped { + log.Error("Header command not allowed, stream started!") + _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], cli) + return ErrHeaderCommandNotAllowed + } + + return s.processCmdHeader(cli) +} + +// handleEntryCommand processes the CmdEntry command +func (s *StreamServer) handleEntryCommand(cli *client) error { + if cli.status != csStopped { + log.Error("Entry command not allowed, stream started!") + _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], cli) + return ErrEntryCommandNotAllowed + } + + return s.processCmdEntry(cli) +} + +// handleBookmarkCommand processes the CmdBookmark command +func (s *StreamServer) handleBookmarkCommand(cli *client) error { + if cli.status != csStopped { + log.Error("Bookmark command not allowed, stream started!") + _ = s.sendResultEntry(uint32(CmdErrAlreadyStarted), StrCommandErrors[CmdErrAlreadyStarted], cli) + return ErrBookmarkCommandNotAllowed + } + + return s.processCmdBookmark(cli) +} + // processCmdStart processes the TCP Start command from the clients func (s *StreamServer) processCmdStart(client *client) error { // Read from entry number parameter diff --git a/log/log_test.go b/log/log_test.go index 9a59660..9bbc255 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -5,15 +5,15 @@ import ( ) func TestLogNotInitialized(t *testing.T) { - Info("Test log.Info", " value is ", 10) + Info("Test log.Info value is ", 10) Infof("Test log.Infof %d", 10) Infow("Test log.Infow", "value", 10) Debugf("Test log.Debugf %d", 10) - Error("Test log.Error", " value is ", 10) + Error("Test log.Error value is ", 10) Errorf("Test log.Errorf %d", 10) - Errorw("Test log.Errorw", "value", 10) + Errorw("Test log.Errorw value", 10) Warnf("Test log.Warnf %d", 10) - Warnw("Test log.Warnw", "value", 10) + Warnw("Test log.Warnw value", 10) } func TestLog(t *testing.T) { @@ -25,13 +25,13 @@ func TestLog(t *testing.T) { Init(cfg) - Info("Test log.Info", " value is ", 10) + Info("Test log.Info value is ", 10) Infof("Test log.Infof %d", 10) Infow("Test log.Infow", "value", 10) Debugf("Test log.Debugf %d", 10) - Error("Test log.Error", " value is ", 10) + Error("Test log.Error value is ", 10) Errorf("Test log.Errorf %d", 10) Errorw("Test log.Errorw", "value", 10) Warnf("Test log.Warnf %d", 10) - Warnw("Test log.Warnw", "value", 10) + Warnw("Test log.Warnw value", 10) } diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..5c09858 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,29 @@ +# ===================================================== +# Standard properties +# ===================================================== + +sonar.projectKey=0xPolygon_zkevm-data-streamer +sonar.projectName=zkevm-data-streamer +sonar.organization=0xpolygon + +sonar.sources=. +sonar.exclusions=**/*_test.go + +sonar.tests=. +sonar.test.inclusions=**/*_test.go +sonar.issue.enforceSemantic=true + +# ===================================================== +# Meta-data for the project +# ===================================================== + +sonar.links.homepage=https://github.com/0xPolygon/zkevm-data-streamer +sonar.links.ci=https://github.com/0xPolygon/zkevm-data-streamer/actions +sonar.links.scm=https://github.com/0xPolygon/zkevm-data-streamer +sonar.links.issue=https://github.com/0xPolygon/zkevm-data-streamer/issues + +# ===================================================== +# Properties specific to Go +# ===================================================== + +sonar.go.coverage.reportPaths=coverage.out \ No newline at end of file From 77bea0fe771237cef0fba17143e6764dab81bf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Ram=C3=ADrez?= <58293609+ToniRamirezM@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:55:32 +0200 Subject: [PATCH 10/18] do not kill the connection on error (#133) * do not kill the connection if an error happens during the execution of a command --- datastreamer/streamserver.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index 4e114bd..63b0f60 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -41,8 +41,6 @@ const ( maxConnections = 100 // Maximum number of connected clients streamBuffer = 256 // Buffers for the stream channel maxBookmarkLength = 16 // Maximum number of bytes for a bookmark - - timeout = 2 * time.Second ) const ( @@ -342,10 +340,7 @@ func (s *StreamServer) handleConnection(conn net.Conn) { log.Debugf("Command %d[%s] received from %s", command, StrCommand[Command(command)], clientID) err = s.processCommand(Command(command), s.getSafeClient(clientID)) if err != nil { - // Kill client connection - time.Sleep(timeout) - s.killClient(clientID) - return + log.Errorf("Error processing command %d[%s] from %s: %v", command, StrCommand[Command(command)], clientID, err) } } } From e073571c3fefae55ab774741890c3aa6901e9297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= <93934272+Stefan-Ethernal@users.noreply.github.com> Date: Mon, 12 Aug 2024 12:55:28 +0200 Subject: [PATCH 11/18] Downgrade github.com/spf13/viper and its indirect dependencies (#135) --- go.mod | 18 ++- go.sum | 441 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 427 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index c9731d2..dce92af 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/hermeznetwork/tracerr v0.3.2 github.com/mitchellh/mapstructure v1.5.0 - github.com/spf13/viper v1.18.2 + github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/urfave/cli/v2 v2.27.1 @@ -15,7 +15,7 @@ require ( require ( github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e // indirect @@ -23,18 +23,16 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/afero v1.10.0 // indirect + github.com/spf13/cast v1.5.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.uber.org/multierr v1.10.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 421b102..e59ac1c 100644 --- a/go.sum +++ b/go.sum @@ -1,34 +1,146 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +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/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +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/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +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/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +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.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +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/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hermeznetwork/tracerr v0.3.2 h1:QB3TlQxO/4XHyixsg+nRZPuoel/FFQlQ7oAoHDD5l1c= github.com/hermeznetwork/tracerr v0.3.2/go.mod h1:nsWC1+tc4qUEbUGRv4DcPJJTjLsedlPajlFmpJoohK4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e h1:9MlwzLdW7QSDrhDjFlsEYmxpFyIoXmYRon3dt0io31k= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= @@ -47,29 +159,33 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= -github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= -github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= -github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= +github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= +github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= -github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= +github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= +github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -83,57 +199,338 @@ github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +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-20200119233911-0405dc783f0a/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-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +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= +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-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +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/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/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-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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/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-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/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-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +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/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= 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.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 2f596569332102565e9be0d16f41e09f6a65d6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Ram=C3=ADrez?= <58293609+ToniRamirezM@users.noreply.github.com> Date: Fri, 30 Aug 2024 09:38:31 +0200 Subject: [PATCH 12/18] reset process func and isStarted (#138) --- datastreamer/streamclient.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/datastreamer/streamclient.go b/datastreamer/streamclient.go index 42a3c2e..0a0e51e 100644 --- a/datastreamer/streamclient.go +++ b/datastreamer/streamclient.go @@ -577,12 +577,23 @@ func (c *StreamClient) SetProcessEntryFunc(f ProcessEntryFunc) { c.setProcessEntryFunc(f, nil) } +// ResetProcessEntryFunc resets the callback function to the default one +func (c *StreamClient) ResetProcessEntryFunc() { + // Set default callback function to process entry + c.setProcessEntryFunc(PrintReceivedEntry, c.relayServer) +} + // setProcessEntryFunc sets the callback function to process entry with server parameter func (c *StreamClient) setProcessEntryFunc(f ProcessEntryFunc, s *StreamServer) { c.processEntry = f c.relayServer = s } +// IsStarted returns if the client is started +func (c *StreamClient) IsStarted() bool { + return c.started +} + // PrintReceivedEntry prints received entry (default callback function) func PrintReceivedEntry(e *FileEntry, c *StreamClient, s *StreamServer) error { // Log data entry fields From ae23d0948a3d3315a5e79c318a10f7d0a0ee04d5 Mon Sep 17 00:00:00 2001 From: Alonso Rodriguez Date: Tue, 10 Sep 2024 12:30:17 +0200 Subject: [PATCH 13/18] unit test (#140) * unit test * linter * fix log data race condition --- cmd/main.go | 10 ++---- datastreamer/datastreamer_test.go | 24 +++++++------ datastreamer/streamclient.go | 32 ++++++++--------- datastreamer/streamfile_test.go | 22 ++++++++++++ datastreamer/streamrelay.go | 12 ++----- datastreamer/streamrelay_test.go | 58 +++++++++++++++++++++++++++++++ datastreamer/streamserver.go | 2 +- 7 files changed, 114 insertions(+), 46 deletions(-) create mode 100644 datastreamer/streamfile_test.go create mode 100644 datastreamer/streamrelay_test.go diff --git a/cmd/main.go b/cmd/main.go index bd81fc1..f83ffdf 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -452,10 +452,7 @@ func runClient(ctx *cli.Context) error { paramDumpBatch := ctx.String("dumpbatch") // Create client - c, err := datastreamer.NewClient(server, StSequencer) - if err != nil { - return err - } + c := datastreamer.NewClient(server, StSequencer) // Set process entry callback function if !sanityCheck { @@ -478,10 +475,7 @@ func runClient(ctx *cli.Context) error { } // Start client (connect to the server) - err = c.Start() - if err != nil { - return err - } + c.Start() // Query file header information if queryHeader { diff --git a/datastreamer/datastreamer_test.go b/datastreamer/datastreamer_test.go index 9239896..6760e5c 100644 --- a/datastreamer/datastreamer_test.go +++ b/datastreamer/datastreamer_test.go @@ -104,7 +104,6 @@ var ( }, WriteTimeout: 3 * time.Second, } - leveldb = config.Filename[0:strings.IndexRune(config.Filename, '.')] + ".db" streamServer *datastreamer.StreamServer streamType = datastreamer.StreamType(1) entryType1 = datastreamer.EntryType(1) @@ -180,15 +179,15 @@ var ( } ) -func deleteFiles() error { +func deleteFiles(fileName string) error { // Delete test file from filesystem - err := os.Remove(config.Filename) + err := os.Remove(fileName) if err != nil && !os.IsNotExist(err) { return err } // Delete leveldb folder from filesystem - err = os.RemoveAll(leveldb) + err = os.RemoveAll(fileName[0:strings.IndexRune(fileName, '.')] + ".db") if err != nil && !os.IsNotExist(err) { return err } @@ -197,7 +196,7 @@ func deleteFiles() error { } func TestServer(t *testing.T) { - err := deleteFiles() + err := deleteFiles(config.Filename) if err != nil { panic(err) } @@ -448,6 +447,8 @@ func TestServer(t *testing.T) { // Log final file header datastreamer.PrintHeaderEntry(streamServer.GetHeader(), "final tests") + + streamServer.BookmarkPrintDump() } func TestClient(t *testing.T) { @@ -456,15 +457,13 @@ func TestClient(t *testing.T) { var entry datastreamer.FileEntry var header datastreamer.HeaderEntry - client, err := datastreamer.NewClient(fmt.Sprintf("localhost:%d", config.Port), streamType) - require.NoError(t, err) + client := datastreamer.NewClient(fmt.Sprintf("localhost:%d", config.Port), streamType) - err = client.Start() - require.NoError(t, err) + client.Start() // Case: Query data from not existing bookmark -> FAIL fromBookmark = nonAddedBookmark.Encode() - _, err = client.ExecCommandGetBookmark(fromBookmark) + _, err := client.ExecCommandGetBookmark(fromBookmark) require.EqualError(t, datastreamer.ErrBookmarkNotFound, err.Error()) // Case: Query data from existing bookmark -> OK @@ -534,4 +533,9 @@ func TestClient(t *testing.T) { entry, err = client.ExecCommandGetEntry(fromEntry) require.NoError(t, err) require.Equal(t, testEntries[2], TestEntry{}.Decode(entry.Data)) + require.Equal(t, uint64(0), client.GetFromStream()) + require.Equal(t, uint64(1304), client.GetTotalEntries()) + require.True(t, client.IsStarted()) + log.Debug("closing connection from the test") + client.CloseConnection() } diff --git a/datastreamer/streamclient.go b/datastreamer/streamclient.go index 0a0e51e..b52aafa 100644 --- a/datastreamer/streamclient.go +++ b/datastreamer/streamclient.go @@ -45,7 +45,7 @@ type StreamClient struct { } // NewClient creates a new data stream client -func NewClient(server string, streamType StreamType) (*StreamClient, error) { +func NewClient(server string, streamType StreamType) *StreamClient { // Create the client data stream c := StreamClient{ server: server, @@ -69,17 +69,17 @@ func NewClient(server string, streamType StreamType) (*StreamClient, error) { // Set default callback function to process entry c.setProcessEntryFunc(PrintReceivedEntry, c.relayServer) - return &c, nil + return &c } // NewClientWithLogsConfig creates a new data stream client with logs configuration -func NewClientWithLogsConfig(server string, streamType StreamType, logsConfig log.Config) (*StreamClient, error) { +func NewClientWithLogsConfig(server string, streamType StreamType, logsConfig log.Config) *StreamClient { log.Init(logsConfig) return NewClient(server, streamType) } // Start connects to the data stream server and starts getting data from the server -func (c *StreamClient) Start() error { +func (c *StreamClient) Start() { // Connect to server c.connectServer() @@ -91,8 +91,6 @@ func (c *StreamClient) Start() error { // Flag stared c.started = true - - return nil } // connectServer waits until the server connection is established and returns if a command result is pending @@ -116,7 +114,7 @@ func (c *StreamClient) connectServer() bool { if c.streaming { _, _, err = c.execCommand(CmdStart, true, c.nextEntry, nil) if err != nil { - c.closeConnection() + c.CloseConnection() time.Sleep(defaultTimeout) continue } @@ -129,8 +127,8 @@ func (c *StreamClient) connectServer() bool { return false } -// closeConnection closes connection to the server -func (c *StreamClient) closeConnection() { +// CloseConnection closes connection to the server +func (c *StreamClient) CloseConnection() { if c.conn != nil { log.Infof("%s Close connection", c.ID) c.conn.Close() @@ -432,7 +430,7 @@ func (c *StreamClient) readResultEntry() (ResultEntry, error) { if err != nil { return e, err } - // PrintResultEntry(e) + // e.PrintResultEntry() return e, nil } @@ -453,7 +451,7 @@ func (c *StreamClient) readContent(buffer []byte) error { // readEntries reads from the server all type of packets func (c *StreamClient) readEntries() { - defer c.closeConnection() + defer c.CloseConnection() for { // Wait for connection @@ -463,7 +461,7 @@ func (c *StreamClient) readEntries() { packet := make([]byte, 1) err := c.readContent(packet) if err != nil { - c.closeConnection() + c.CloseConnection() continue } @@ -473,7 +471,7 @@ func (c *StreamClient) readEntries() { // Read result entry data r, err := c.readResultEntry() if err != nil { - c.closeConnection() + c.CloseConnection() continue } // Send data to results channel @@ -482,7 +480,7 @@ func (c *StreamClient) readEntries() { if deferredResult { r := c.getResult(CmdStart) if r.errorNum != uint32(CmdErrOK) { - c.closeConnection() + c.CloseConnection() time.Sleep(defaultTimeout) continue } @@ -492,7 +490,7 @@ func (c *StreamClient) readEntries() { // Read result entry data r, err := c.readDataEntry() if err != nil { - c.closeConnection() + c.CloseConnection() continue } c.entryRsp <- r @@ -501,7 +499,7 @@ func (c *StreamClient) readEntries() { // Read header entry data h, err := c.readHeaderEntry() if err != nil { - c.closeConnection() + c.CloseConnection() continue } // Send data to headers channel @@ -511,7 +509,7 @@ func (c *StreamClient) readEntries() { // Read file/stream entry data e, err := c.readDataEntry() if err != nil { - c.closeConnection() + c.CloseConnection() continue } // Send data to stream entries channel diff --git a/datastreamer/streamfile_test.go b/datastreamer/streamfile_test.go new file mode 100644 index 0000000..cd8ac20 --- /dev/null +++ b/datastreamer/streamfile_test.go @@ -0,0 +1,22 @@ +package datastreamer_test + +import ( + "testing" + + "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" + "github.com/stretchr/testify/require" +) + +func TestOpenFile(t *testing.T) { + fileName := "/tmp/datastreamer_test_3.bin" + err := deleteFiles(fileName) + require.NoError(t, err) + _, err = datastreamer.NewStreamFile(fileName, 1, 137, streamType) + require.NoError(t, err) + + _, err = datastreamer.NewStreamFile(fileName, 1, 137, streamType) + require.NoError(t, err) + + err = deleteFiles(fileName) + require.NoError(t, err) +} diff --git a/datastreamer/streamrelay.go b/datastreamer/streamrelay.go index 253bc0b..369e9c1 100644 --- a/datastreamer/streamrelay.go +++ b/datastreamer/streamrelay.go @@ -20,11 +20,7 @@ func NewRelay(server string, port uint16, version uint8, systemID uint64, var err error // Create client side - r.client, err = NewClient(server, streamType) - if err != nil { - log.Errorf("Error creating relay client side: %v", err) - return nil, err - } + r.client = NewClient(server, streamType) // Create server side r.server, err = NewServer(port, version, systemID, streamType, fileName, writeTimeout, @@ -43,11 +39,7 @@ func NewRelay(server string, port uint16, version uint8, systemID uint64, // Start connects and syncs with master server then opens access to relay clients func (r *StreamRelay) Start() error { // Start client side - err := r.client.Start() - if err != nil { - log.Errorf("Error starting relay client: %v", err) - return err - } + r.client.Start() // Get total entries from the master server header, err := r.client.ExecCommandGetHeader() diff --git a/datastreamer/streamrelay_test.go b/datastreamer/streamrelay_test.go new file mode 100644 index 0000000..4848000 --- /dev/null +++ b/datastreamer/streamrelay_test.go @@ -0,0 +1,58 @@ +package datastreamer_test + +import ( + "fmt" + "testing" + "time" + + "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" + "github.com/stretchr/testify/require" +) + +func TestRelay(t *testing.T) { + fileName1 := "/tmp/datastreamer_test_0.bin" + fileName2 := "/tmp/datastreamer_test_1.bin" + + err := deleteFiles(fileName1) + require.NoError(t, err) + err = deleteFiles(fileName2) + require.NoError(t, err) + + streamServer, err := datastreamer.NewServer(6901, 1, 137, streamType, + fileName1, config.WriteTimeout, config.InactivityTimeout, 5*time.Second, &config.Log) + require.NoError(t, err) + + err = streamServer.Start() + require.NoError(t, err) + err = streamServer.StartAtomicOp() + require.NoError(t, err) + + entryNumber, err := streamServer.AddStreamBookmark(testBookmark.Encode()) + require.NoError(t, err) + require.Equal(t, uint64(0), entryNumber) + + entryNumber, err = streamServer.AddStreamEntry(entryType1, testEntries[1].Encode()) + require.NoError(t, err) + require.Equal(t, uint64(1), entryNumber) + + entryNumber, err = streamServer.AddStreamBookmark(testBookmark2.Encode()) + require.NoError(t, err) + require.Equal(t, uint64(2), entryNumber) + + entryNumber, err = streamServer.AddStreamEntry(entryType1, testEntries[2].Encode()) + require.NoError(t, err) + require.Equal(t, uint64(3), entryNumber) + + err = streamServer.CommitAtomicOp() + require.NoError(t, err) + + var relayPort uint16 = 6902 + sr, err := datastreamer.NewRelay(fmt.Sprintf("localhost:%d", 6901), relayPort, 1, 137, datastreamer.StreamType(1), + fileName2, config.WriteTimeout, config.InactivityTimeout, 5*time.Second, nil) + require.NoError(t, err) + err = sr.Start() + require.NoError(t, err) + + client := datastreamer.NewClient(fmt.Sprintf("localhost:%d", relayPort), streamType) + client.Start() +} diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index 63b0f60..d574c7d 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -1263,7 +1263,7 @@ func DecodeBinaryToResultEntry(b []byte) (ResultEntry, error) { } // PrintResultEntry prints result entry type -func PrintResultEntry(e ResultEntry) { +func (e ResultEntry) PrintResultEntry() { log.Debug("--- RESULT ENTRY -------------------------") log.Debugf("packetType: [%d]", e.packetType) log.Debugf("length: [%d]", e.length) From 2cd16259ac23dba71cbd7222ff3be31dfd745b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Ram=C3=ADrez?= <58293609+ToniRamirezM@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:33:19 +0200 Subject: [PATCH 14/18] Revert "unit test (#140)" (#141) This reverts commit ae23d0948a3d3315a5e79c318a10f7d0a0ee04d5. --- cmd/main.go | 10 ++++-- datastreamer/datastreamer_test.go | 24 ++++++------- datastreamer/streamclient.go | 32 +++++++++-------- datastreamer/streamfile_test.go | 22 ------------ datastreamer/streamrelay.go | 12 +++++-- datastreamer/streamrelay_test.go | 58 ------------------------------- datastreamer/streamserver.go | 2 +- 7 files changed, 46 insertions(+), 114 deletions(-) delete mode 100644 datastreamer/streamfile_test.go delete mode 100644 datastreamer/streamrelay_test.go diff --git a/cmd/main.go b/cmd/main.go index f83ffdf..bd81fc1 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -452,7 +452,10 @@ func runClient(ctx *cli.Context) error { paramDumpBatch := ctx.String("dumpbatch") // Create client - c := datastreamer.NewClient(server, StSequencer) + c, err := datastreamer.NewClient(server, StSequencer) + if err != nil { + return err + } // Set process entry callback function if !sanityCheck { @@ -475,7 +478,10 @@ func runClient(ctx *cli.Context) error { } // Start client (connect to the server) - c.Start() + err = c.Start() + if err != nil { + return err + } // Query file header information if queryHeader { diff --git a/datastreamer/datastreamer_test.go b/datastreamer/datastreamer_test.go index 6760e5c..9239896 100644 --- a/datastreamer/datastreamer_test.go +++ b/datastreamer/datastreamer_test.go @@ -104,6 +104,7 @@ var ( }, WriteTimeout: 3 * time.Second, } + leveldb = config.Filename[0:strings.IndexRune(config.Filename, '.')] + ".db" streamServer *datastreamer.StreamServer streamType = datastreamer.StreamType(1) entryType1 = datastreamer.EntryType(1) @@ -179,15 +180,15 @@ var ( } ) -func deleteFiles(fileName string) error { +func deleteFiles() error { // Delete test file from filesystem - err := os.Remove(fileName) + err := os.Remove(config.Filename) if err != nil && !os.IsNotExist(err) { return err } // Delete leveldb folder from filesystem - err = os.RemoveAll(fileName[0:strings.IndexRune(fileName, '.')] + ".db") + err = os.RemoveAll(leveldb) if err != nil && !os.IsNotExist(err) { return err } @@ -196,7 +197,7 @@ func deleteFiles(fileName string) error { } func TestServer(t *testing.T) { - err := deleteFiles(config.Filename) + err := deleteFiles() if err != nil { panic(err) } @@ -447,8 +448,6 @@ func TestServer(t *testing.T) { // Log final file header datastreamer.PrintHeaderEntry(streamServer.GetHeader(), "final tests") - - streamServer.BookmarkPrintDump() } func TestClient(t *testing.T) { @@ -457,13 +456,15 @@ func TestClient(t *testing.T) { var entry datastreamer.FileEntry var header datastreamer.HeaderEntry - client := datastreamer.NewClient(fmt.Sprintf("localhost:%d", config.Port), streamType) + client, err := datastreamer.NewClient(fmt.Sprintf("localhost:%d", config.Port), streamType) + require.NoError(t, err) - client.Start() + err = client.Start() + require.NoError(t, err) // Case: Query data from not existing bookmark -> FAIL fromBookmark = nonAddedBookmark.Encode() - _, err := client.ExecCommandGetBookmark(fromBookmark) + _, err = client.ExecCommandGetBookmark(fromBookmark) require.EqualError(t, datastreamer.ErrBookmarkNotFound, err.Error()) // Case: Query data from existing bookmark -> OK @@ -533,9 +534,4 @@ func TestClient(t *testing.T) { entry, err = client.ExecCommandGetEntry(fromEntry) require.NoError(t, err) require.Equal(t, testEntries[2], TestEntry{}.Decode(entry.Data)) - require.Equal(t, uint64(0), client.GetFromStream()) - require.Equal(t, uint64(1304), client.GetTotalEntries()) - require.True(t, client.IsStarted()) - log.Debug("closing connection from the test") - client.CloseConnection() } diff --git a/datastreamer/streamclient.go b/datastreamer/streamclient.go index b52aafa..0a0e51e 100644 --- a/datastreamer/streamclient.go +++ b/datastreamer/streamclient.go @@ -45,7 +45,7 @@ type StreamClient struct { } // NewClient creates a new data stream client -func NewClient(server string, streamType StreamType) *StreamClient { +func NewClient(server string, streamType StreamType) (*StreamClient, error) { // Create the client data stream c := StreamClient{ server: server, @@ -69,17 +69,17 @@ func NewClient(server string, streamType StreamType) *StreamClient { // Set default callback function to process entry c.setProcessEntryFunc(PrintReceivedEntry, c.relayServer) - return &c + return &c, nil } // NewClientWithLogsConfig creates a new data stream client with logs configuration -func NewClientWithLogsConfig(server string, streamType StreamType, logsConfig log.Config) *StreamClient { +func NewClientWithLogsConfig(server string, streamType StreamType, logsConfig log.Config) (*StreamClient, error) { log.Init(logsConfig) return NewClient(server, streamType) } // Start connects to the data stream server and starts getting data from the server -func (c *StreamClient) Start() { +func (c *StreamClient) Start() error { // Connect to server c.connectServer() @@ -91,6 +91,8 @@ func (c *StreamClient) Start() { // Flag stared c.started = true + + return nil } // connectServer waits until the server connection is established and returns if a command result is pending @@ -114,7 +116,7 @@ func (c *StreamClient) connectServer() bool { if c.streaming { _, _, err = c.execCommand(CmdStart, true, c.nextEntry, nil) if err != nil { - c.CloseConnection() + c.closeConnection() time.Sleep(defaultTimeout) continue } @@ -127,8 +129,8 @@ func (c *StreamClient) connectServer() bool { return false } -// CloseConnection closes connection to the server -func (c *StreamClient) CloseConnection() { +// closeConnection closes connection to the server +func (c *StreamClient) closeConnection() { if c.conn != nil { log.Infof("%s Close connection", c.ID) c.conn.Close() @@ -430,7 +432,7 @@ func (c *StreamClient) readResultEntry() (ResultEntry, error) { if err != nil { return e, err } - // e.PrintResultEntry() + // PrintResultEntry(e) return e, nil } @@ -451,7 +453,7 @@ func (c *StreamClient) readContent(buffer []byte) error { // readEntries reads from the server all type of packets func (c *StreamClient) readEntries() { - defer c.CloseConnection() + defer c.closeConnection() for { // Wait for connection @@ -461,7 +463,7 @@ func (c *StreamClient) readEntries() { packet := make([]byte, 1) err := c.readContent(packet) if err != nil { - c.CloseConnection() + c.closeConnection() continue } @@ -471,7 +473,7 @@ func (c *StreamClient) readEntries() { // Read result entry data r, err := c.readResultEntry() if err != nil { - c.CloseConnection() + c.closeConnection() continue } // Send data to results channel @@ -480,7 +482,7 @@ func (c *StreamClient) readEntries() { if deferredResult { r := c.getResult(CmdStart) if r.errorNum != uint32(CmdErrOK) { - c.CloseConnection() + c.closeConnection() time.Sleep(defaultTimeout) continue } @@ -490,7 +492,7 @@ func (c *StreamClient) readEntries() { // Read result entry data r, err := c.readDataEntry() if err != nil { - c.CloseConnection() + c.closeConnection() continue } c.entryRsp <- r @@ -499,7 +501,7 @@ func (c *StreamClient) readEntries() { // Read header entry data h, err := c.readHeaderEntry() if err != nil { - c.CloseConnection() + c.closeConnection() continue } // Send data to headers channel @@ -509,7 +511,7 @@ func (c *StreamClient) readEntries() { // Read file/stream entry data e, err := c.readDataEntry() if err != nil { - c.CloseConnection() + c.closeConnection() continue } // Send data to stream entries channel diff --git a/datastreamer/streamfile_test.go b/datastreamer/streamfile_test.go deleted file mode 100644 index cd8ac20..0000000 --- a/datastreamer/streamfile_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package datastreamer_test - -import ( - "testing" - - "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" - "github.com/stretchr/testify/require" -) - -func TestOpenFile(t *testing.T) { - fileName := "/tmp/datastreamer_test_3.bin" - err := deleteFiles(fileName) - require.NoError(t, err) - _, err = datastreamer.NewStreamFile(fileName, 1, 137, streamType) - require.NoError(t, err) - - _, err = datastreamer.NewStreamFile(fileName, 1, 137, streamType) - require.NoError(t, err) - - err = deleteFiles(fileName) - require.NoError(t, err) -} diff --git a/datastreamer/streamrelay.go b/datastreamer/streamrelay.go index 369e9c1..253bc0b 100644 --- a/datastreamer/streamrelay.go +++ b/datastreamer/streamrelay.go @@ -20,7 +20,11 @@ func NewRelay(server string, port uint16, version uint8, systemID uint64, var err error // Create client side - r.client = NewClient(server, streamType) + r.client, err = NewClient(server, streamType) + if err != nil { + log.Errorf("Error creating relay client side: %v", err) + return nil, err + } // Create server side r.server, err = NewServer(port, version, systemID, streamType, fileName, writeTimeout, @@ -39,7 +43,11 @@ func NewRelay(server string, port uint16, version uint8, systemID uint64, // Start connects and syncs with master server then opens access to relay clients func (r *StreamRelay) Start() error { // Start client side - r.client.Start() + err := r.client.Start() + if err != nil { + log.Errorf("Error starting relay client: %v", err) + return err + } // Get total entries from the master server header, err := r.client.ExecCommandGetHeader() diff --git a/datastreamer/streamrelay_test.go b/datastreamer/streamrelay_test.go deleted file mode 100644 index 4848000..0000000 --- a/datastreamer/streamrelay_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package datastreamer_test - -import ( - "fmt" - "testing" - "time" - - "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" - "github.com/stretchr/testify/require" -) - -func TestRelay(t *testing.T) { - fileName1 := "/tmp/datastreamer_test_0.bin" - fileName2 := "/tmp/datastreamer_test_1.bin" - - err := deleteFiles(fileName1) - require.NoError(t, err) - err = deleteFiles(fileName2) - require.NoError(t, err) - - streamServer, err := datastreamer.NewServer(6901, 1, 137, streamType, - fileName1, config.WriteTimeout, config.InactivityTimeout, 5*time.Second, &config.Log) - require.NoError(t, err) - - err = streamServer.Start() - require.NoError(t, err) - err = streamServer.StartAtomicOp() - require.NoError(t, err) - - entryNumber, err := streamServer.AddStreamBookmark(testBookmark.Encode()) - require.NoError(t, err) - require.Equal(t, uint64(0), entryNumber) - - entryNumber, err = streamServer.AddStreamEntry(entryType1, testEntries[1].Encode()) - require.NoError(t, err) - require.Equal(t, uint64(1), entryNumber) - - entryNumber, err = streamServer.AddStreamBookmark(testBookmark2.Encode()) - require.NoError(t, err) - require.Equal(t, uint64(2), entryNumber) - - entryNumber, err = streamServer.AddStreamEntry(entryType1, testEntries[2].Encode()) - require.NoError(t, err) - require.Equal(t, uint64(3), entryNumber) - - err = streamServer.CommitAtomicOp() - require.NoError(t, err) - - var relayPort uint16 = 6902 - sr, err := datastreamer.NewRelay(fmt.Sprintf("localhost:%d", 6901), relayPort, 1, 137, datastreamer.StreamType(1), - fileName2, config.WriteTimeout, config.InactivityTimeout, 5*time.Second, nil) - require.NoError(t, err) - err = sr.Start() - require.NoError(t, err) - - client := datastreamer.NewClient(fmt.Sprintf("localhost:%d", relayPort), streamType) - client.Start() -} diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index d574c7d..63b0f60 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -1263,7 +1263,7 @@ func DecodeBinaryToResultEntry(b []byte) (ResultEntry, error) { } // PrintResultEntry prints result entry type -func (e ResultEntry) PrintResultEntry() { +func PrintResultEntry(e ResultEntry) { log.Debug("--- RESULT ENTRY -------------------------") log.Debugf("packetType: [%d]", e.packetType) log.Debugf("length: [%d]", e.length) From 80fd1faa2afe9cb365c7c4ae2edff948858ff732 Mon Sep 17 00:00:00 2001 From: Alonso Rodriguez Date: Thu, 19 Sep 2024 09:23:39 +0200 Subject: [PATCH 15/18] Fix/ds app (#144) * WIP * dsTool working again * linter * fix batchL2Data * avoid fatal if dump finish fine --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- .golangci.yml | 2 + Makefile | 4 +- README.md | 118 ++- cmd/main.go | 521 +++++++--- datastream/datastream.pb.go | 1136 +++++++++++++++++++++ go.mod | 12 +- go.sum | 29 +- proto/datastream/v1/datastream.proto | 95 ++ proto/include/google/protobuf/empty.proto | 51 + 11 files changed, 1780 insertions(+), 192 deletions(-) create mode 100644 datastream/datastream.pb.go create mode 100644 proto/datastream/v1/datastream.proto create mode 100644 proto/include/google/protobuf/empty.proto diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c30fae0..6d9eee4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.19.x + go-version: 1.21.x - name: Checkout code uses: actions/checkout@v3 - name: Lint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2e58fc6..c07df9d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ test: strategy: matrix: - go-version: [ 1.19.x ] + go-version: [ 1.21.x ] goarch: [ "amd64" ] runs-on: ubuntu-latest steps: diff --git a/.golangci.yml b/.golangci.yml index 1623a3d..0171dab 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -33,6 +33,8 @@ linters: - godox # Godox is a linter for TODOs and FIXMEs left in the code linters-settings: + dupl: + threshold: 300 revive: rules: - name: exported diff --git a/Makefile b/Makefile index 03f8f92..a9fa70f 100644 --- a/Makefile +++ b/Makefile @@ -56,4 +56,6 @@ help: ## Prints this help @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | sort \ | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' - \ No newline at end of file + +generate-code-from-proto: ## Generates code from proto files + cd proto/datastream/v1 && protoc --proto_path=. --proto_path=../../include --go_out=../../../datastream --go-grpc_out=../../../datastream --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative datastream.proto diff --git a/README.md b/README.md index 54fd567..aaceda0 100644 --- a/README.md +++ b/README.md @@ -294,43 +294,81 @@ Sequencer data stream service to stream L2 blocks and L2 txs List of events (entry types): -### Start L2 Block -- Entry type = 1 -- Entry data: ->u64 batchNum ->u64 blockL2Num ->u64 timestamp ->u32 deltaTimestamp ->u32 L1InfoTreeIndex ->u8[32] l1BlockHash ->u8[32] globalExitRoot ->u8[20] coinbase ->u16 forkID ->u32 chainID - -### L2 TX -- Entry type = 2 -- Entry data: ->u8 gasPricePercentage ->u8 isValid // Intrinsic ->u8[32] stateRoot ->u32 encodedTXLength ->u8[] encodedTX - -### End L2 Block -- Entry type = 3 -- Entry data: ->u64 blockL2Num ->u8[32] l2BlockHash ->u8[32] stateRoot - -### Update GER -- Entry type = 4 -- Entry data: ->u64 batchNum ->u64 timestamp ->u8[32] globalExitRoot ->u8[20] coinbase ->u16 forkID ->u32 chainID ->u8[32] stateRoot +### BatchStart: +uint64 number +BatchType type +uint64 fork_id +uint64 chain_id +Debug debug + +### BatchEnd: +uint64 number +bytes local_exit_root +bytes state_root +Debug debug + +### L2Block: +uint64 number +uint64 batch_number +uint64 timestamp +uint32 delta_timestamp +uint64 min_timestamp +bytes l1_blockhash +uint32 l1_infotree_index +bytes hash +bytes state_root +bytes global_exit_root +bytes coinbase +uint64 block_gas_limit +bytes block_info_root +Debug debug + +### L2BlockEnd: +uint64 number + +### Transaction: +uint64 l2block_number +uint64 index +bool is_valid +bytes encoded +uint32 effective_gas_price_percentage +bytes im_state_root +Debug debug + +### UpdateGER: +uint64 batch_number +uint64 timestamp +bytes global_exit_root +bytes coinbase +uint64 fork_id +uint64 chain_id +bytes state_root +Debug debug + +### BookMark: +BookmarkType type +uint64 value + +### Debug: +string message + +### BookmarkType: +BOOKMARK_TYPE_UNSPECIFIED = 0; +BOOKMARK_TYPE_BATCH = 1; +BOOKMARK_TYPE_L2_BLOCK = 2; + +### EntryType: +ENTRY_TYPE_UNSPECIFIED = 0; +ENTRY_TYPE_BATCH_START = 1; +ENTRY_TYPE_L2_BLOCK = 2; +ENTRY_TYPE_TRANSACTION = 3; +ENTRY_TYPE_BATCH_END = 4; +ENTRY_TYPE_UPDATE_GER = 5; +ENTRY_TYPE_L2_BLOCK_END = 6; + +### BatchType: +BATCH_TYPE_UNSPECIFIED = 0; +BATCH_TYPE_REGULAR = 1; +BATCH_TYPE_FORCED = 2; +BATCH_TYPE_INJECTED = 3; +BATCH_TYPE_INVALID = 4; \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go index bd81fc1..e0b9c55 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,7 +1,7 @@ package main import ( - "encoding/binary" + "encoding/hex" "encoding/json" "errors" "fmt" @@ -11,21 +11,24 @@ import ( "syscall" "time" + "github.com/0xPolygonHermez/zkevm-data-streamer/datastream" "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" "github.com/0xPolygonHermez/zkevm-data-streamer/log" + "github.com/ethereum/go-ethereum/common" "github.com/urfave/cli/v2" + "google.golang.org/protobuf/proto" ) const ( - EtL2BlockStart datastreamer.EntryType = 1 // EtL2BlockStart entry type - EtL2Tx datastreamer.EntryType = 2 // EtL2Tx entry type - EtL2BlockEnd datastreamer.EntryType = 3 // EtL2BlockEnd entry type - EtUpdateGER datastreamer.EntryType = 4 // EtUpdateGER entry type - StSequencer = 1 // StSequencer sequencer stream type - BookmarkL2Block byte = 0 // BookmarkL2Block bookmark type - BookmarkBatch byte = 1 // BookmarkBatch bookmark type + BookmarkBatch datastream.BookmarkType = 1 // BookmarkBatch bookmark type + BookmarkL2Block datastream.BookmarkType = 2 // BookmarkL2Block bookmark type + + BatchTypeRegular uint32 = 1 // BatchTypeRegular Regula Batch type + BatchTypeForced uint32 = 2 // BatchTypeForced Forced Batch type + BatchTypeInjected uint32 = 3 // BatchTypeInjected Injected Batch type + BatchTypeInvalid uint32 = 4 // BatchTypeInvalid Invalid Batch type streamerSystemID = 137 streamerVersion = 1 @@ -37,20 +40,29 @@ const ( var ( initSanityEntry bool = false + initSanityBatch bool = false + initSanityBatchEnd bool = false initSanityBlock bool = false + initSanityBlockEnd bool = false initSanityBookmark bool = false sanityEntry uint64 = 0 + sanityBatch uint64 = 0 sanityBlock uint64 = 0 - sanityBookmark0 uint64 = 0 - sanityBookmark1 uint64 = 0 - dumpBatchNumber uint64 = 0 - dumpBatchData string - initDumpBatch bool = false - dumpEntryFirst uint64 = 0 - dumpEntryLast uint64 = 0 - dumpBlockFirst uint64 = 0 - dumpBlockLast uint64 = 0 - dumpTotalTx uint64 = 0 + sanityBlockEnd uint64 = 0 + sanityBatchEnd uint64 = 0 + + sanityBookmarkL2Block uint64 = 0 + sanityBookmarkBatch uint64 = 0 + + sanityForkID uint64 = 0 + dumpBatchNumber uint64 = 0 + dumpBatchData string + initDumpBatch bool = false + dumpEntryFirst uint64 = 0 + dumpEntryLast uint64 = 0 + dumpBlockFirst uint64 = 0 + dumpBlockLast uint64 = 0 + dumpTotalTx uint64 = 0 ) // main runs a datastream server or client @@ -298,30 +310,54 @@ func runServer(ctx *cli.Context) error { log.Errorf(">> App error! AddStreamBookmark: %v", err) } - // 2.Bookmark L2 block + // 2.Batch Start + _, err = s.AddStreamEntry(datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_START), + fakeDataBatchStart(init+n)) + if err != nil { + log.Errorf(">> App error! AddStreamEntry type %v: %v", + datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_START), err) + return + } + + // 3.Bookmark L2 block _, err = s.AddStreamBookmark(fakeBookmark(BookmarkL2Block, init+n)) if err != nil { log.Errorf(">> App error! AddStreamBookmark: %v", err) } - // 3.Block Start - entryBlockStart, err := s.AddStreamEntry(EtL2BlockStart, fakeDataBlockStart(init+n)) + // 4.Block Start + entryBlockStart, err := s.AddStreamEntry(datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK), + fakeDataBlockStart(init+n, init+n)) if err != nil { - log.Errorf(">> App error! AddStreamEntry type %v: %v", EtL2BlockStart, err) + log.Errorf(">> App error! AddStreamEntry type %v: %v", + datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK), err) return } - // 4.Tx + // 5.Tx numTx := 1 // rand.Intn(20) + 1 for i := 1; i <= numTx; i++ { - _, err = s.AddStreamEntry(EtL2Tx, fakeDataTx()) + _, err = s.AddStreamEntry(datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_TRANSACTION), + fakeDataTx()) if err != nil { - log.Errorf(">> App error! AddStreamEntry type %v: %v", EtL2Tx, err) + log.Errorf(">> App error! AddStreamEntry type %v: %v", + datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_TRANSACTION), err) return } } // 5.Block End - _, err = s.AddStreamEntry(EtL2BlockEnd, fakeDataBlockEnd(init+n)) + _, err = s.AddStreamEntry(datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK_END), + fakeDataBlockEnd(init+n)) if err != nil { - log.Errorf(">> App error! AddStreamEntry type %v: %v", EtL2BlockEnd, err) + log.Errorf(">> App error! AddStreamEntry type %v: %v", + datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK_END), err) + return + } + + // 5.Batch End + _, err = s.AddStreamEntry(datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_END), + fakeDataBatchEnd(init+n)) + if err != nil { + log.Errorf(">> App error! AddStreamEntry type %v: %v", + datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_END), err) return } @@ -355,72 +391,95 @@ func runServer(ctx *cli.Context) error { return nil } -func fakeBookmark(bookType byte, value uint64) []byte { - bookmark := []byte{bookType} - bookmark = binary.BigEndian.AppendUint64(bookmark, value) - return bookmark +func fakeBookmark(bookType datastream.BookmarkType, value uint64) []byte { + bookmark := datastream.BookMark{Type: bookType} + b, err := proto.Marshal(&bookmark) + if err != nil { + log.Error("error marshalling fake bookmark. Ignoring it....") + } + return b } -func fakeDataBlockStart(blockNum uint64) []byte { - dataBlockStart := make([]byte, 0) - dataBlockStart = binary.BigEndian.AppendUint64(dataBlockStart, 101) //nolint:mnd - dataBlockStart = binary.BigEndian.AppendUint64(dataBlockStart, blockNum) - dataBlockStart = binary.BigEndian.AppendUint64(dataBlockStart, uint64(time.Now().Unix())) - dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 10) //nolint:mnd - dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 1000) //nolint:mnd - dataBlockStart = append(dataBlockStart, - []byte{ - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - }...) - dataBlockStart = append(dataBlockStart, - []byte{10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - }...) - dataBlockStart = append(dataBlockStart, - []byte{ - 20, 21, 22, 23, 24, 20, 21, 22, 23, 24, - 20, 21, 22, 23, 24, 20, 21, 22, 23, 24, - }...) - dataBlockStart = binary.BigEndian.AppendUint16(dataBlockStart, 5) //nolint:mnd - dataBlockStart = binary.BigEndian.AppendUint32(dataBlockStart, 137) //nolint:mnd - return dataBlockStart +func fakeDataBlockStart(blockNum, batchNum uint64) []byte { + l2Block := datastream.L2Block{ + Number: blockNum, + BatchNumber: batchNum, + Timestamp: uint64(time.Now().Unix()), + DeltaTimestamp: 3, //nolint:mnd + MinTimestamp: 0, + L1InfotreeIndex: 1, + BlockGasLimit: 2100000, //nolint:mnd + L1Blockhash: common.Hash{}.Bytes(), + Hash: common.Hash{}.Bytes(), + StateRoot: common.Hash{}.Bytes(), + GlobalExitRoot: common.Hash{}.Bytes(), + Coinbase: common.Address{}.Bytes(), + BlockInfoRoot: common.Hash{}.Bytes(), + } + l2B, err := proto.Marshal(&l2Block) + if err != nil { + log.Error("error marshalling fake blocka start. Ignoring it....") + } + return l2B } func fakeDataTx() []byte { - dataTx := make([]byte, 0) - dataTx = append(dataTx, 128, 1) //nolint:mnd - dataTx = append(dataTx, - []byte{ - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17, - 10, 11, 12, 13, 14, 15, 16, 17}...) - dataTx = binary.BigEndian.AppendUint32(dataTx, 5) //nolint:mnd - dataTx = append(dataTx, []byte{1, 2, 3, 4, 5}...) + //nolint:lll + encode, err := hex.DecodeString("f918b01b8402549e6083112cd58080b9185c60806040526040518060400160405280600a81526020017f42656e6368546f6b656e00000000000000000000000000000000000000000000815250600090816200004a9190620003dc565b506040518060400160405280600381526020017f42544b000000000000000000000000000000000000000000000000000000000081525060019081620000919190620003dc565b506012600260006101000a81548160ff021916908360ff160217905550348015620000bb57600080fd5b506040516200183c3803806200183c8339818101604052810190620000e19190620004f9565b600260009054906101000a900460ff1660ff16600a620001029190620006ae565b816200010f9190620006ff565b600381905550600354600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550506200074a565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620001e457607f821691505b602082108103620001fa57620001f96200019c565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620002647fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000225565b62000270868362000225565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620002bd620002b7620002b18462000288565b62000292565b62000288565b9050919050565b6000819050919050565b620002d9836200029c565b620002f1620002e882620002c4565b84845462000232565b825550505050565b600090565b62000308620002f9565b62000315818484620002ce565b505050565b5b818110156200033d5762000331600082620002fe565b6001810190506200031b565b5050565b601f8211156200038c57620003568162000200565b620003618462000215565b8101602085101562000371578190505b62000389620003808562000215565b8301826200031a565b50505b505050565b600082821c905092915050565b6000620003b16000198460080262000391565b1980831691505092915050565b6000620003cc83836200039e565b9150826002028217905092915050565b620003e78262000162565b67ffffffffffffffff8111156200040357620004026200016d565b5b6200040f8254620001cb565b6200041c82828562000341565b600060209050601f8311600181146200045457600084156200043f578287015190505b6200044b8582620003be565b865550620004bb565b601f198416620004648662000200565b60005b828110156200048e5784890151825560018201915060208501945060208101905062000467565b86831015620004ae5784890151620004aa601f8916826200039e565b8355505b6001600288020188555050505b505050505050565b600080fd5b620004d38162000288565b8114620004df57600080fd5b50565b600081519050620004f381620004c8565b92915050565b600060208284031215620005125762000511620004c3565b5b60006200052284828501620004e2565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620005b9578086048111156200059157620005906200052b565b5b6001851615620005a15780820291505b8081029050620005b1856200055a565b945062000571565b94509492505050565b600082620005d45760019050620006a7565b81620005e45760009050620006a7565b8160018114620005fd576002811462000608576200063e565b6001915050620006a7565b60ff8411156200061d576200061c6200052b565b5b8360020a9150848211156200063757620006366200052b565b5b50620006a7565b5060208310610133831016604e8410600b8410161715620006785782820a9050838111156200067257620006716200052b565b5b620006a7565b62000687848484600162000567565b92509050818404811115620006a157620006a06200052b565b5b81810290505b9392505050565b6000620006bb8262000288565b9150620006c88362000288565b9250620006f77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484620005c2565b905092915050565b60006200070c8262000288565b9150620007198362000288565b9250828202620007298162000288565b915082820484148315176200074357620007426200052b565b5b5092915050565b6110e2806200075a6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610b67565b60405180910390f35b6100d060048036038101906100cb9190610c22565b61028e565b6040516100dd9190610c7d565b60405180910390f35b6100ee610380565b6040516100fb9190610ca7565b60405180910390f35b61011e60048036038101906101199190610cc2565b61038a565b60405161012b9190610c7d565b60405180910390f35b61013c610759565b6040516101499190610d31565b60405180910390f35b61016c60048036038101906101679190610d4c565b61076c565b6040516101799190610ca7565b60405180910390f35b61018a6107b5565b6040516101979190610b67565b60405180910390f35b6101ba60048036038101906101b59190610c22565b610843565b6040516101c79190610c7d565b60405180910390f35b6101ea60048036038101906101e59190610d79565b610a50565b6040516101f79190610ca7565b60405180910390f35b6000805461020d90610de8565b80601f016020809104026020016040519081016040528092919081815260200182805461023990610de8565b80156102865780601f1061025b57610100808354040283529160200191610286565b820191906000526020600020905b81548152906001019060200180831161026957829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161036e9190610ca7565b60405180910390a36001905092915050565b6000600354905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036103fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f190610e8b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161046090610f1d565b60405180910390fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e290610f89565b60405180910390fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156105aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a190610ff5565b60405180910390fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105f99190611044565b9250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461064f9190611078565b9250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106e29190611044565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107469190610ca7565b60405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600180546107c290610de8565b80601f01602080910402602001604051908101604052809291908181526020018280546107ee90610de8565b801561083b5780601f106108105761010080835404028352916020019161083b565b820191906000526020600020905b81548152906001019060200180831161081e57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036108b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108aa90610f1d565b60405180910390fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610935576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092c90610f89565b60405180910390fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109849190611044565b9250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109da9190611078565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a3e9190610ca7565b60405180910390a36001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610b11578082015181840152602081019050610af6565b60008484015250505050565b6000601f19601f8301169050919050565b6000610b3982610ad7565b610b438185610ae2565b9350610b53818560208601610af3565b610b5c81610b1d565b840191505092915050565b60006020820190508181036000830152610b818184610b2e565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610bb982610b8e565b9050919050565b610bc981610bae565b8114610bd457600080fd5b50565b600081359050610be681610bc0565b92915050565b6000819050919050565b610bff81610bec565b8114610c0a57600080fd5b50565b600081359050610c1c81610bf6565b92915050565b60008060408385031215610c3957610c38610b89565b5b6000610c4785828601610bd7565b9250506020610c5885828601610c0d565b9150509250929050565b60008115159050919050565b610c7781610c62565b82525050565b6000602082019050610c926000830184610c6e565b92915050565b610ca181610bec565b82525050565b6000602082019050610cbc6000830184610c98565b92915050565b600080600060608486031215610cdb57610cda610b89565b5b6000610ce986828701610bd7565b9350506020610cfa86828701610bd7565b9250506040610d0b86828701610c0d565b9150509250925092565b600060ff82169050919050565b610d2b81610d15565b82525050565b6000602082019050610d466000830184610d22565b92915050565b600060208284031215610d6257610d61610b89565b5b6000610d7084828501610bd7565b91505092915050565b60008060408385031215610d9057610d8f610b89565b5b6000610d9e85828601610bd7565b9250506020610daf85828601610bd7565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610e0057607f821691505b602082108103610e1357610e12610db9565b5b50919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000610e75602583610ae2565b9150610e8082610e19565b604082019050919050565b60006020820190508181036000830152610ea481610e68565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000610f07602383610ae2565b9150610f1282610eab565b604082019050919050565b60006020820190508181036000830152610f3681610efa565b9050919050565b7f45524332303a20696e73756666696369656e742062616c616e63650000000000600082015250565b6000610f73601b83610ae2565b9150610f7e82610f3d565b602082019050919050565b60006020820190508181036000830152610fa281610f66565b9050919050565b7f45524332303a20616c6c6f77616e636520657863656564656400000000000000600082015250565b6000610fdf601983610ae2565b9150610fea82610fa9565b602082019050919050565b6000602082019050818103600083015261100e81610fd2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061104f82610bec565b915061105a83610bec565b925082820390508181111561107257611071611015565b5b92915050565b600061108382610bec565b915061108e83610bec565b92508282019050808211156110a6576110a5611015565b5b9291505056fea2646970667358221220c38c26aa42c5f28ade4944774b361159e9cb76b6bb32a68ea063067e2204039764736f6c6343000817003300000000000000000000000000000000000000000000000000000000000001f4821333a0884842f1f22366fa9cf74f95190300e07c430d59e97bc70f304d83d618dde271a070573ea599065296539713b4ffe09bf003466de415cdc7c8307b41726c478fb6") + if err != nil { + log.Error("error encoding tx. Error: ", err) + } + tx := datastream.Transaction{ + L2BlockNumber: 1, + Index: 1, + IsValid: true, + Encoded: encode, + EffectiveGasPricePercentage: 255, //nolint:mnd + ImStateRoot: common.Hash{}.Bytes(), + } + dataTx, err := proto.Marshal(&tx) + if err != nil { + log.Error("error marshalling fake data TX. Ignoring it....") + } return dataTx } func fakeDataBlockEnd(blockNum uint64) []byte { - dataBlockEnd := make([]byte, 0) - dataBlockEnd = binary.BigEndian.AppendUint64(dataBlockEnd, blockNum) - dataBlockEnd = append(dataBlockEnd, []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - }...) - dataBlockEnd = append(dataBlockEnd, []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - }...) - return dataBlockEnd + l2Block := datastream.L2BlockEnd{ + Number: 1, + } + l2B, err := proto.Marshal(&l2Block) + if err != nil { + log.Error("error marshalling fake blockEnd. Ignoring it....") + } + return l2B +} + +func fakeDataBatchStart(BatchNum uint64) []byte { + batchStart := datastream.BatchStart{ + Number: 1, + Type: 1, // Regular batch + ForkId: 11, //nolint:mnd + ChainId: 1337, //nolint:mnd + } + bs, err := proto.Marshal(&batchStart) + if err != nil { + log.Error("error marshalling fake batchStart. Ignoring it....") + } + return bs +} + +func fakeDataBatchEnd(BatchNum uint64) []byte { + batchEnd := datastream.BatchEnd{ + Number: 1, + LocalExitRoot: common.Hash{}.Bytes(), + StateRoot: common.Hash{}.Bytes(), + } + be, err := proto.Marshal(&batchEnd) + if err != nil { + log.Error("error marshalling fake batchEnd. Ignoring it....") + } + return be } // runClient runs a local datastream client and tests its features @@ -448,7 +507,7 @@ func runClient(ctx *cli.Context) error { if bookmarkType < 0 || bookmarkType > 255 { return errors.New("bad bookmarktype parameter, must be between 0 and 255") } - bookType := byte(bookmarkType) + bookType := datastream.BookmarkType(bookmarkType) paramDumpBatch := ctx.String("dumpbatch") // Create client @@ -517,8 +576,15 @@ func runClient(ctx *cli.Context) error { if err != nil { return err } - qBook := []byte{bookType} - entry, err := c.ExecCommandGetBookmark(binary.BigEndian.AppendUint64(qBook, uint64(qBookmark))) + bookmark := datastream.BookMark{ + Type: bookType, + Value: uint64(qBookmark), + } + qBook, err := proto.Marshal(&bookmark) + if err != nil { + log.Error("error marshalling fake bookmark. Ignoring it....") + } + entry, err := c.ExecCommandGetBookmark(qBook) if err != nil { log.Infof("Error: %v", err) } else { @@ -540,8 +606,15 @@ func runClient(ctx *cli.Context) error { if err != nil { return err } - bookmark := []byte{bookType} - err = c.ExecCommandStartBookmark(binary.BigEndian.AppendUint64(bookmark, uint64(fromBookNum))) + bookmark := datastream.BookMark{ + Type: bookType, + Value: uint64(fromBookNum), + } + qBook, err := proto.Marshal(&bookmark) + if err != nil { + log.Error("error marshalling fake bookmark. Ignoring it....") + } + err = c.ExecCommandStartBookmark(qBook) if err != nil { return err } @@ -622,16 +695,74 @@ func checkEntryBlockSanity( } sanityEntry++ - // Sanity check for block sequence - if e.Type == EtL2BlockStart { - blockNum := binary.BigEndian.Uint64(e.Data[8:16]) + switch e.Type { + case datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_START): + log.Debug("BATCH_START") + batch := &datastream.BatchStart{} + err := proto.Unmarshal(e.Data, batch) + if err != nil { + log.Error("error decoding batchStart. Error: ", err) + return err + } + batchNum := batch.Number + //Check previous End batch + if sanityBatchEnd != batchNum { + log.Warnf(`(X) SANITY CHECK failed (%d): BatchStart but the previous one is not closed yet? + lastBatchEnded[%d] Received[%d] | BatchStart expected[%d]`, + e.Number, sanityBatchEnd-1, batchNum, sanityBatch) + } + // Check forkID + if sanityForkID > batch.ForkId { + log.Warnf("(X) SANITY CHECK failed (%d): Wrong ForkID for batch %d. ForkID received[%d] | ForkID expected[%d]", + e.Number, batchNum, batch.ForkId, sanityForkID) + } + // Check batch number + if sanityBatch > 0 { + if batchNum != sanityBatch { + if batchNum < sanityBatch { + log.Warnf("(X) SANITY CHECK failed (%d): REPEATED batch? Received[%d] | Batch expected[%d]", + e.Number, batchNum, sanityBatch) + } else { + log.Warnf("(X) SANITY CHECK failed (%d): GAP batch? Received[%d] | Batch expected[%d]", + e.Number, batchNum, sanityBatch) + } + sanityBatch = batchNum + } + } else { + if batchNum != 0 { + if initSanityBatch { + log.Warnf("(X) SANITY CHECK failed (%d): Batch received[%d] | Batch expected[0]", e.Number, batchNum) + sanityBatch = 0 + } else { + log.Infof("SANITY CHECK note (%d): First Batch received[%d]", e.Number, batchNum) + sanityBatch = batchNum + } + initSanityBatch = true + } + } + sanityBatch++ + case datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK): + log.Debug("L2_BLOCK") + l2Block := &datastream.L2Block{} + err := proto.Unmarshal(e.Data, l2Block) + if err != nil { + log.Error("error decoding l2 block. Error: ", err) + return err + } + blockNum := l2Block.Number + //Check previous End Block + if sanityBlockEnd != blockNum { + log.Warnf(`(X) SANITY CHECK failed (%d): BlockStart but the previous one is not closed yet? + lastBlockEnded[%d] Received[%d] | BlockStart expected[%d]`, + e.Number, sanityBlockEnd-1, blockNum, sanityBlock) + } if sanityBlock > 0 { if blockNum != sanityBlock { if blockNum < sanityBlock { - log.Infof("(X) SANITY CHECK failed (%d): REPEATED blocks? Received[%d] | Block expected[%d]", + log.Warnf("(X) SANITY CHECK failed (%d): REPEATED blocks? Received[%d] | Block expected[%d]", e.Number, blockNum, sanityBlock) } else { - log.Infof("(X) SANITY CHECK failed (%d): GAP blocks? Received[%d] | Block expected[%d]", + log.Warnf("(X) SANITY CHECK failed (%d): GAP blocks? Received[%d] | Block expected[%d]", e.Number, blockNum, sanityBlock) } sanityBlock = blockNum @@ -639,7 +770,7 @@ func checkEntryBlockSanity( } else { if blockNum != 0 { if initSanityBlock { - log.Infof("(X) SANITY CHECK failed (%d): Block received[%d] | Block expected[0]", e.Number, blockNum) + log.Warnf("(X) SANITY CHECK failed (%d): Block received[%d] | Block expected[0]", e.Number, blockNum) sanityBlock = 0 } else { log.Infof("SANITY CHECK note (%d): First Block received[%d]", e.Number, blockNum) @@ -649,75 +780,177 @@ func checkEntryBlockSanity( } } sanityBlock++ - } - - // Sanity check for bookmarks - if e.Type == datastreamer.EtBookmark { - bookmarkType := e.Data[0] - bookmarkNum := binary.BigEndian.Uint64(e.Data[1:9]) + case datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_TRANSACTION): + log.Debug("TRANSACTION") + dsTx := &datastream.Transaction{} + err := proto.Unmarshal(e.Data, dsTx) + if err != nil { + log.Error("error decoding transaction. Error: ", err) + return err + } + // If tx is well decoded is OK + case datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_END): + log.Debug("BATCH_END") + batch := &datastream.BatchEnd{} + err := proto.Unmarshal(e.Data, batch) + if err != nil { + log.Error("error decoding batchEnd. Error: ", err) + return err + } + batchNum := batch.Number + //Check Open batch + if sanityBatch-1 != sanityBatchEnd { + log.Warnf(`(X) SANITY CHECK failed (%d): BatchEnd but not closed? + lastBatchOpened[%d] Received[%d] | BatchEnd expected[%d]`, + e.Number, sanityBatch-1, batchNum, sanityBatchEnd) + } + // Check batch number + if sanityBatchEnd > 0 { + if batchNum != sanityBatchEnd { + if batchNum < sanityBatchEnd { + log.Warnf("(X) SANITY CHECK failed (%d): REPEATED batchEnd? Received[%d] | BatchEnd expected[%d]", + e.Number, batchNum, sanityBatchEnd) + } else { + log.Warnf("(X) SANITY CHECK failed (%d): GAP batchEnd? Received[%d] | BatchEnd expected[%d]", + e.Number, batchNum, sanityBatchEnd) + } + sanityBatchEnd = batchNum + } + } else { + if batchNum != 0 { + if initSanityBatchEnd { + log.Warnf("(X) SANITY CHECK failed (%d): BatchEnd received[%d] | BatchEnd expected[0]", e.Number, batchNum) + sanityBatchEnd = 0 + } else { + log.Infof("SANITY CHECK note (%d): First BatchEnd received[%d]", e.Number, batchNum) + sanityBatchEnd = batchNum + } + initSanityBatchEnd = true + } + } + sanityBatchEnd++ + case datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_UPDATE_GER): + log.Debug("UPDATE_GER") + updateGer := &datastream.UpdateGER{} + err := proto.Unmarshal(e.Data, updateGer) + if err != nil { + log.Error("error decoding updateGER. Error: ", err) + return err + } + // If GER is well decoded is OK + case datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK_END): + log.Debug("L2_BLOCK_END") + l2BlockEnd := &datastream.L2BlockEnd{} + err := proto.Unmarshal(e.Data, l2BlockEnd) + if err != nil { + log.Error("error decoding l2BlockEnd. Error: ", err) + return err + } + blockNum := l2BlockEnd.Number + //Check Open l2 block + if sanityBlock-1 != sanityBlockEnd { + log.Warnf(`(X) SANITY CHECK failed (%d): BlockEnd but not closed? + lastBlockOpened[%d] Received[%d] | BlockEnd expected[%d]`, + e.Number, sanityBlock-1, blockNum, sanityBlockEnd) + } + // Check l2 block end number + if sanityBlockEnd > 0 { + if blockNum != sanityBlockEnd { + if blockNum < sanityBlockEnd { + log.Warnf("(X) SANITY CHECK failed (%d): REPEATED blocks end? Received[%d] | Block expected[%d]", + e.Number, blockNum, sanityBlockEnd) + } else { + log.Warnf("(X) SANITY CHECK failed (%d): GAP blocks end? Received[%d] | Block expected[%d]", + e.Number, blockNum, sanityBlockEnd) + } + sanityBlockEnd = blockNum + } + } else { + if blockNum != 0 { + if initSanityBlockEnd { + log.Warnf("(X) SANITY CHECK failed (%d): Block end received[%d] | Block expected[0]", e.Number, blockNum) + sanityBlockEnd = 0 + } else { + log.Infof("SANITY CHECK note (%d): First Block end received[%d]", e.Number, blockNum) + sanityBlockEnd = blockNum + } + initSanityBlockEnd = true + } + } + sanityBlockEnd++ + case datastreamer.EtBookmark: // Sanity check for bookmarks + bookmark := &datastream.BookMark{} + err := proto.Unmarshal(e.Data, bookmark) + if err != nil { + log.Error("error decoding bookmark. Error: ", err) + return err + } + bookmarkNum := bookmark.Value - switch bookmarkType { - case BookmarkL2Block: - if sanityBookmark0 > 0 { - if bookmarkNum != sanityBookmark0 { - if bookmarkNum < sanityBookmark0 { - log.Infof("(X) SANITY CHECK failed (%d): REPEATED L2block bookmarks? Received[%d] | Bookmark expected[%d]", - e.Number, bookmarkNum, sanityBookmark0) + switch bookmark.Type { + case BookmarkBatch: + log.Debug("BookmarkBatch") + if sanityBookmarkBatch > 0 { + if bookmarkNum != sanityBookmarkBatch { + if bookmarkNum < sanityBookmarkBatch { + log.Warnf("(X) SANITY CHECK failed (%d): REPEATED Batch bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmarkBatch) } else { - log.Infof("(X) SANITY CHECK failed (%d): GAP L2block bookmarks? Received[%d] | Bookmark expected[%d]", - e.Number, bookmarkNum, sanityBookmark0) + log.Warnf("(X) SANITY CHECK failed (%d): GAP Batch bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmarkBatch) } - sanityBookmark0 = bookmarkNum + sanityBookmarkBatch = bookmarkNum } } else { if bookmarkNum != 0 { if initSanityBookmark { - log.Infof("(X) SANITY CHECK failed (%d): L2block Bookmark received[%d] | Bookmark expected[0]", + log.Warnf("(X) SANITY CHECK failed (%d): Batch Bookmark received[%d] | Bookmark expected[0]", e.Number, bookmarkNum) - sanityBookmark0 = 0 + sanityBookmarkBatch = 0 } else { - log.Infof("SANITY CHECK note (%d): First L2block Bookmark received[%d]", e.Number, bookmarkNum) - sanityBookmark0 = bookmarkNum + log.Infof("SANITY CHECK note (%d): First Batch Bookmark received[%d]", e.Number, bookmarkNum) + sanityBookmarkBatch = bookmarkNum } initSanityBookmark = true } } - sanityBookmark0++ - - case BookmarkBatch: - if sanityBookmark1 > 0 { - if bookmarkNum != sanityBookmark1 { - if bookmarkNum < sanityBookmark1 { - log.Infof("(X) SANITY CHECK failed (%d): REPEATED Batch bookmarks? Received[%d] | Bookmark expected[%d]", - e.Number, bookmarkNum, sanityBookmark1) + sanityBookmarkBatch++ + case BookmarkL2Block: + log.Debug("BookmarkL2Block") + if sanityBookmarkL2Block > 0 { + if bookmarkNum != sanityBookmarkL2Block { + if bookmarkNum < sanityBookmarkL2Block { + log.Warnf("(X) SANITY CHECK failed (%d): REPEATED L2block bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmarkL2Block) } else { - log.Infof("(X) SANITY CHECK failed (%d): GAP Batch bookmarks? Received[%d] | Bookmark expected[%d]", - e.Number, bookmarkNum, sanityBookmark1) + log.Warnf("(X) SANITY CHECK failed (%d): GAP L2block bookmarks? Received[%d] | Bookmark expected[%d]", + e.Number, bookmarkNum, sanityBookmarkL2Block) } - sanityBookmark1 = bookmarkNum + sanityBookmarkL2Block = bookmarkNum } } else { if bookmarkNum != 0 { if initSanityBookmark { - log.Infof("(X) SANITY CHECK failed (%d): Batch Bookmark received[%d] | Bookmark expected[0]", + log.Warnf("(X) SANITY CHECK failed (%d): L2block Bookmark received[%d] | Bookmark expected[0]", e.Number, bookmarkNum) - sanityBookmark1 = 0 + sanityBookmarkL2Block = 0 } else { - log.Infof("SANITY CHECK note (%d): First Batch Bookmark received[%d]", e.Number, bookmarkNum) - sanityBookmark1 = bookmarkNum + log.Infof("SANITY CHECK note (%d): First L2block Bookmark received[%d]", e.Number, bookmarkNum) + sanityBookmarkL2Block = bookmarkNum } initSanityBookmark = true } } - sanityBookmark1++ + sanityBookmarkL2Block++ } } // Sanity check end condition if e.Number+1 >= c.GetTotalEntries() { - log.Infof("SANITY CHECK finished! From entry [%d] to entry [%d]. Latest L2block[%d], Bookmark0[%d], Bookmark1[%d]", - c.GetFromStream(), c.GetTotalEntries()-1, sanityBlock-1, sanityBookmark0-1, sanityBookmark1-1) - return errors.New("sanity check finished") + log.Infof(`SANITY CHECK finished! From entry [%d] to entry [%d]. + Latest L2block[%d], sanityBookmarkL2Block[%d], sanityBookmarkBatch[%d]`, + c.GetFromStream(), c.GetTotalEntries()-1, sanityBlock-1, sanityBookmarkL2Block-1, sanityBookmarkBatch-1) + os.Exit(0) } return nil @@ -735,13 +968,21 @@ func doDumpBatchData(e *datastreamer.FileEntry, c *datastreamer.StreamClient, s Data string `json:"batchData"` } - if e.Type != EtL2BlockStart && e.Type != EtL2Tx && e.Type != EtL2BlockEnd { + if e.Type != datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK) && + e.Type != datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_TRANSACTION) && + e.Type != datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK_END) { return nil } // L2 block start - if e.Type == EtL2BlockStart { - batchNumber := binary.BigEndian.Uint64(e.Data[0:8]) + if e.Type == datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK) { + l2Block := &datastream.L2Block{} + err := proto.Unmarshal(e.Data, l2Block) + if err != nil { + log.Error("error decoding l2 block. Error: ", err) + return err + } + batchNumber := l2Block.BatchNumber switch { case batchNumber < dumpBatchNumber: return nil @@ -773,18 +1014,18 @@ func doDumpBatchData(e *datastreamer.FileEntry, c *datastreamer.StreamClient, s return errors.New("writing dump file") } - return errors.New("dump batch finished") + os.Exit(0) case batchNumber == dumpBatchNumber: initDumpBatch = true - blockNum := binary.BigEndian.Uint64(e.Data[8:16]) + blockNum := l2Block.Number if dumpBlockFirst == 0 { dumpBlockFirst = blockNum } dumpBlockLast = blockNum } - } else if e.Type == EtL2Tx && initDumpBatch { + } else if e.Type == datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_TRANSACTION) && initDumpBatch { dumpTotalTx++ } diff --git a/datastream/datastream.pb.go b/datastream/datastream.pb.go new file mode 100644 index 0000000..52bd86e --- /dev/null +++ b/datastream/datastream.pb.go @@ -0,0 +1,1136 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v3.12.4 +// source: datastream.proto + +package datastream + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type BookmarkType int32 + +const ( + BookmarkType_BOOKMARK_TYPE_UNSPECIFIED BookmarkType = 0 + BookmarkType_BOOKMARK_TYPE_BATCH BookmarkType = 1 + BookmarkType_BOOKMARK_TYPE_L2_BLOCK BookmarkType = 2 +) + +// Enum value maps for BookmarkType. +var ( + BookmarkType_name = map[int32]string{ + 0: "BOOKMARK_TYPE_UNSPECIFIED", + 1: "BOOKMARK_TYPE_BATCH", + 2: "BOOKMARK_TYPE_L2_BLOCK", + } + BookmarkType_value = map[string]int32{ + "BOOKMARK_TYPE_UNSPECIFIED": 0, + "BOOKMARK_TYPE_BATCH": 1, + "BOOKMARK_TYPE_L2_BLOCK": 2, + } +) + +func (x BookmarkType) Enum() *BookmarkType { + p := new(BookmarkType) + *p = x + return p +} + +func (x BookmarkType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BookmarkType) Descriptor() protoreflect.EnumDescriptor { + return file_datastream_proto_enumTypes[0].Descriptor() +} + +func (BookmarkType) Type() protoreflect.EnumType { + return &file_datastream_proto_enumTypes[0] +} + +func (x BookmarkType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BookmarkType.Descriptor instead. +func (BookmarkType) EnumDescriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{0} +} + +type EntryType int32 + +const ( + EntryType_ENTRY_TYPE_UNSPECIFIED EntryType = 0 + EntryType_ENTRY_TYPE_BATCH_START EntryType = 1 + EntryType_ENTRY_TYPE_L2_BLOCK EntryType = 2 + EntryType_ENTRY_TYPE_TRANSACTION EntryType = 3 + EntryType_ENTRY_TYPE_BATCH_END EntryType = 4 + EntryType_ENTRY_TYPE_UPDATE_GER EntryType = 5 + EntryType_ENTRY_TYPE_L2_BLOCK_END EntryType = 6 +) + +// Enum value maps for EntryType. +var ( + EntryType_name = map[int32]string{ + 0: "ENTRY_TYPE_UNSPECIFIED", + 1: "ENTRY_TYPE_BATCH_START", + 2: "ENTRY_TYPE_L2_BLOCK", + 3: "ENTRY_TYPE_TRANSACTION", + 4: "ENTRY_TYPE_BATCH_END", + 5: "ENTRY_TYPE_UPDATE_GER", + 6: "ENTRY_TYPE_L2_BLOCK_END", + } + EntryType_value = map[string]int32{ + "ENTRY_TYPE_UNSPECIFIED": 0, + "ENTRY_TYPE_BATCH_START": 1, + "ENTRY_TYPE_L2_BLOCK": 2, + "ENTRY_TYPE_TRANSACTION": 3, + "ENTRY_TYPE_BATCH_END": 4, + "ENTRY_TYPE_UPDATE_GER": 5, + "ENTRY_TYPE_L2_BLOCK_END": 6, + } +) + +func (x EntryType) Enum() *EntryType { + p := new(EntryType) + *p = x + return p +} + +func (x EntryType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EntryType) Descriptor() protoreflect.EnumDescriptor { + return file_datastream_proto_enumTypes[1].Descriptor() +} + +func (EntryType) Type() protoreflect.EnumType { + return &file_datastream_proto_enumTypes[1] +} + +func (x EntryType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EntryType.Descriptor instead. +func (EntryType) EnumDescriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{1} +} + +type BatchType int32 + +const ( + BatchType_BATCH_TYPE_UNSPECIFIED BatchType = 0 + BatchType_BATCH_TYPE_REGULAR BatchType = 1 + BatchType_BATCH_TYPE_FORCED BatchType = 2 + BatchType_BATCH_TYPE_INJECTED BatchType = 3 + BatchType_BATCH_TYPE_INVALID BatchType = 4 +) + +// Enum value maps for BatchType. +var ( + BatchType_name = map[int32]string{ + 0: "BATCH_TYPE_UNSPECIFIED", + 1: "BATCH_TYPE_REGULAR", + 2: "BATCH_TYPE_FORCED", + 3: "BATCH_TYPE_INJECTED", + 4: "BATCH_TYPE_INVALID", + } + BatchType_value = map[string]int32{ + "BATCH_TYPE_UNSPECIFIED": 0, + "BATCH_TYPE_REGULAR": 1, + "BATCH_TYPE_FORCED": 2, + "BATCH_TYPE_INJECTED": 3, + "BATCH_TYPE_INVALID": 4, + } +) + +func (x BatchType) Enum() *BatchType { + p := new(BatchType) + *p = x + return p +} + +func (x BatchType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BatchType) Descriptor() protoreflect.EnumDescriptor { + return file_datastream_proto_enumTypes[2].Descriptor() +} + +func (BatchType) Type() protoreflect.EnumType { + return &file_datastream_proto_enumTypes[2] +} + +func (x BatchType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BatchType.Descriptor instead. +func (BatchType) EnumDescriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{2} +} + +type BatchStart struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + Type BatchType `protobuf:"varint,2,opt,name=type,proto3,enum=datastream.v1.BatchType" json:"type,omitempty"` + ForkId uint64 `protobuf:"varint,3,opt,name=fork_id,json=forkId,proto3" json:"fork_id,omitempty"` + ChainId uint64 `protobuf:"varint,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Debug *Debug `protobuf:"bytes,5,opt,name=debug,proto3" json:"debug,omitempty"` +} + +func (x *BatchStart) Reset() { + *x = BatchStart{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BatchStart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchStart) ProtoMessage() {} + +func (x *BatchStart) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchStart.ProtoReflect.Descriptor instead. +func (*BatchStart) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{0} +} + +func (x *BatchStart) GetNumber() uint64 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *BatchStart) GetType() BatchType { + if x != nil { + return x.Type + } + return BatchType_BATCH_TYPE_UNSPECIFIED +} + +func (x *BatchStart) GetForkId() uint64 { + if x != nil { + return x.ForkId + } + return 0 +} + +func (x *BatchStart) GetChainId() uint64 { + if x != nil { + return x.ChainId + } + return 0 +} + +func (x *BatchStart) GetDebug() *Debug { + if x != nil { + return x.Debug + } + return nil +} + +type BatchEnd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + LocalExitRoot []byte `protobuf:"bytes,2,opt,name=local_exit_root,json=localExitRoot,proto3" json:"local_exit_root,omitempty"` + StateRoot []byte `protobuf:"bytes,3,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` + Debug *Debug `protobuf:"bytes,4,opt,name=debug,proto3" json:"debug,omitempty"` +} + +func (x *BatchEnd) Reset() { + *x = BatchEnd{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BatchEnd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchEnd) ProtoMessage() {} + +func (x *BatchEnd) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchEnd.ProtoReflect.Descriptor instead. +func (*BatchEnd) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{1} +} + +func (x *BatchEnd) GetNumber() uint64 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *BatchEnd) GetLocalExitRoot() []byte { + if x != nil { + return x.LocalExitRoot + } + return nil +} + +func (x *BatchEnd) GetStateRoot() []byte { + if x != nil { + return x.StateRoot + } + return nil +} + +func (x *BatchEnd) GetDebug() *Debug { + if x != nil { + return x.Debug + } + return nil +} + +type L2Block struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` + BatchNumber uint64 `protobuf:"varint,2,opt,name=batch_number,json=batchNumber,proto3" json:"batch_number,omitempty"` + Timestamp uint64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + DeltaTimestamp uint32 `protobuf:"varint,4,opt,name=delta_timestamp,json=deltaTimestamp,proto3" json:"delta_timestamp,omitempty"` + MinTimestamp uint64 `protobuf:"varint,5,opt,name=min_timestamp,json=minTimestamp,proto3" json:"min_timestamp,omitempty"` + L1Blockhash []byte `protobuf:"bytes,6,opt,name=l1_blockhash,json=l1Blockhash,proto3" json:"l1_blockhash,omitempty"` + L1InfotreeIndex uint32 `protobuf:"varint,7,opt,name=l1_infotree_index,json=l1InfotreeIndex,proto3" json:"l1_infotree_index,omitempty"` + Hash []byte `protobuf:"bytes,8,opt,name=hash,proto3" json:"hash,omitempty"` + StateRoot []byte `protobuf:"bytes,9,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` + GlobalExitRoot []byte `protobuf:"bytes,10,opt,name=global_exit_root,json=globalExitRoot,proto3" json:"global_exit_root,omitempty"` + Coinbase []byte `protobuf:"bytes,11,opt,name=coinbase,proto3" json:"coinbase,omitempty"` + BlockGasLimit uint64 `protobuf:"varint,12,opt,name=block_gas_limit,json=blockGasLimit,proto3" json:"block_gas_limit,omitempty"` + BlockInfoRoot []byte `protobuf:"bytes,13,opt,name=block_info_root,json=blockInfoRoot,proto3" json:"block_info_root,omitempty"` + Debug *Debug `protobuf:"bytes,14,opt,name=debug,proto3" json:"debug,omitempty"` +} + +func (x *L2Block) Reset() { + *x = L2Block{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *L2Block) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*L2Block) ProtoMessage() {} + +func (x *L2Block) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use L2Block.ProtoReflect.Descriptor instead. +func (*L2Block) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{2} +} + +func (x *L2Block) GetNumber() uint64 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *L2Block) GetBatchNumber() uint64 { + if x != nil { + return x.BatchNumber + } + return 0 +} + +func (x *L2Block) GetTimestamp() uint64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *L2Block) GetDeltaTimestamp() uint32 { + if x != nil { + return x.DeltaTimestamp + } + return 0 +} + +func (x *L2Block) GetMinTimestamp() uint64 { + if x != nil { + return x.MinTimestamp + } + return 0 +} + +func (x *L2Block) GetL1Blockhash() []byte { + if x != nil { + return x.L1Blockhash + } + return nil +} + +func (x *L2Block) GetL1InfotreeIndex() uint32 { + if x != nil { + return x.L1InfotreeIndex + } + return 0 +} + +func (x *L2Block) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +func (x *L2Block) GetStateRoot() []byte { + if x != nil { + return x.StateRoot + } + return nil +} + +func (x *L2Block) GetGlobalExitRoot() []byte { + if x != nil { + return x.GlobalExitRoot + } + return nil +} + +func (x *L2Block) GetCoinbase() []byte { + if x != nil { + return x.Coinbase + } + return nil +} + +func (x *L2Block) GetBlockGasLimit() uint64 { + if x != nil { + return x.BlockGasLimit + } + return 0 +} + +func (x *L2Block) GetBlockInfoRoot() []byte { + if x != nil { + return x.BlockInfoRoot + } + return nil +} + +func (x *L2Block) GetDebug() *Debug { + if x != nil { + return x.Debug + } + return nil +} + +type L2BlockEnd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number uint64 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"` +} + +func (x *L2BlockEnd) Reset() { + *x = L2BlockEnd{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *L2BlockEnd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*L2BlockEnd) ProtoMessage() {} + +func (x *L2BlockEnd) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use L2BlockEnd.ProtoReflect.Descriptor instead. +func (*L2BlockEnd) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{3} +} + +func (x *L2BlockEnd) GetNumber() uint64 { + if x != nil { + return x.Number + } + return 0 +} + +type Transaction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + L2BlockNumber uint64 `protobuf:"varint,1,opt,name=l2block_number,json=l2blockNumber,proto3" json:"l2block_number,omitempty"` + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + IsValid bool `protobuf:"varint,3,opt,name=is_valid,json=isValid,proto3" json:"is_valid,omitempty"` + Encoded []byte `protobuf:"bytes,4,opt,name=encoded,proto3" json:"encoded,omitempty"` + EffectiveGasPricePercentage uint32 `protobuf:"varint,5,opt,name=effective_gas_price_percentage,json=effectiveGasPricePercentage,proto3" json:"effective_gas_price_percentage,omitempty"` + ImStateRoot []byte `protobuf:"bytes,6,opt,name=im_state_root,json=imStateRoot,proto3" json:"im_state_root,omitempty"` + Debug *Debug `protobuf:"bytes,7,opt,name=debug,proto3" json:"debug,omitempty"` +} + +func (x *Transaction) Reset() { + *x = Transaction{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Transaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Transaction) ProtoMessage() {} + +func (x *Transaction) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. +func (*Transaction) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{4} +} + +func (x *Transaction) GetL2BlockNumber() uint64 { + if x != nil { + return x.L2BlockNumber + } + return 0 +} + +func (x *Transaction) GetIndex() uint64 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *Transaction) GetIsValid() bool { + if x != nil { + return x.IsValid + } + return false +} + +func (x *Transaction) GetEncoded() []byte { + if x != nil { + return x.Encoded + } + return nil +} + +func (x *Transaction) GetEffectiveGasPricePercentage() uint32 { + if x != nil { + return x.EffectiveGasPricePercentage + } + return 0 +} + +func (x *Transaction) GetImStateRoot() []byte { + if x != nil { + return x.ImStateRoot + } + return nil +} + +func (x *Transaction) GetDebug() *Debug { + if x != nil { + return x.Debug + } + return nil +} + +type UpdateGER struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BatchNumber uint64 `protobuf:"varint,1,opt,name=batch_number,json=batchNumber,proto3" json:"batch_number,omitempty"` + Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + GlobalExitRoot []byte `protobuf:"bytes,3,opt,name=global_exit_root,json=globalExitRoot,proto3" json:"global_exit_root,omitempty"` + Coinbase []byte `protobuf:"bytes,4,opt,name=coinbase,proto3" json:"coinbase,omitempty"` + ForkId uint64 `protobuf:"varint,5,opt,name=fork_id,json=forkId,proto3" json:"fork_id,omitempty"` + ChainId uint64 `protobuf:"varint,6,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + StateRoot []byte `protobuf:"bytes,7,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` + Debug *Debug `protobuf:"bytes,8,opt,name=debug,proto3" json:"debug,omitempty"` +} + +func (x *UpdateGER) Reset() { + *x = UpdateGER{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateGER) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateGER) ProtoMessage() {} + +func (x *UpdateGER) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateGER.ProtoReflect.Descriptor instead. +func (*UpdateGER) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateGER) GetBatchNumber() uint64 { + if x != nil { + return x.BatchNumber + } + return 0 +} + +func (x *UpdateGER) GetTimestamp() uint64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *UpdateGER) GetGlobalExitRoot() []byte { + if x != nil { + return x.GlobalExitRoot + } + return nil +} + +func (x *UpdateGER) GetCoinbase() []byte { + if x != nil { + return x.Coinbase + } + return nil +} + +func (x *UpdateGER) GetForkId() uint64 { + if x != nil { + return x.ForkId + } + return 0 +} + +func (x *UpdateGER) GetChainId() uint64 { + if x != nil { + return x.ChainId + } + return 0 +} + +func (x *UpdateGER) GetStateRoot() []byte { + if x != nil { + return x.StateRoot + } + return nil +} + +func (x *UpdateGER) GetDebug() *Debug { + if x != nil { + return x.Debug + } + return nil +} + +type BookMark struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type BookmarkType `protobuf:"varint,1,opt,name=type,proto3,enum=datastream.v1.BookmarkType" json:"type,omitempty"` + Value uint64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *BookMark) Reset() { + *x = BookMark{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BookMark) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BookMark) ProtoMessage() {} + +func (x *BookMark) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BookMark.ProtoReflect.Descriptor instead. +func (*BookMark) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{6} +} + +func (x *BookMark) GetType() BookmarkType { + if x != nil { + return x.Type + } + return BookmarkType_BOOKMARK_TYPE_UNSPECIFIED +} + +func (x *BookMark) GetValue() uint64 { + if x != nil { + return x.Value + } + return 0 +} + +type Debug struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *Debug) Reset() { + *x = Debug{} + if protoimpl.UnsafeEnabled { + mi := &file_datastream_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Debug) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Debug) ProtoMessage() {} + +func (x *Debug) ProtoReflect() protoreflect.Message { + mi := &file_datastream_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Debug.ProtoReflect.Descriptor instead. +func (*Debug) Descriptor() ([]byte, []int) { + return file_datastream_proto_rawDescGZIP(), []int{7} +} + +func (x *Debug) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_datastream_proto protoreflect.FileDescriptor + +var file_datastream_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0d, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, + 0x31, 0x22, 0xb2, 0x01, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x6b, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6b, 0x49, 0x64, 0x12, + 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x05, 0x64, 0x65, + 0x62, 0x75, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x61, 0x74, 0x61, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, + 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x95, 0x01, 0x0a, 0x08, 0x42, 0x61, 0x74, 0x63, 0x68, + 0x45, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0f, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x45, 0x78, 0x69, 0x74, 0x52, + 0x6f, 0x6f, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x6f, + 0x6f, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, + 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0xf4, + 0x03, 0x0a, 0x07, 0x4c, 0x32, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x64, 0x65, + 0x6c, 0x74, 0x61, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x23, 0x0a, 0x0d, + 0x6d, 0x69, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0c, 0x6d, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x31, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6c, 0x31, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x68, 0x61, 0x73, 0x68, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x31, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0f, 0x6c, 0x31, 0x49, 0x6e, 0x66, 0x6f, 0x74, 0x72, 0x65, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x68, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, + 0x6f, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, + 0x6f, 0x6f, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x65, 0x78, + 0x69, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, + 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x45, 0x78, 0x69, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x1a, 0x0a, + 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x08, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x5f, 0x67, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0d, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x47, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, + 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x5f, + 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x64, 0x65, 0x62, + 0x75, 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, 0x05, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x24, 0x0a, 0x0a, 0x4c, 0x32, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x45, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x94, 0x02, 0x0a, 0x0b, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x6c, + 0x32, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0d, 0x6c, 0x32, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x12, 0x43, 0x0a, + 0x1e, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x67, 0x61, 0x73, 0x5f, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x1b, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, + 0x67, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x6d, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, + 0x6f, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x6d, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, 0x05, 0x64, 0x65, 0x62, + 0x75, 0x67, 0x22, 0x91, 0x02, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x45, 0x52, + 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x12, 0x28, 0x0a, 0x10, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x69, 0x74, + 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x45, 0x78, 0x69, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, + 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, + 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x6b, 0x5f, + 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6b, 0x49, 0x64, + 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x09, 0x73, 0x74, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x2a, 0x0a, 0x05, 0x64, 0x65, + 0x62, 0x75, 0x67, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x61, 0x74, 0x61, + 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x52, + 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x22, 0x51, 0x0a, 0x08, 0x42, 0x6f, 0x6f, 0x6b, 0x4d, 0x61, + 0x72, 0x6b, 0x12, 0x2f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x1b, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x76, 0x31, + 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x21, 0x0a, 0x05, 0x44, 0x65, 0x62, + 0x75, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x62, 0x0a, 0x0c, + 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, + 0x42, 0x4f, 0x4f, 0x4b, 0x4d, 0x41, 0x52, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x42, + 0x4f, 0x4f, 0x4b, 0x4d, 0x41, 0x52, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x41, 0x54, + 0x43, 0x48, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x42, 0x4f, 0x4f, 0x4b, 0x4d, 0x41, 0x52, 0x4b, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, 0x32, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x02, + 0x2a, 0xca, 0x01, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, + 0x0a, 0x16, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x4e, + 0x54, 0x52, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x53, + 0x54, 0x41, 0x52, 0x54, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, 0x32, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x02, 0x12, + 0x1a, 0x0a, 0x16, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, + 0x41, 0x4e, 0x53, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x45, + 0x4e, 0x54, 0x52, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, 0x5f, + 0x45, 0x4e, 0x44, 0x10, 0x04, 0x12, 0x19, 0x0a, 0x15, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x5f, 0x47, 0x45, 0x52, 0x10, 0x05, + 0x12, 0x1b, 0x0a, 0x17, 0x45, 0x4e, 0x54, 0x52, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4c, + 0x32, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0x06, 0x2a, 0x87, 0x01, + 0x0a, 0x09, 0x42, 0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x42, + 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x42, 0x41, 0x54, 0x43, 0x48, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x01, 0x12, + 0x15, 0x0a, 0x11, 0x42, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4f, + 0x52, 0x43, 0x45, 0x44, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x42, 0x41, 0x54, 0x43, 0x48, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, + 0x16, 0x0a, 0x12, 0x42, 0x41, 0x54, 0x43, 0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, + 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x04, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x30, 0x78, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x48, + 0x65, 0x72, 0x6d, 0x65, 0x7a, 0x2f, 0x7a, 0x6b, 0x65, 0x76, 0x6d, 0x2d, 0x6e, 0x6f, 0x64, 0x65, + 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_datastream_proto_rawDescOnce sync.Once + file_datastream_proto_rawDescData = file_datastream_proto_rawDesc +) + +func file_datastream_proto_rawDescGZIP() []byte { + file_datastream_proto_rawDescOnce.Do(func() { + file_datastream_proto_rawDescData = protoimpl.X.CompressGZIP(file_datastream_proto_rawDescData) + }) + return file_datastream_proto_rawDescData +} + +var file_datastream_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_datastream_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_datastream_proto_goTypes = []interface{}{ + (BookmarkType)(0), // 0: datastream.v1.BookmarkType + (EntryType)(0), // 1: datastream.v1.EntryType + (BatchType)(0), // 2: datastream.v1.BatchType + (*BatchStart)(nil), // 3: datastream.v1.BatchStart + (*BatchEnd)(nil), // 4: datastream.v1.BatchEnd + (*L2Block)(nil), // 5: datastream.v1.L2Block + (*L2BlockEnd)(nil), // 6: datastream.v1.L2BlockEnd + (*Transaction)(nil), // 7: datastream.v1.Transaction + (*UpdateGER)(nil), // 8: datastream.v1.UpdateGER + (*BookMark)(nil), // 9: datastream.v1.BookMark + (*Debug)(nil), // 10: datastream.v1.Debug +} +var file_datastream_proto_depIdxs = []int32{ + 2, // 0: datastream.v1.BatchStart.type:type_name -> datastream.v1.BatchType + 10, // 1: datastream.v1.BatchStart.debug:type_name -> datastream.v1.Debug + 10, // 2: datastream.v1.BatchEnd.debug:type_name -> datastream.v1.Debug + 10, // 3: datastream.v1.L2Block.debug:type_name -> datastream.v1.Debug + 10, // 4: datastream.v1.Transaction.debug:type_name -> datastream.v1.Debug + 10, // 5: datastream.v1.UpdateGER.debug:type_name -> datastream.v1.Debug + 0, // 6: datastream.v1.BookMark.type:type_name -> datastream.v1.BookmarkType + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_datastream_proto_init() } +func file_datastream_proto_init() { + if File_datastream_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_datastream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BatchStart); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datastream_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BatchEnd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datastream_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*L2Block); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datastream_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*L2BlockEnd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datastream_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Transaction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datastream_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateGER); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datastream_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BookMark); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_datastream_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Debug); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_datastream_proto_rawDesc, + NumEnums: 3, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_datastream_proto_goTypes, + DependencyIndexes: file_datastream_proto_depIdxs, + EnumInfos: file_datastream_proto_enumTypes, + MessageInfos: file_datastream_proto_msgTypes, + }.Build() + File_datastream_proto = out.File + file_datastream_proto_rawDesc = nil + file_datastream_proto_goTypes = nil + file_datastream_proto_depIdxs = nil +} diff --git a/go.mod b/go.mod index dce92af..cc742e7 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,11 @@ module github.com/0xPolygonHermez/zkevm-data-streamer -go 1.19 +go 1.21 + +toolchain go1.21.13 require ( + github.com/ethereum/go-ethereum v1.14.8 github.com/hermeznetwork/tracerr v0.3.2 github.com/mitchellh/mapstructure v1.5.0 github.com/spf13/viper v1.16.0 @@ -10,6 +13,7 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/urfave/cli/v2 v2.27.1 go.uber.org/zap v1.27.0 + google.golang.org/protobuf v1.34.2 ) require ( @@ -18,6 +22,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/holiman/uint256 v1.3.1 // indirect github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -30,8 +35,9 @@ require ( github.com/subosito/gotenv v1.6.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.uber.org/multierr v1.10.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index e59ac1c..bac23fc 100644 --- a/go.sum +++ b/go.sum @@ -58,7 +58,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ethereum/go-ethereum v1.14.8 h1:NgOWvXS+lauK+zFukEvi85UmmsS/OkV0N23UZ1VTIig= +github.com/ethereum/go-ethereum v1.14.8/go.mod h1:TJhyuDq0JDppAkFXgqjwpdlQApywnu/m10kFPxh8vvs= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -106,6 +109,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -130,6 +134,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hermeznetwork/tracerr v0.3.2 h1:QB3TlQxO/4XHyixsg+nRZPuoel/FFQlQ7oAoHDD5l1c= github.com/hermeznetwork/tracerr v0.3.2/go.mod h1:nsWC1+tc4qUEbUGRv4DcPJJTjLsedlPajlFmpJoohK4= +github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= +github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -139,9 +145,11 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e h1:9MlwzLdW7QSDrhDjFlsEYmxpFyIoXmYRon3dt0io31k= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -167,6 +175,7 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= @@ -210,6 +219,7 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= @@ -221,6 +231,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -289,7 +301,8 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -351,8 +364,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= @@ -362,8 +375,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -419,6 +432,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -507,6 +521,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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= @@ -519,8 +535,9 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkep gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/proto/datastream/v1/datastream.proto b/proto/datastream/v1/datastream.proto new file mode 100644 index 0000000..b709689 --- /dev/null +++ b/proto/datastream/v1/datastream.proto @@ -0,0 +1,95 @@ +syntax = "proto3"; + +package datastream.v1; + +option go_package = "github.com/0xPolygonHermez/zkevm-node/state/datastream"; + +message BatchStart { + uint64 number = 1; + BatchType type = 2; + uint64 fork_id = 3; + uint64 chain_id = 4; + Debug debug = 5; +} + +message BatchEnd { + uint64 number = 1; + bytes local_exit_root = 2; + bytes state_root = 3; + Debug debug = 4; +} + +message L2Block { + uint64 number = 1; + uint64 batch_number = 2; + uint64 timestamp = 3; + uint32 delta_timestamp = 4; + uint64 min_timestamp = 5; + bytes l1_blockhash = 6; + uint32 l1_infotree_index = 7; + bytes hash = 8; + bytes state_root = 9; + bytes global_exit_root = 10; + bytes coinbase = 11; + uint64 block_gas_limit = 12; + bytes block_info_root = 13; + Debug debug = 14; +} + +message L2BlockEnd { + uint64 number = 1; +} + +message Transaction { + uint64 l2block_number = 1; + uint64 index = 2; + bool is_valid = 3; + bytes encoded = 4; + uint32 effective_gas_price_percentage = 5; + bytes im_state_root = 6; + Debug debug = 7; +} + +message UpdateGER { + uint64 batch_number = 1; + uint64 timestamp = 2; + bytes global_exit_root = 3; + bytes coinbase = 4; + uint64 fork_id = 5; + uint64 chain_id = 6; + bytes state_root = 7; + Debug debug = 8; +} + +message BookMark { + BookmarkType type = 1; + uint64 value = 2; +} + +message Debug { + string message = 1; +} + +enum BookmarkType { + BOOKMARK_TYPE_UNSPECIFIED = 0; + BOOKMARK_TYPE_BATCH = 1; + BOOKMARK_TYPE_L2_BLOCK = 2; +} + +enum EntryType { + ENTRY_TYPE_UNSPECIFIED = 0; + ENTRY_TYPE_BATCH_START = 1; + ENTRY_TYPE_L2_BLOCK = 2; + ENTRY_TYPE_TRANSACTION = 3; + ENTRY_TYPE_BATCH_END = 4; + ENTRY_TYPE_UPDATE_GER = 5; + ENTRY_TYPE_L2_BLOCK_END = 6; +} + +enum BatchType { + BATCH_TYPE_UNSPECIFIED = 0; + BATCH_TYPE_REGULAR = 1; + BATCH_TYPE_FORCED = 2; + BATCH_TYPE_INJECTED = 3; + BATCH_TYPE_INVALID = 4; +} \ No newline at end of file diff --git a/proto/include/google/protobuf/empty.proto b/proto/include/google/protobuf/empty.proto new file mode 100644 index 0000000..0ada0f6 --- /dev/null +++ b/proto/include/google/protobuf/empty.proto @@ -0,0 +1,51 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/emptypb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "EmptyProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// A generic empty message that you can re-use to avoid defining duplicated +// empty messages in your APIs. A typical example is to use it as the request +// or the response type of an API method. For instance: +// +// service Foo { +// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +// } +// +message Empty {} \ No newline at end of file From 766c3e306617cd827cc62e87c74123b933f0e4cb Mon Sep 17 00:00:00 2001 From: Rachit Sonthalia <54906134+rachit77@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:30:15 +0530 Subject: [PATCH 16/18] Rachit77/tests (#137) * wip * wip * change permission * wip * wip * wip * lint fix --- datastreamer/datastreamer_test.go | 18 +++++- datastreamer/streambookmark_test.go | 72 +++++++++++++++++++++++ datastreamer/streamfile_test.go | 56 ++++++++++++++++++ datastreamer/streamserver_test.go | 40 +++++++++++++ go.mod | 1 + go.sum | 2 + log/log_test.go | 89 +++++++++++++++++++++++++++++ relay/relay_test.go | 70 +++++++++++++++++++++++ 8 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 datastreamer/streambookmark_test.go create mode 100644 datastreamer/streamfile_test.go create mode 100644 datastreamer/streamserver_test.go create mode 100644 relay/relay_test.go diff --git a/datastreamer/datastreamer_test.go b/datastreamer/datastreamer_test.go index 9239896..4f2cb1a 100644 --- a/datastreamer/datastreamer_test.go +++ b/datastreamer/datastreamer_test.go @@ -240,8 +240,20 @@ func TestServer(t *testing.T) { require.NoError(t, err) require.Equal(t, uint64(3), entryNumber) + // Case: Start atomic operation with atomic operation in progress -> FAIL + _ = streamServer.StartAtomicOp() + err = streamServer.StartAtomicOp() + _ = streamServer.CommitAtomicOp() + require.EqualError(t, datastreamer.ErrStartAtomicOpNotAllowed, err.Error()) + + // Case: Commit atomic operation without starting atomic operation -> FAIL err = streamServer.CommitAtomicOp() - require.NoError(t, err) + require.EqualError(t, datastreamer.ErrCommitNotAllowed, err.Error()) + + // Case: AddStreamBookmark without atomic operation in progress -> FAIL + entryNumber, err = streamServer.AddStreamBookmark(testBookmark.Encode()) + require.Equal(t, uint64(0), entryNumber) + require.EqualError(t, datastreamer.ErrAddEntryNotAllowed, err.Error()) // Check get data between 2 bookmarks data, err := streamServer.GetDataBetweenBookmarks(testBookmark.Encode(), testBookmark2.Encode()) @@ -356,6 +368,10 @@ func TestServer(t *testing.T) { err = streamServer.RollbackAtomicOp() require.NoError(t, err) + // Case: Rollback operation without starting atomic operation -> FAIL + err = streamServer.RollbackAtomicOp() + require.EqualError(t, datastreamer.ErrRollbackNotAllowed, err.Error()) + // Case: Get entry data of previous rollback entry number (doesn't exist) -> FAIL entry, err = streamServer.GetEntry(7) require.EqualError(t, datastreamer.ErrInvalidEntryNumber, err.Error()) diff --git a/datastreamer/streambookmark_test.go b/datastreamer/streambookmark_test.go new file mode 100644 index 0000000..f3dea11 --- /dev/null +++ b/datastreamer/streambookmark_test.go @@ -0,0 +1,72 @@ +package datastreamer + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +func createTempDB(t *testing.T) *StreamBookmark { + t.Helper() + + tempFile := "test_bookmarks_db" + b, err := NewBookmark(tempFile) + if err != nil { + t.Fatalf("Failed to create bookmark: %v", err) + } + + return b +} + +func cleanUpDB(t *testing.T, b *StreamBookmark) { + t.Helper() + + err := b.db.Close() + if err != nil { + t.Fatalf("Failed to close bookmark database: %v", err) + } + + err = os.RemoveAll(b.dbName) + if err != nil { + t.Fatalf("Failed to remove test database: %v", err) + } +} + +func TestNewBookmark(t *testing.T) { + b := createTempDB(t) + defer cleanUpDB(t, b) + + if b == nil || b.db == nil { + t.Fatalf("Expected non-nil bookmark and database") + } +} + +func TestAddBookmark(t *testing.T) { + b := createTempDB(t) + defer cleanUpDB(t, b) + + bookmark := []byte("testBookmark") + entryNum := uint64(12345) + + err := b.AddBookmark(bookmark, entryNum) + if err != nil { + t.Fatalf("Failed to add bookmark: %v", err) + } + + value, err := b.GetBookmark(bookmark) + if err != nil { + t.Fatalf("Failed to get bookmark after adding: %v", err) + } + + assert.Equal(t, entryNum, value, "Expected bookmark value %d, got %d", entryNum, value) +} + +func TestGetBookmarkNotFound(t *testing.T) { + b := createTempDB(t) + defer cleanUpDB(t, b) + + nonExistentBookmark := []byte("nonExistentBookmark") + _, err := b.GetBookmark(nonExistentBookmark) + assert.Error(t, err, "Expected error when getting a non-existent bookmark") +} diff --git a/datastreamer/streamfile_test.go b/datastreamer/streamfile_test.go new file mode 100644 index 0000000..fca11ed --- /dev/null +++ b/datastreamer/streamfile_test.go @@ -0,0 +1,56 @@ +package datastreamer + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +func setupTestFile(t *testing.T, filename string) *StreamFile { + t.Helper() + + sf, err := NewStreamFile(filename, 1, 12345, 1) + assert.NoError(t, err) + assert.NotNil(t, sf) + + return sf +} + +func cleanupTestFile(filename string) { + _ = os.Remove(filename) +} + +func TestNewStreamFile(t *testing.T) { + filename := "test_streamfile.bin" + defer cleanupTestFile(filename) + + sf := setupTestFile(t, filename) + + assert.Equal(t, filename, sf.fileName) + assert.Equal(t, uint32(PageDataSize), sf.pageSize) + assert.Equal(t, uint64(4096), sf.header.TotalLength) + assert.Equal(t, uint64(0), sf.header.TotalEntries) + + info, err := os.Stat(filename) + assert.NoError(t, err) + assert.Equal(t, int64(PageHeaderSize+initPages*PageDataSize), info.Size()) +} + +func TestWriteAndReadHeader(t *testing.T) { + filename := "test_streamfile_header.bin" + defer cleanupTestFile(filename) + + sf := setupTestFile(t, filename) + + sf.header.TotalEntries = 10 + sf.header.TotalLength = 4096 + err := sf.writeHeaderEntry() + assert.NoError(t, err) + + err = sf.readHeaderEntry() + assert.NoError(t, err) + + assert.Equal(t, uint64(10), sf.header.TotalEntries) + assert.Equal(t, uint64(4096), sf.header.TotalLength) +} diff --git a/datastreamer/streamserver_test.go b/datastreamer/streamserver_test.go new file mode 100644 index 0000000..e0ab4ff --- /dev/null +++ b/datastreamer/streamserver_test.go @@ -0,0 +1,40 @@ +package datastreamer + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestProcessCommand(t *testing.T) { + server := new(StreamServer) + cli := &client{status: csSyncing} + + // Test CmdStart + err := server.processCommand(CmdStart, cli) + assert.EqualError(t, ErrClientAlreadyStarted, err.Error()) + + // Test CmdStartBookmark + err = server.processCommand(CmdStartBookmark, cli) + assert.EqualError(t, ErrClientAlreadyStarted, err.Error()) + + // Test CmdStop + err = server.processCommand(CmdStop, cli) + assert.EqualError(t, ErrClientAlreadyStopped, err.Error()) + + // Test CmdHeader + err = server.processCommand(CmdHeader, cli) + assert.EqualError(t, ErrHeaderCommandNotAllowed, err.Error()) + + // Test CmdEntry + err = server.processCommand(CmdEntry, cli) + assert.EqualError(t, ErrEntryCommandNotAllowed, err.Error()) + + // Test CmdBookmark + err = server.processCommand(CmdBookmark, cli) + assert.EqualError(t, ErrBookmarkCommandNotAllowed, err.Error()) + + // Test invalid command + err = server.processCommand(Command(100), cli) + assert.EqualError(t, ErrInvalidCommand, err.Error()) +} diff --git a/go.mod b/go.mod index cc742e7..7da51ba 100644 --- a/go.mod +++ b/go.mod @@ -32,6 +32,7 @@ require ( github.com/spf13/cast v1.5.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.uber.org/multierr v1.10.0 // indirect diff --git a/go.sum b/go.sum index bac23fc..927cc58 100644 --- a/go.sum +++ b/go.sum @@ -191,6 +191,8 @@ github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1Fof github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= diff --git a/log/log_test.go b/log/log_test.go index 9bbc255..f64cbb2 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -1,17 +1,25 @@ package log import ( + "errors" + "fmt" "testing" + + "github.com/hermeznetwork/tracerr" + "github.com/stretchr/testify/assert" ) func TestLogNotInitialized(t *testing.T) { Info("Test log.Info value is ", 10) Infof("Test log.Infof %d", 10) Infow("Test log.Infow", "value", 10) + Debug("Test log.Debug value is ", 10) Debugf("Test log.Debugf %d", 10) + Debugw("Test log.Debugw value", 10) Error("Test log.Error value is ", 10) Errorf("Test log.Errorf %d", 10) Errorw("Test log.Errorw value", 10) + Warn("Test log.Warn value is ", 10) Warnf("Test log.Warnf %d", 10) Warnw("Test log.Warnw value", 10) } @@ -35,3 +43,84 @@ func TestLog(t *testing.T) { Warnf("Test log.Warnf %d", 10) Warnw("Test log.Warnw value", 10) } + +func TestLogger_WithFields(t *testing.T) { + cfg := Config{ + Environment: EnvironmentDevelopment, + Level: "debug", + Outputs: []string{"stderr"}, + } + Init(cfg) + + originalLogger := WithFields("originalField", "originalValue") + derivedLogger := originalLogger.WithFields("newField", "newValue") + + originalCore := originalLogger.x.Desugar().Core() + assert.NotNil(t, originalCore) + assert.NotEqual(t, derivedLogger.x, originalLogger.x) + + derivedCore := derivedLogger.x.Desugar().Core() + assert.NotNil(t, derivedCore) + assert.NotEqual(t, derivedCore, originalCore) +} + +func TestSprintStackTrace(t *testing.T) { + err := func() error { + return tracerr.Wrap(func() error { + return tracerr.New("dummy error") + }()) + }() + + st := tracerr.StackTrace(err) + fmt.Println(st) + + stackTraceStr := sprintStackTrace(st) + fmt.Println(stackTraceStr) + + assert.Contains(t, stackTraceStr, "/log/log_test.go") + assert.Contains(t, stackTraceStr, "TestSprintStackTrace") +} + +func TestAppendStackTraceMaybeArgs(t *testing.T) { + err := errors.New("test error") + args := []interface{}{"some value", err} + newArgs := appendStackTraceMaybeArgs(args) + + assert.Greater(t, len(newArgs), len(args)) + + stackTraceStr, ok := newArgs[len(newArgs)-1].(string) + fmt.Println(stackTraceStr) + assert.True(t, ok) + assert.Contains(t, stackTraceStr, "/log/log_test.go") + assert.Contains(t, stackTraceStr, "TestAppendStackTraceMaybeArgs") +} + +func TestAppendStackTraceMaybeKV(t *testing.T) { + msg := "Test message" + + // Test case: No error in key-value pairs + kv := []interface{}{"key1", "value1", "key2", "value2"} + result := appendStackTraceMaybeKV(msg, kv) + assert.Equal(t, msg, result, "Expected message to be unchanged when no error is present") + + // Test case: Error in key-value pairs + err := errors.New("Test error") + wrappedErr := tracerr.Wrap(err) + expectedErrMsg := fmt.Sprintf("%v: %v", msg, wrappedErr.Error()) + kv = []interface{}{"key1", "value1", "errorKey", err} + result = appendStackTraceMaybeKV(msg, kv) + + assert.Contains(t, result, expectedErrMsg, "Expected message to include the error and its stack trace") + assert.Contains(t, result, "log_test.go", "Expected stack trace to include 'log_test.go'") + assert.Contains( + t, + result, + "TestAppendStackTraceMaybeKV", + "Expected stack trace to include 'TestAppendStackTraceMaybeKV'", + ) + + // Test case: Error at an even index should be ignored + kv = []interface{}{err, "value2", "key2", "value2"} + result = appendStackTraceMaybeKV(msg, kv) + assert.Equal(t, msg, result, "Expected message to be unchanged when error is at an odd index") +} diff --git a/relay/relay_test.go b/relay/relay_test.go new file mode 100644 index 0000000..d68c002 --- /dev/null +++ b/relay/relay_test.go @@ -0,0 +1,70 @@ +package main + +import ( + "flag" + "fmt" + "os" + "path/filepath" + "testing" + "time" + + "github.com/spf13/viper" + "github.com/stretchr/testify/assert" + "github.com/urfave/cli/v2" +) + +func TestDefaultConfig(t *testing.T) { + expectedConfig := &config{ + Server: "127.0.0.1:6900", + Port: 7900, + File: "datarelay.bin", + WriteTimeout: 3 * time.Second, + InactivityTimeout: 120 * time.Second, + Log: "info", + } + + cfg, err := defaultConfig() + assert.NoError(t, err) + assert.Equal(t, expectedConfig, cfg) +} + +func TestLoadConfig(t *testing.T) { + tempDir := t.TempDir() + configFile := filepath.Join(tempDir, "test_config.toml") + configContent := ` +Server = "127.0.0.1:8080" +Port = 8000 +File = "testfile.bin" +WriteTimeout = 2 +InactivityTimeout = 60 +Log = "debug" +` + + err := os.WriteFile(configFile, []byte(configContent), 0600) + assert.NoError(t, err) + + app := cli.NewApp() + set := flag.NewFlagSet("test", 0) + set.String("cfg", configFile, "doc") + ctx := cli.NewContext(app, set, nil) + + cfg, err := loadConfig(ctx) + fmt.Println(cfg) + assert.NoError(t, err) + + assert.Equal(t, "127.0.0.1:8080", cfg.Server) + assert.Equal(t, uint64(8000), cfg.Port) + assert.Equal(t, "testfile.bin", cfg.File) + assert.Equal(t, 2*time.Nanosecond, cfg.WriteTimeout) + assert.Equal(t, 60*time.Nanosecond, cfg.InactivityTimeout) + assert.Equal(t, "debug", cfg.Log) + + viper.Reset() + + os.Setenv("ZKEVM_STREAM_SERVER", "127.0.0.1:9090") + defer os.Unsetenv("ZKEVM_STREAM_SERVER") + + cfg, err = loadConfig(ctx) + assert.NoError(t, err) + assert.Equal(t, "127.0.0.1:9090", cfg.Server) +} From 59e340fb2456b0d1bc4501240b4e7a01ff5fde61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Ram=C3=ADrez?= <58293609+ToniRamirezM@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:28:49 +0200 Subject: [PATCH 17/18] review errors level (#150) --- datastreamer/streambookmark.go | 3 +- datastreamer/streamclient.go | 32 +++++++++++++--------- datastreamer/streamfile.go | 5 ++-- datastreamer/streamserver.go | 50 +++++++++++++++++----------------- 4 files changed, 47 insertions(+), 43 deletions(-) diff --git a/datastreamer/streambookmark.go b/datastreamer/streambookmark.go index f1e84a4..01b1817 100644 --- a/datastreamer/streambookmark.go +++ b/datastreamer/streambookmark.go @@ -57,7 +57,6 @@ func (b *StreamBookmark) GetBookmark(bookmark []byte) (uint64, error) { // Get the bookmark from DB entry, err := b.db.Get(bookmark, nil) if errors.Is(err, leveldb.ErrNotFound) { - // log.Infof("Bookmark not found [%v]: %v", bookmark, err) return 0, err } else if err != nil { log.Errorf("Error getting bookmark [%v]: %w", bookmark, err) @@ -100,7 +99,7 @@ func (b *StreamBookmark) PrintDump() error { iter.Release() // Log total - log.Infof("Number of bookmarks: [%d]", count) + log.Debugf("Number of bookmarks: [%d]", count) return err } diff --git a/datastreamer/streamclient.go b/datastreamer/streamclient.go index 0a0e51e..e85512a 100644 --- a/datastreamer/streamclient.go +++ b/datastreamer/streamclient.go @@ -87,7 +87,12 @@ func (c *StreamClient) Start() error { go c.readEntries() // Goroutine to consume streaming entries - go c.getStreaming() + go func() { + err := c.getStreaming() + if err != nil { + log.Errorf("%s Error while getting streaming: %v", c.ID, err) + } + }() // Flag stared c.started = true @@ -103,7 +108,7 @@ func (c *StreamClient) connectServer() bool { for !c.connected { c.conn, err = net.Dial("tcp", c.server) if err != nil { - log.Infof("Error connecting to server %s: %v", c.server, err) + log.Errorf("Error connecting to server %s: %v", c.server, err) time.Sleep(defaultTimeout) continue } else { @@ -177,7 +182,7 @@ func (c *StreamClient) ExecCommandGetBookmark(fromBookmark []byte) (FileEntry, e // execCommand executes a valid client TCP command with deferred command result possibility func (c *StreamClient) execCommand(cmd Command, deferredResult bool, fromEntry uint64, fromBookmark []byte) (HeaderEntry, FileEntry, error) { - log.Infof("%s Executing command %d[%s]...", c.ID, cmd, StrCommand[cmd]) + log.Debugf("%s Executing command %d[%s]...", c.ID, cmd, StrCommand[cmd]) header := HeaderEntry{} entry := FileEntry{} @@ -207,14 +212,14 @@ func (c *StreamClient) execCommand(cmd Command, deferredResult bool, // Send the command parameters switch cmd { case CmdStart: - log.Infof("%s ...from entry %d", c.ID, fromEntry) + log.Debugf("%s ...from entry %d", c.ID, fromEntry) // Send starting/from entry number err = writeFullUint64(fromEntry, c.conn) if err != nil { return header, entry, err } case CmdStartBookmark: - log.Infof("%s ...from bookmark [%v]", c.ID, fromBookmark) + log.Debugf("%s ...from bookmark [%v]", c.ID, fromBookmark) // Send starting/from bookmark length err = writeFullUint32(uint32(len(fromBookmark)), c.conn) if err != nil { @@ -226,14 +231,14 @@ func (c *StreamClient) execCommand(cmd Command, deferredResult bool, return header, entry, err } case CmdEntry: - log.Infof("%s ...get entry %d", c.ID, fromEntry) + log.Debugf("%s ...get entry %d", c.ID, fromEntry) // Send entry to retrieve err = writeFullUint64(fromEntry, c.conn) if err != nil { return header, entry, err } case CmdBookmark: - log.Infof("%s ...get bookmark [%v]", c.ID, fromBookmark) + log.Debugf("%s ...get bookmark [%v]", c.ID, fromBookmark) // Send bookmark length err = writeFullUint32(uint32(len(fromBookmark)), c.conn) if err != nil { @@ -529,14 +534,14 @@ func (c *StreamClient) readEntries() { func (c *StreamClient) getResult(cmd Command) ResultEntry { // Get result entry r := <-c.results - log.Infof("%s Result %d[%s] received for command %d[%s]", c.ID, r.errorNum, r.errorStr, cmd, StrCommand[cmd]) + log.Debugf("%s Result %d[%s] received for command %d[%s]", c.ID, r.errorNum, r.errorStr, cmd, StrCommand[cmd]) return r } // getHeader consumes a header entry func (c *StreamClient) getHeader() HeaderEntry { h := <-c.headers - log.Infof("%s Header received info: TotalEntries[%d], TotalLength[%d], Version[%d], SystemID[%d]", + log.Debugf("%s Header received info: TotalEntries[%d], TotalLength[%d], Version[%d], SystemID[%d]", c.ID, h.TotalEntries, h.TotalLength, h.Version, h.SystemID) return h } @@ -544,12 +549,12 @@ func (c *StreamClient) getHeader() HeaderEntry { // getEntry consumes a entry from commands response func (c *StreamClient) getEntry() FileEntry { e := <-c.entryRsp - log.Infof("%s Entry received info: Number[%d]", c.ID, e.Number) + log.Debugf("%s Entry received info: Number[%d]", c.ID, e.Number) return e } // getStreaming consumes streaming data entries -func (c *StreamClient) getStreaming() { +func (c *StreamClient) getStreaming() error { for { e := <-c.entries c.nextEntry = e.Number + 1 @@ -557,7 +562,8 @@ func (c *StreamClient) getStreaming() { // Process the data entry err := c.processEntry(&e, c, c.relayServer) if err != nil { - log.Fatalf("%s Processing entry %d: %s. HALTED!", c.ID, e.Number, err.Error()) + log.Errorf("%s Processing entry %d: %s. Exiting getStream function", c.ID, e.Number, err.Error()) + return err } } } @@ -597,6 +603,6 @@ func (c *StreamClient) IsStarted() bool { // PrintReceivedEntry prints received entry (default callback function) func PrintReceivedEntry(e *FileEntry, c *StreamClient, s *StreamServer) error { // Log data entry fields - log.Infof("Data entry(%s): %d | %d | %d | %d", c.ID, e.Number, e.Length, e.Type, len(e.Data)) + log.Debugf("Data entry(%s): %d | %d | %d | %d", c.ID, e.Number, e.Length, e.Type, len(e.Data)) return nil } diff --git a/datastreamer/streamfile.go b/datastreamer/streamfile.go index 705dffd..b27f3f4 100644 --- a/datastreamer/streamfile.go +++ b/datastreamer/streamfile.go @@ -215,7 +215,7 @@ func (f *StreamFile) initializeFile() error { for i := 1; i <= initPages; i++ { err = f.createPage(f.pageSize) if err != nil { - log.Error("Eror creating page") + log.Error("Error creating page") return err } } @@ -580,7 +580,6 @@ func (f *StreamFile) AddFileEntry(e FileEntry) error { f.header.TotalEntries++ f.mutexHeader.Unlock() - // printHeaderEntry(f.header) return nil } @@ -656,7 +655,7 @@ func DecodeBinaryToFileEntry(b []byte) (FileEntry, error) { func (f *StreamFile) iteratorFrom(entryNum uint64, readOnly bool) (*iteratorFile, error) { // Check starting entry number if entryNum >= f.writtenHead.TotalEntries { - log.Infof("Invalid starting entry number for iterator") + log.Error("Invalid starting entry number for iterator") return nil, ErrInvalidEntryNumber } diff --git a/datastreamer/streamserver.go b/datastreamer/streamserver.go index 63b0f60..6816fb8 100644 --- a/datastreamer/streamserver.go +++ b/datastreamer/streamserver.go @@ -263,7 +263,7 @@ func (s *StreamServer) checkClientInactivity() { s.mutexClients.Unlock() for clientID := range clientsToKill { - log.Infof("killing inactive client %s", clientID) + log.Warnf("killing inactive client %s", clientID) s.killClient(clientID) } } @@ -331,7 +331,7 @@ func (s *StreamServer) handleConnection(conn net.Conn) { // Check stream type if st != s.streamType { - log.Errorf("Mismatch stream type, killed: %s", clientID) + log.Errorf("Mismatch stream type: client %s killed", clientID) s.killClient(clientID) return } @@ -464,7 +464,7 @@ func (s *StreamServer) CommitAtomicOp() error { // No atomic operation in progress s.clearAtomicOp() - log.Infof("committed datastream atomic operation, startEntry: %d, time: %v", s.atomicOp.startEntry, time.Since(start)) + log.Debugf("committed datastream atomic operation, startEntry: %d, time: %v", s.atomicOp.startEntry, time.Since(start)) return nil } @@ -474,7 +474,7 @@ func (s *StreamServer) RollbackAtomicOp() error { start := time.Now().UnixNano() defer log.Debugf("RollbackAtomicOp process time: %vns", time.Now().UnixNano()-start) - log.Infof("rollback datastream atomic operation, startEntry: %d", s.atomicOp.startEntry) + log.Debugf("rollback datastream atomic operation, startEntry: %d", s.atomicOp.startEntry) if s.atomicOp.status != aoStarted { log.Errorf("Rollback not allowed, AtomicOp is not in the started state") return ErrRollbackNotAllowed @@ -734,7 +734,7 @@ func (s *StreamServer) broadcastAtomicOp() { } } - log.Infof("sent datastream entries, count: %d, clients: %d, time: %v, clients-ip: {%s}", + log.Debugf("sent datastream entries, count: %d, clients: %d, time: %v, clients-ip: {%s}", len(broadcastOp.entries), len(s.clients), time.Since(start), sClients) } } @@ -878,11 +878,11 @@ func (s *StreamServer) processCmdStart(client *client) error { client.fromEntry = fromEntry // Log - log.Infof("Client %s command Start from %d", client.clientID, fromEntry) + log.Debugf("Client %s command Start from %d", client.clientID, fromEntry) // Check received param if fromEntry > s.nextEntry && fromEntry > s.initEntry { - log.Infof("Start command invalid from entry %d for client %s", fromEntry, client.clientID) + log.Errorf("Start command invalid from entry %d for client %s", fromEntry, client.clientID) err = ErrStartCommandInvalidParamFromEntry _ = s.sendResultEntry(uint32(CmdErrBadFromEntry), StrCommandErrors[CmdErrBadFromEntry], client) return err @@ -912,7 +912,7 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { // Check maximum length allowed if length > maxBookmarkLength { - log.Infof("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", + log.Errorf("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", client.clientID, length, maxBookmarkLength) return ErrBookmarkMaxLength } @@ -924,12 +924,12 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { } // Log - log.Infof("Client %s command StartBookmark [%v]", client.clientID, bookmark) + log.Debugf("Client %s command StartBookmark [%v]", client.clientID, bookmark) // Get bookmark entryNum, err := s.bookmark.GetBookmark(bookmark) if err != nil { - log.Infof("StartBookmark command invalid from bookmark %v for client %s: %v", bookmark, client.clientID, err) + log.Errorf("StartBookmark command invalid from bookmark %v for client %s: %v", bookmark, client.clientID, err) err = ErrStartBookmarkInvalidParamFromBookmark _ = s.sendResultEntry(uint32(CmdErrBadFromBookmark), StrCommandErrors[CmdErrBadFromBookmark], client) return err @@ -942,7 +942,7 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { } // Stream entries data from the entry number marked by the bookmark - log.Infof("Client %s Bookmark [%v] is the entry number [%d]", client.clientID, bookmark, entryNum) + log.Debugf("Client %s Bookmark [%v] is the entry number [%d]", client.clientID, bookmark, entryNum) if entryNum < s.nextEntry { err = s.streamingFromEntry(client, entryNum) } @@ -953,7 +953,7 @@ func (s *StreamServer) processCmdStartBookmark(client *client) error { // processCmdStop processes the TCP Stop command from the clients func (s *StreamServer) processCmdStop(client *client) error { // Log - log.Infof("Client %s command Stop", client.clientID) + log.Debugf("Client %s command Stop", client.clientID) // Send a command result entry OK err := s.sendResultEntry(0, "OK", client) @@ -963,7 +963,7 @@ func (s *StreamServer) processCmdStop(client *client) error { // processCmdHeader processes the TCP Header command from the clients func (s *StreamServer) processCmdHeader(client *client) error { // Log - log.Infof("Client %s command Header", client.clientID) + log.Debugf("Client %s command Header", client.clientID) // Send a command result entry OK err := s.sendResultEntry(0, "OK", client) @@ -982,7 +982,7 @@ func (s *StreamServer) processCmdHeader(client *client) error { err = ErrNilConnection } if err != nil { - log.Warnf("Error sending header entry to %s: %v", client.clientID, err) + log.Errorf("Error sending header entry to %s: %v", client.clientID, err) return err } return nil @@ -997,7 +997,7 @@ func (s *StreamServer) processCmdEntry(client *client) error { } // Log - log.Infof("Client %s command Entry %d", client.clientID, entryNumber) + log.Debugf("Client %s command Entry %d", client.clientID, entryNumber) // Send a command result entry OK err = s.sendResultEntry(0, "OK", client) @@ -1008,7 +1008,7 @@ func (s *StreamServer) processCmdEntry(client *client) error { // Get the requested entry entry, err := s.GetEntry(entryNumber) if err != nil { - log.Infof("Error getting entry, not found? %d: %v", entryNumber, err) + log.Warnf("Entry not found %d: %v", entryNumber, err) entry = FileEntry{} entry.Length = FixedSizeFileEntry entry.Type = EntryTypeNotFound @@ -1023,7 +1023,7 @@ func (s *StreamServer) processCmdEntry(client *client) error { err = ErrNilConnection } if err != nil { - log.Warnf("Error sending entry to %s: %v", client.clientID, err) + log.Errorf("Error sending entry to %s: %v", client.clientID, err) return err } @@ -1040,7 +1040,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { // Check maximum length allowed if length > maxBookmarkLength { - log.Infof("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", + log.Errorf("Client %s exceeded [%d] maximum allowed length [%d] for a bookmark.", client.clientID, length, maxBookmarkLength) return ErrBookmarkMaxLength } @@ -1052,7 +1052,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { } // Log - log.Infof("Client %s command Bookmark %v", client.clientID, bookmark) + log.Debugf("Client %s command Bookmark %v", client.clientID, bookmark) // Send a command result entry OK err = s.sendResultEntry(0, "OK", client) @@ -1063,7 +1063,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { // Get the requested bookmark entry, err := s.GetFirstEventAfterBookmark(bookmark) if err != nil { - log.Infof("Error getting bookmark, not found? %v: %v", bookmark, err) + log.Warnf("Entry not found %v: %v", bookmark, err) entry = FileEntry{} entry.Length = FixedSizeFileEntry entry.Type = EntryTypeNotFound @@ -1078,7 +1078,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { err = ErrNilConnection } if err != nil { - log.Warnf("Error sending entry to %s: %v", client.clientID, err) + log.Errorf("Error sending entry to %s: %v", client.clientID, err) return err } @@ -1088,7 +1088,7 @@ func (s *StreamServer) processCmdBookmark(client *client) error { // streamingFromEntry sends to the client the stream data starting from the requested entry number func (s *StreamServer) streamingFromEntry(client *client, fromEntry uint64) error { // Log - log.Infof("SYNCING %s from entry %d...", client.clientID, fromEntry) + log.Debugf("SYNCING %s from entry %d...", client.clientID, fromEntry) // Start file stream iterator iterator, err := s.streamFile.iteratorFrom(fromEntry, true) @@ -1117,11 +1117,11 @@ func (s *StreamServer) streamingFromEntry(client *client, fromEntry uint64) erro err = ErrNilConnection } if err != nil { - log.Warnf("Error sending entry %d to %s: %v", iterator.Entry.Number, client.clientID, err) + log.Errorf("Error sending entry %d to %s: %v", iterator.Entry.Number, client.clientID, err) return err } } - log.Infof("Synced %s until %d!", client.clientID, iterator.Entry.Number) + log.Debugf("Synced %s until %d!", client.clientID, iterator.Entry.Number) // Close iterator s.streamFile.iteratorEnd(iterator) @@ -1153,7 +1153,7 @@ func (s *StreamServer) sendResultEntry(errorNum uint32, errorStr string, client err = ErrNilConnection } if err != nil { - log.Warnf("Error sending result entry to %s: %v", client.clientID, err) + log.Errorf("Error sending result entry to %s: %v", client.clientID, err) return err } return nil From c225bfec270234c5b7feeefc453fbc165b24a3f4 Mon Sep 17 00:00:00 2001 From: Barry Date: Fri, 8 Nov 2024 17:48:04 +0800 Subject: [PATCH 18/18] basedev merge upstream v0.2.7 fix ut (#9) * update * update --- .github/workflows/test.yml | 44 +++++++++++++++++++------------------- relay/main.go | 5 +++-- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c07df9d..81d585b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,25 +35,25 @@ name: code-coverage-report path: coverage.out - sonar-cloud: - needs: test - name: SonarCloud - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - - name: Download code coverage results - uses: actions/download-artifact@v3 - with: - name: code-coverage-report - - - name: SonarCloud analysis - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# sonar-cloud: +# needs: test +# name: SonarCloud +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Code +# uses: actions/checkout@v3 +# with: +# submodules: recursive +# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis +# +# - name: Download code coverage results +# uses: actions/download-artifact@v3 +# with: +# name: code-coverage-report +# +# - name: SonarCloud analysis +# uses: SonarSource/sonarcloud-github-action@master +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/relay/main.go b/relay/main.go index 4efe221..b794233 100644 --- a/relay/main.go +++ b/relay/main.go @@ -199,13 +199,14 @@ func run(ctx *cli.Context) error { Outputs: []string{"stdout"}, }) - log.Infof(">> Relay server started: port[%d] file[%s] server[%s] log[%s] delete data[%v]", cfg.Port, cfg.File, cfg.Server, cfg.Log, cfg.DeleteData) + log.Infof(">> Relay server started: port[%d] file[%s] server[%s] log[%s] delete data[%v]", + cfg.Port, cfg.File, cfg.Server, cfg.Log, cfg.DeleteData) if cfg.DeleteData { log.Infof(">> Warning Deleting data file: %s", cfg.File) deleteDataFile(cfg.File) log.Infof(">> Data file deleted: %s succeeded!", cfg.File) - time.Sleep(1 * time.Second) // nolint:gomnd + time.Sleep(1 * time.Second) //nolint:gomnd } // Create relay server