From 59a308dc4bb08163412108e5636d3902fb33c36b Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Wed, 24 Jul 2024 01:11:53 +0300 Subject: [PATCH 01/12] update scripts, rm package fix-proto --- .github/workflows/build.yml | 15 +++-- .github/workflows/test.yml | 15 +++-- etcddb/etcddb_client_test.go | 1 - fix-proto/init.go | 10 ---- go.mod | 49 ++++++++-------- go.sum | 98 ++++++++++++++++--------------- scripts/build | 31 +++++++--- scripts/install_daemon | 12 ++++ scripts/{install => install_deps} | 0 scripts/installdaemon | 10 ---- scripts/package | 16 ----- snetd/cmd/serve_test.go | 1 - snetd/main.go | 1 - 13 files changed, 129 insertions(+), 130 deletions(-) delete mode 100644 fix-proto/init.go create mode 100644 scripts/install_daemon rename scripts/{install => install_deps} (100%) mode change 100755 => 100644 delete mode 100755 scripts/installdaemon delete mode 100755 scripts/package diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46c184fd..8fb7f744 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,18 +6,21 @@ on: # branches: [ "master" ] workflow_dispatch: +env: + GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore + jobs: - run_build: - runs-on: ubuntu-latest - steps: - + run_build: + runs-on: ubuntu-latest + steps: + - name: clone repo uses: actions/checkout@v3 - + - name: download and install uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.22.5' - name: protobuff install run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 31801194..a33b7a3e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,18 +6,21 @@ on: branches: [ "master" ] workflow_dispatch: +env: + GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore + jobs: - run_tests: - runs-on: ubuntu-latest - steps: - + run_tests: + runs-on: ubuntu-latest + steps: + - name: clone repo uses: actions/checkout@v3 - + - name: download and install uses: actions/setup-go@v5 with: - go-version: '1.22.2' + go-version: '1.22.5' - name: protobuff install run: | diff --git a/etcddb/etcddb_client_test.go b/etcddb/etcddb_client_test.go index f84db835..b5e0aee7 100644 --- a/etcddb/etcddb_client_test.go +++ b/etcddb/etcddb_client_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/magiconair/properties/assert" - _ "github.com/singnet/snet-daemon/fix-proto" "github.com/singnet/snet-daemon/utils" ) diff --git a/fix-proto/init.go b/fix-proto/init.go deleted file mode 100644 index 9a33b414..00000000 --- a/fix-proto/init.go +++ /dev/null @@ -1,10 +0,0 @@ -package fix_proto - -import "os" - -func init() { - // fixing the panic due to the fact that the libraries have the same proto files by name: - // github.com/ipfs/go-cid conflicts with etcd library - // https://protobuf.dev/reference/go/faq/#fix-namespace-conflict - os.Setenv("GOLANG_PROTOBUF_REGISTRATION_CONFLICT", "ignore") -} diff --git a/go.mod b/go.mod index ba1bfa1a..68348c06 100644 --- a/go.mod +++ b/go.mod @@ -26,8 +26,8 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 - go.etcd.io/etcd/client/v3 v3.5.14 - go.etcd.io/etcd/server/v3 v3.5.14 + go.etcd.io/etcd/client/v3 v3.5.15 + go.etcd.io/etcd/server/v3 v3.5.15 go.uber.org/zap v1.27.0 golang.org/x/crypto v0.25.0 golang.org/x/net v0.27.0 @@ -76,7 +76,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.27.0 // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/gofrs/flock v0.8.1 // indirect @@ -87,7 +87,7 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/gorilla/websocket v1.5.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect @@ -123,7 +123,7 @@ require ( github.com/ipld/go-ipld-prime v0.21.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/goprocess v0.1.4 // indirect - github.com/jonboulle/clockwork v0.2.2 // indirect + github.com/jonboulle/clockwork v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.8 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect @@ -160,6 +160,7 @@ require ( github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect @@ -169,10 +170,10 @@ require ( github.com/polydawn/refmt v0.89.0 // indirect github.com/prometheus/client_golang v1.19.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.53.0 // indirect - github.com/prometheus/procfs v0.15.0 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -198,20 +199,20 @@ require ( github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.etcd.io/bbolt v1.3.10 // indirect - go.etcd.io/etcd/api/v3 v3.5.14 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect - go.etcd.io/etcd/client/v2 v2.305.14 // indirect - go.etcd.io/etcd/pkg/v3 v3.5.14 // indirect - go.etcd.io/etcd/raft/v3 v3.5.14 // indirect + go.etcd.io/etcd/api/v3 v3.5.15 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect + go.etcd.io/etcd/client/v2 v2.305.15 // indirect + go.etcd.io/etcd/pkg/v3 v3.5.15 // indirect + go.etcd.io/etcd/raft/v3 v3.5.15 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.50.0 // indirect - go.opentelemetry.io/otel v1.26.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0 // indirect - go.opentelemetry.io/otel/metric v1.26.0 // indirect - go.opentelemetry.io/otel/sdk v1.26.0 // indirect - go.opentelemetry.io/otel/trace v1.26.0 // indirect - go.opentelemetry.io/proto/otlp v1.2.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect + go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.28.0 // indirect + go.opentelemetry.io/otel/sdk v1.28.0 // indirect + go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/exp v0.0.0-20240707233637-46b078467d37 // indirect @@ -222,9 +223,9 @@ require ( golang.org/x/tools v0.23.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gonum.org/v1/gonum v0.15.0 // indirect - google.golang.org/genproto v0.0.0-20240318140521-94a12d6c2237 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect + google.golang.org/genproto v0.0.0-20240722135656-d784300faade // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.3.0 // indirect diff --git a/go.sum b/go.sum index 8c0bd83a..cb3904ea 100644 --- a/go.sum +++ b/go.sum @@ -228,8 +228,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -352,8 +352,8 @@ github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptR github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -518,8 +518,8 @@ github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0 github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= -github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= +github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -691,6 +691,8 @@ github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -814,16 +816,16 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE= -github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.15.0 h1:A82kmvXJq2jTu5YUhSGNlYoxh85zLnKgPz4bMZgI5Ek= -github.com/prometheus/procfs v0.15.0/go.mod h1:Y0RJ/Y5g5wJpkTisOtqwDSo4HwhGmLB4VQSw2sQJLHk= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/quic-go v0.44.0 h1:So5wOr7jyO4vzL2sd8/pD9Kesciv91zSk8BoFngItQ0= @@ -839,8 +841,8 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= @@ -973,20 +975,20 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd/api/v3 v3.5.14 h1:vHObSCxyB9zlF60w7qzAdTcGaglbJOpSj1Xj9+WGxq0= -go.etcd.io/etcd/api/v3 v3.5.14/go.mod h1:BmtWcRlQvwa1h3G2jvKYwIQy4PkHlDej5t7uLMUdJUU= -go.etcd.io/etcd/client/pkg/v3 v3.5.14 h1:SaNH6Y+rVEdxfpA2Jr5wkEvN6Zykme5+YnbCkxvuWxQ= -go.etcd.io/etcd/client/pkg/v3 v3.5.14/go.mod h1:8uMgAokyG1czCtIdsq+AGyYQMvpIKnSvPjFMunkgeZI= -go.etcd.io/etcd/client/v2 v2.305.14 h1:v5ASLyFuMlVd/gKU6uf6Cod+vSWKa4Rsv9+eghl0Nwk= -go.etcd.io/etcd/client/v2 v2.305.14/go.mod h1:AWYT0lLEkBuqVaGw0UVMtA4rxCb3/oGE8PxZ8cUS4tI= -go.etcd.io/etcd/client/v3 v3.5.14 h1:CWfRs4FDaDoSz81giL7zPpZH2Z35tbOrAJkkjMqOupg= -go.etcd.io/etcd/client/v3 v3.5.14/go.mod h1:k3XfdV/VIHy/97rqWjoUzrj9tk7GgJGH9J8L4dNXmAk= -go.etcd.io/etcd/pkg/v3 v3.5.14 h1:keuxhJiDCPjTKpW77GxJnnVVD5n4IsfvkDaqiqUMNEQ= -go.etcd.io/etcd/pkg/v3 v3.5.14/go.mod h1:7o+DL6a7DYz9KSjWByX+NGmQPYinoH3D36VAu/B3JqA= -go.etcd.io/etcd/raft/v3 v3.5.14 h1:mHnpbljpBBftmK+YUfp+49ivaCc126aBPLAnwDw0DnE= -go.etcd.io/etcd/raft/v3 v3.5.14/go.mod h1:WnIK5blyJGRKsHA3efovdNoLv9QELTZHzpDOVIAuL2s= -go.etcd.io/etcd/server/v3 v3.5.14 h1:l/3gdiSSoGU6MyKAYiL+8WSOMq9ySG+NqQ04euLtZfY= -go.etcd.io/etcd/server/v3 v3.5.14/go.mod h1:SPh0rUtGNDgOZd/aTbkAUYZV+5FFHw5sdbGnO2/byw0= +go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk= +go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM= +go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA= +go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU= +go.etcd.io/etcd/client/v2 v2.305.15 h1:VG2xbf8Vz1KJh65Ar2V5eDmfkp1bpzkSEHlhJM3usp8= +go.etcd.io/etcd/client/v2 v2.305.15/go.mod h1:Ad5dRjPVb/n5yXgAWQ/hXzuXXkBk0Y658ocuXYaUU48= +go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4= +go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU= +go.etcd.io/etcd/pkg/v3 v3.5.15 h1:/Iu6Sr3iYaAjy++8sIDoZW9/EfhcwLZwd4FOZX2mMOU= +go.etcd.io/etcd/pkg/v3 v3.5.15/go.mod h1:e3Acf298sPFmTCGTrnGvkClEw9RYIyPtNzi1XM8rets= +go.etcd.io/etcd/raft/v3 v3.5.15 h1:jOA2HJF7zb3wy8H/pL13e8geWqkEa/kUs0waUggZC0I= +go.etcd.io/etcd/raft/v3 v3.5.15/go.mod h1:k3r7P4seEiUcgxOPLp+mloJWV3Q4QLPGNvy/OgC8OtM= +go.etcd.io/etcd/server/v3 v3.5.15 h1:x35jrWnZgsRwMsFsUJIUdT1bvzIz1B+29HjMfRYVN/E= +go.etcd.io/etcd/server/v3 v3.5.15/go.mod h1:l9jX9oa/iuArjqz0RNX/TDbc70dLXxRZo/nmPucrpFo= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -995,30 +997,30 @@ 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.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.50.0 h1:zvpPXY7RfYAGSdYQLjp6zxdJNSYD/+FFoCTQN9IPxBs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.50.0/go.mod h1:BMn8NB1vsxTljvuorms2hyOs8IBuuBEq0pl7ltOfy30= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 h1:Xs2Ncz0gNihqu9iosIZ5SkBbWo5T8JhhLJFMQL1qmLI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0/go.mod h1:vy+2G/6NvVMpwGX/NyLqcC41fxepnuKHk16E6IZUcJc= -go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= -go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0 h1:1u/AyyOqAWzy+SkPxDpahCNZParHV8Vid1RnI2clyDE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0/go.mod h1:z46paqbJ9l7c9fIPCXTqTGwhQZ5XoTIsfeFYWboizjs= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0 h1:Waw9Wfpo/IXzOI8bCB7DIk+0JZcqqsyn1JFnAc+iam8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0/go.mod h1:wnJIG4fOqyynOnnQF/eQb4/16VlX2EJAHhHgqIqWfAo= +go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= +go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6ZXmNPRR8ul6i3WgFURCHzaXjHdm0karRG/+dj3s= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0 h1:1wp/gyxsuYtuE/JFxsQRtcCDtMrO2qMvlfXALU5wkzI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0/go.mod h1:gbTHmghkGgqxMomVQQMur1Nba4M0MQ8AYThXDUjsJ38= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.26.0 h1:0W5o9SzoR15ocYHEQfvfipzcNog1lBxOLfnex91Hk6s= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.26.0/go.mod h1:zVZ8nz+VSggWmnh6tTsJqXQ7rU4xLwRtna1M4x5jq58= go.opentelemetry.io/otel/exporters/zipkin v1.26.0 h1:sBk6A62GgcQRwcxcBwRMPkqeuSizcpHkXyZNyP281Fw= go.opentelemetry.io/otel/exporters/zipkin v1.26.0/go.mod h1:fLzYtPUxPFzu7rSqhYsCxYheT2dNoPjtKovCLzLm07w= -go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= -go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= -go.opentelemetry.io/otel/sdk v1.26.0 h1:Y7bumHf5tAiDlRYFmGqetNcLaVUZmh4iYfmGxtmz7F8= -go.opentelemetry.io/otel/sdk v1.26.0/go.mod h1:0p8MXpqLeJ0pzcszQQN4F0S5FVjBLgypeGSngLsmirs= -go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= -go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= -go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= -go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= +go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= +go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= +go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= +go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= +go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -1311,12 +1313,12 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20240318140521-94a12d6c2237 h1:PgNlNSx2Nq2/j4juYzQBG0/Zdr+WP4z5N01Vk4VYBCY= -google.golang.org/genproto v0.0.0-20240318140521-94a12d6c2237/go.mod h1:9sVD8c25Af3p0rGs7S7LLsxWKFiJt/65LdSyqXBkX/Y= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= -google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240722135656-d784300faade h1:lKFsS7wpngDgSCeFn7MoLy+wBDQZ1UQIJD4UNM1Qvkg= +google.golang.org/genproto v0.0.0-20240722135656-d784300faade/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY= +google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade h1:WxZOF2yayUHpHSbUE6NMzumUzBxYc3YGwo0YHnbzsJY= +google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade h1:oCRSWfwGXQsqlVdErcyTt4A93Y8fo0/9D4b1gnI++qo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= diff --git a/scripts/build b/scripts/build index c361f452..cccddac7 100755 --- a/scripts/build +++ b/scripts/build @@ -2,25 +2,42 @@ set -ex -PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) +PARENT_PATH="$(dirname "$(cd "$("dirname" "$0")"; pwd -P)")" if [ $# -lt 3 ] then echo "arguments expected are of the form and for the build script , as an example: '/scripts/build linux amd64 v5.1.5'" exit 1 fi -pushd $PARENT_PATH +pushd "$PARENT_PATH" mkdir -p build now=$(date +'%Y-%m-%d_%T') -networkJson=$(cat resources/blockchain_network_config.json | tr -d '\t\n\r') -buildname=$1-$2-$3 -githash=`git rev-parse HEAD` +# reading blockchain config +networkJson=$( Date: Wed, 24 Jul 2024 01:15:14 +0300 Subject: [PATCH 02/12] ci/cd: jobs for dev branch --- .github/workflows/build.yml | 6 +++--- .github/workflows/test.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fb7f744..d687cc86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,9 @@ name: build on: push: - branches: [ "master" ] - # pull_request: - # branches: [ "master" ] + branches: [ "master", "dev" ] + pull_request: + branches: [ "dev" ] workflow_dispatch: env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a33b7a3e..2ee26904 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,9 @@ name: tests on: - # push: - # branches: [ "master" ] + push: + branches: [ "dev" ] pull_request: - branches: [ "master" ] + branches: [ "master", "dev" ] workflow_dispatch: env: From 8988674e2ccb7cabb998a02e0d23682e449064be Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Wed, 24 Jul 2024 02:32:15 +0300 Subject: [PATCH 03/12] scripts: refactor and update, remove sonar configs --- resources/linuxbuild/Dockerfile | 26 +++++++++------------- scripts/{build-all => build_all_platforms} | 0 scripts/{buildlinux => build_in_docker} | 4 ++-- scripts/install_deps | 2 +- scripts/lint | 13 ----------- scripts/sonar | 15 ------------- scripts/test | 2 +- scripts/uninstall | 10 ++++----- scripts/watcher_fsevents_cgo.go.patch | 22 ------------------ sonar-project.properties | 8 ------- 10 files changed, 20 insertions(+), 82 deletions(-) rename scripts/{build-all => build_all_platforms} (100%) rename scripts/{buildlinux => build_in_docker} (70%) mode change 100755 => 100644 delete mode 100755 scripts/lint delete mode 100755 scripts/sonar delete mode 100644 scripts/watcher_fsevents_cgo.go.patch delete mode 100644 sonar-project.properties diff --git a/resources/linuxbuild/Dockerfile b/resources/linuxbuild/Dockerfile index 576a6d6f..d62a305f 100644 --- a/resources/linuxbuild/Dockerfile +++ b/resources/linuxbuild/Dockerfile @@ -1,15 +1,11 @@ -FROM golang:latest -WORKDIR / -RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh -RUN curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh -RUN chmod 755 nodesource_setup.sh -RUN bash nodesource_setup.sh -RUN apt-get install -y nodejs -RUN apt-get install -y protobuf-compiler libprotobuf-dev -RUN go get -u github.com/golang/protobuf/protoc-gen-go -RUN mkdir -p /go/src/github.com/singnet -WORKDIR /go/src/github.com/singnet -RUN git clone https://github.com/singnet/snet-daemon.git -WORKDIR /go/src/github.com/singnet/snet-daemon -RUN ./scripts/install -RUN ./scripts/build linux amd64 +FROM golang:alpine +RUN apk update && apk add --no-cache make protobuf-dev git bash +SHELL ["/bin/bash", "-c"] +RUN mkdir -p /snet-daemon +WORKDIR /snet-daemon +RUN git clone --single-branch --branch dev https://github.com/semyon-dev/snet-daemon.git . +RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest +RUN go generate ./... +RUN chmod +x ./scripts/build +RUN ./scripts/build linux amd64 dev diff --git a/scripts/build-all b/scripts/build_all_platforms similarity index 100% rename from scripts/build-all rename to scripts/build_all_platforms diff --git a/scripts/buildlinux b/scripts/build_in_docker old mode 100755 new mode 100644 similarity index 70% rename from scripts/buildlinux rename to scripts/build_in_docker index 3e5a7df7..ec3da4bb --- a/scripts/buildlinux +++ b/scripts/build_in_docker @@ -4,11 +4,11 @@ set -ex PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) -pushd $PARENT_PATH +pushd "$PARENT_PATH" mkdir -p build docker build -t snetd-linux-amd64:latest resources/linuxbuild docker run --name linux-build snetd-linux-amd64:latest -docker cp linux-build:/go/src/github.com/singnet/snet-daemon/build/snetd-linux-amd64 ./build +docker cp linux-build:/snet-daemon/build/snetd-linux-amd64-dev ./build docker rm linux-build docker rmi snetd-linux-amd64:latest popd diff --git a/scripts/install_deps b/scripts/install_deps index 565f4c85..eb728401 100644 --- a/scripts/install_deps +++ b/scripts/install_deps @@ -4,7 +4,7 @@ set -ex PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) -pushd $PARENT_PATH +pushd "$PARENT_PATH" go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest diff --git a/scripts/lint b/scripts/lint deleted file mode 100755 index c1b81125..00000000 --- a/scripts/lint +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -e - -PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) - -if ! command golint ; then - go get -u golang.org/x/lint/golint -fi - -pushd $PARENT_PATH -go list ./... | grep -v /vendor/ | xargs -n 1 golint -popd diff --git a/scripts/sonar b/scripts/sonar deleted file mode 100755 index 623c9599..00000000 --- a/scripts/sonar +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -ex - -PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) - -pushd $PARENT_PATH -sudo apt install unzip -y - -wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip -unzip sonar-scanner-cli-4.6.2.2472-linux.zip - -export SONAR_SCANNER_OPTS="-Xmx2048m" -sonar-scanner-4.6.2.2472-linux/bin/sonar-scanner -Dsonar.host.url=https://sonarqube.singularitynet.io -Dsonar.login=${SONAR_TOKEN} $SONAR_SCANNER_OPTS_CUSTOM -popd \ No newline at end of file diff --git a/scripts/test b/scripts/test index e93423bd..5a21e8d7 100755 --- a/scripts/test +++ b/scripts/test @@ -7,7 +7,7 @@ PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) pushd $PARENT_PATH # Run golint # NOTE: currently we are just printing lint violations, not failing the test if any errors are present -./scripts/lint +#./scripts/lint # Run integration tests # Run integration tests go get golang.org/x/tools/cmd/cover diff --git a/scripts/uninstall b/scripts/uninstall index d094e88d..69a6b97c 100755 --- a/scripts/uninstall +++ b/scripts/uninstall @@ -4,12 +4,12 @@ set -ex PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P)) -pushd $PARENT_PATH -rm -rf vendor -rm -rf $GOPATH/bin/abigen +pushd "$PARENT_PATH" +rm -rf "$GOPATH"/bin/abigen +rm -rf "$GOPATH"/bin/protoc-gen-go +rm -rf "$GOPATH"/bin/protoc-gen-go-grpc rm -rf resources/blockchain/node_modules rm -rf resources/blockchain/build -rm -rf resources/Agent.abi -rm -rf blockchain/agent.go +rm -rf blockchain/snet-contracts.go rm -rf build popd diff --git a/scripts/watcher_fsevents_cgo.go.patch b/scripts/watcher_fsevents_cgo.go.patch deleted file mode 100644 index 65580e6f..00000000 --- a/scripts/watcher_fsevents_cgo.go.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- /home/joel/Downloads/watcher_fsevents_cgo.go 2019-03-20 13:14:12.643748593 +1300 -+++ watcher_fsevents_cgo.go 2019-03-20 12:49:33.489170174 +1300 -@@ -48,7 +48,7 @@ - // started and is ready via the wg. It also serves purpose of a dummy source, - // thanks to it the runloop does not return as it also has at least one source - // registered. --var source = C.CFRunLoopSourceCreate(nil, 0, &C.CFRunLoopSourceContext{ -+var source = C.CFRunLoopSourceCreate(C.kCFAllocatorDefault, 0, &C.CFRunLoopSourceContext{ - perform: (C.CFRunLoopPerformCallBack)(C.gosource), - }) - -@@ -162,8 +162,8 @@ - return nil - } - wg.Wait() -- p := C.CFStringCreateWithCStringNoCopy(nil, C.CString(s.path), C.kCFStringEncodingUTF8, nil) -- path := C.CFArrayCreate(nil, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil) -+ p := C.CFStringCreateWithCStringNoCopy(C.kCFAllocatorDefault, C.CString(s.path), C.kCFStringEncodingUTF8, C.kCFAllocatorDefault) -+ path := C.CFArrayCreate(C.kCFAllocatorDefault, (*unsafe.Pointer)(unsafe.Pointer(&p)), 1, nil) - ctx := C.FSEventStreamContext{} - ref := C.EventStreamCreate(&ctx, C.uintptr_t(s.info), path, C.FSEventStreamEventId(atomic.LoadUint64(&since)), latency, flags) - if ref == nilstream { diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 2c57393e..00000000 --- a/sonar-project.properties +++ /dev/null @@ -1,8 +0,0 @@ -sonar.projectKey=singnet-snet-daemon -sonar.projectName=snet-daemon -sonar.projectVersion=${GIT_TAG_NAME} -sonar.sources=. -sonar.tests=. -sonar.test.inclusions=**/*_test.go,**/testdata/** -sonar.go.exclusions=**/vendor/**,**/*_mock.go,**.pb.go,*_test.go -sonar.go.coverage.reportPaths=coverage.out From fd6d36d101c4f91a31bddb32396535bb5a2d8103 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Wed, 24 Jul 2024 02:39:14 +0300 Subject: [PATCH 04/12] improve logging in serve.go --- snetd/cmd/serve.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/snetd/cmd/serve.go b/snetd/cmd/serve.go index e51ddeb4..e026c96f 100644 --- a/snetd/cmd/serve.go +++ b/snetd/cmd/serve.go @@ -121,7 +121,7 @@ func newDaemon(components *Components) (daemon, error) { if sslKey := config.GetString(config.SSLKeyPathKey); sslKey != "" { cert, err := tls.LoadX509KeyPair(config.GetString(config.SSLCertPathKey), sslKey) if err != nil { - return d, errors.Wrap(err, "unable to load specifiec SSL X509 keypair") + return d, errors.Wrap(err, "unable to load specific SSL X509 keypair") } d.sslCert = &cert } @@ -197,13 +197,11 @@ func (d *daemon) start() { return true })) httpHandler := http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { - zap.L().Info("httpHandler path: ", zap.String("path", req.URL.Path)) - zap.L().Info("input request", zap.Any("request", req)) + zap.L().Info("http request: ", zap.String("path", req.URL.Path), zap.String("method", req.Method)) resp.Header().Set("Access-Control-Allow-Origin", "*") if grpcWebServer.IsGrpcWebRequest(req) || grpcWebServer.IsAcceptableGrpcCorsRequest(req) { + zap.L().Debug("GrpcWebRequest/IsAcceptableGrpcCorsRequest") grpcWebServer.ServeHTTP(resp, req) - zap.L().Info("IsGrpcWebRequest/IsAcceptableGrpcCorsRequest") - resp.Header().Set("Access-Control-Allow-Origin", "*") } else { switch strings.Split(req.URL.Path, "/")[1] { case "encoding": @@ -214,9 +212,9 @@ func (d *daemon) start() { http.NotFound(resp, req) } } - zap.L().Info("output headers:") + zap.L().Debug("output headers:") for key, values := range resp.Header() { - zap.L().Info("header", zap.String("key", key), zap.Strings("value", values)) + zap.L().Debug("header", zap.String("key", key), zap.Strings("value", values)) } }) From dbe52a89b75f9d136a23992a5dd9bbe5d3803660 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Thu, 25 Jul 2024 20:57:57 +0300 Subject: [PATCH 05/12] readme: update --- README.md | 8 ++++++-- handler/grpc.go | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 34f43ebe..8c1ba40c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # SingularityNET Daemon -![ci/cd build](https://github.com/singnet/snet-daemon/actions/workflows/build.yml/badge.svg) -[![Coverage Status](https://coveralls.io/repos/github/singnet/snet-daemon/badge.svg?branch=master)](https://coveralls.io/github/singnet/snet-daemon?branch=master) +![ci/cd build]( https://github.com/singnet/snet-daemon/actions/workflows/build.yml/badge.svg) +![ci/cd build]( https://github.com/singnet/snet-daemon/actions/workflows/test.yml/badge.svg) +[![Go Report Card](https://goreportcard.com/badge/github.com/singnet/snet-daemon?style=flat-square)](https://goreportcard.com/report/github.com/singnet/snet-daemon) +[![Coverage](https://coveralls.io/repos/github/singnet/snet-daemon/badge.svg?branch=master)](https://coveralls.io/github/singnet/snet-daemon?branch=master) +[![Releases](https://img.shields.io/github/release/singnet/snet-daemon/all.svg?style=flat-square)](https://github.com/singnet/snet-daemon/releases) +[![LICENSE](https://img.shields.io/github/license/singnet/snet-daemon.svg?style=flat-square)](https://github.com/singnet/snet-daemon/blob/main/LICENSE) Users interested in deploying SingularityNET services should use this daemon diff --git a/handler/grpc.go b/handler/grpc.go index b36591d9..8addedf0 100644 --- a/handler/grpc.go +++ b/handler/grpc.go @@ -222,8 +222,8 @@ func forwardServerToClient(src grpc.ServerStream, dst grpc.ClientStream) chan er // first message sent by the client and pass this on the regular service call //This is done to be able to make calls to support regular Service call + Dynamic pricing call if i == 0 { - //todo we need to think through to determine price for every call on stream calls - //will be handled when we support streaming and pricing across all clients in snet-platform + // todo we need to think through to determine price for every call on stream calls + // will be handled when we support streaming and pricing across all clients in snet-platform if wrappedStream, ok := src.(*WrapperServerStream); ok { f = (wrappedStream.OriginalRecvMsg()).(*codec.GrpcFrame) } else if err := src.RecvMsg(f); err != nil { From 4793c889b30bef58da91cf29a298639617a03e16 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Thu, 25 Jul 2024 23:59:08 +0300 Subject: [PATCH 06/12] Add powershell scripts (#8) * add ps scripts for build and install * refactor .gitignore --- .gitignore | 31 ++++++++++++++--------- scripts/build.ps1 | 53 ++++++++++++++++++++++++++++++++++++++++ scripts/install_deps.ps1 | 23 +++++++++++++++++ 3 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 scripts/build.ps1 create mode 100644 scripts/install_deps.ps1 diff --git a/.gitignore b/.gitignore index 8531d46e..54d435eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,32 @@ # idea cache .idea/ -# npm cache and configs +# npm cache +resources/blockchain/package-lock.json resources/blockchain/node_modules/ resources/blockchain/build/ snetd.db + +# configs snetd.config.json -/vendor/ -/build/ -resources/blockchain/package-lock.json -# Autogenerated sources +# autogenerated sources blockchain/snet-contracts.go *.pb.go +/vendor/ -# Binaries for programs and plugins +# binaries for programs and plugins +/build/ *.exe *.exe~ *.dll *.so *.dylib -# Test binary, build with `go test -c` +# test binary, build with `go test -c` *.test -# Output of the go coverage tool, specifically when used with LiteIDE +# output of the go coverage tool, specifically when used with LiteIDE *.out # vim temporary files @@ -32,9 +34,16 @@ blockchain/snet-contracts.go *.swp *.swo -# etcd server temporary directories +# etcd server directories storage-* -*.pem -*log data.etcd/ +*.tmp +*.etcd + +# certs and keys +*.pem + +# logs +*.log + diff --git a/scripts/build.ps1 b/scripts/build.ps1 new file mode 100644 index 00000000..70ba61bd --- /dev/null +++ b/scripts/build.ps1 @@ -0,0 +1,53 @@ +# Set strict mode +Set-StrictMode -Version Latest + +# Enable debug info in stdout +Set-PSDebug -Trace 2 + +# Get the parent path +$ParentPath = Split-Path (Split-Path $MyInvocation.MyCommand.Path) + +# Check for correct number of arguments +if ($args.Count -lt 3) { + Write-Host "Arguments expected are of the form and for the build script, as an example: '/scripts/build linux amd64 v.0.1.8'" + exit 1 +} + +# Change directory +Push-Location $ParentPath + +# Create build directory if not exists +$BuildDirectory = Join-Path $ParentPath "build" +if (-not (Test-Path $BuildDirectory)) { + New-Item -ItemType Directory -Path $BuildDirectory | Out-Null +} + +# Get current timestamp +$Now = Get-Date -Format "yyyy-MM-dd_HH:mm:ss" + +# Read blockchain network config +$NetworkJson = Get-Content (Join-Path $ParentPath "resources\blockchain_network_config.json") -Raw + +# Construct build name +$BuildName = "$($args[0])-$($args[1])-$($args[2])" + +# Get git hash +$GitHash = git rev-parse HEAD + +# Build with Go +$GOOS = $args[0] +$OutputFile = "snetd-$BuildName" + +if ($GOOS -eq "windows") { + $OutputFile += ".exe" +} + +go build -ldflags " +-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore +-X github.com/singnet/snet-daemon/config.sha1Revision=$GitHash +-X github.com/singnet/snet-daemon/config.versionTag=$($args[2]) +-X github.com/singnet/snet-daemon/config.buildTime=$Now +-X 'github.com/singnet/snet-daemon/config.networkIdNameMapping=$NetworkJson'" -o (Join-Path $BuildDirectory $OutputFile) "snetd/main.go" + +# Return to previous directory +Pop-Location diff --git a/scripts/install_deps.ps1 b/scripts/install_deps.ps1 new file mode 100644 index 00000000..d1febdcf --- /dev/null +++ b/scripts/install_deps.ps1 @@ -0,0 +1,23 @@ +# Enable error handling and command tracing +$ErrorActionPreference = "Stop" +$VerbosePreference = "Continue" + +# Enable debug info in stdout +Set-PSDebug -Trace 2 + +# Determine the parent directory of the script +$ScriptPath = $MyInvocation.MyCommand.Path +$ParentPath = Split-Path -Parent (Split-Path -Parent $ScriptPath) + +# Change to the parent directory +Push-Location -Path $ParentPath + +# Install the required Go tools +go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + +# Run go generate +go generate ./... + +# Return to the original directory +Pop-Location From 11a79fa6c515135bb82fd91056d3ed0c767e3d4a Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Fri, 26 Jul 2024 00:19:13 +0300 Subject: [PATCH 07/12] gofmt and fix misspell --- authutils/auth_service.go | 18 +++--- authutils/auth_service_test.go | 2 +- blockchain/orginzationMetadata.go | 10 ++-- config/configuration_schema_test.go | 11 ++-- configuration_service/broadcast_message.go | 23 ++++--- .../broadcast_message_test.go | 15 +++-- escrow/allowed_user_payment_handler.go | 2 +- escrow/income.go | 7 +-- escrow/lock.go | 6 +- escrow/payment_handler.go | 2 +- handler/interceptors.go | 2 +- license_server/license_api.go | 2 +- metrics/request_stats.go | 4 +- metrics/request_stats_test.go | 2 +- metrics/response_stats.go | 50 +++++++++------- metrics/response_stats_test.go | 60 +++++++++---------- pricing/fixed_method_pricing_test.go | 31 +++++----- pricing/price_type.go | 2 +- ratelimit/rateLimit.go | 1 - ratelimit/rateLimit_test.go | 8 +-- snetd/cmd/version_details.go | 19 +++--- 21 files changed, 132 insertions(+), 145 deletions(-) diff --git a/authutils/auth_service.go b/authutils/auth_service.go index c794e344..63a94f34 100755 --- a/authutils/auth_service.go +++ b/authutils/auth_service.go @@ -1,4 +1,4 @@ -// authutils package provides functions for all authentication and singature validation related operations +// Package authutils provides functions for all authentication and signature validation related operations package authutils import ( @@ -67,21 +67,21 @@ func GetSignerAddressFromMessage(message, signature []byte) (signer *common.Addr return &keyOwnerAddress, nil } -// Verify the signature done by given singer or not -// returns nil if signer indeed sign the message and singature proves it, if not throws an error +// VerifySigner Verify the signature done by given singer or not +// returns nil if signer indeed sign the message and signature proves it, if not throws an error func VerifySigner(message []byte, signature []byte, signer common.Address) error { signerFromMessage, err := GetSignerAddressFromMessage(message, signature) if err != nil { - zap.L().Error("Gering error from getSignerAddressFromMessage", zap.Error(err)) + zap.L().Error("error from getSignerAddressFromMessage", zap.Error(err)) return err } if signerFromMessage.String() == signer.String() { return nil } - return fmt.Errorf("Incorrect signer.") + return fmt.Errorf("incorrect signer") } -// Check if the block number passed is not more +- 5 from the latest block number on chain +// CompareWithLatestBlockNumber Check if the block number passed is not more +- 5 from the latest block number on chain func CompareWithLatestBlockNumber(blockNumberPassed *big.Int) error { latestBlockNumber, err := CurrentBlock() if err != nil { @@ -94,7 +94,7 @@ func CompareWithLatestBlockNumber(blockNumberPassed *big.Int) error { return nil } -// Check if the block number ( date on which the token was issued is not more than 1 month) +// CheckIfTokenHasExpired Check if the block number ( date on which the token was issued is not more than 1 month) func CheckIfTokenHasExpired(expiredBlock *big.Int) error { currentBlockNumber, err := CurrentBlock() if err != nil { @@ -107,7 +107,7 @@ func CheckIfTokenHasExpired(expiredBlock *big.Int) error { return nil } -// Get the current block number from on chain +// CurrentBlock Get the current block number from on chain func CurrentBlock() (*big.Int, error) { if ethClient, err := blockchain.GetEthereumClient(); err != nil { return nil, err @@ -122,7 +122,7 @@ func CurrentBlock() (*big.Int, error) { } } -// Check if the payment address/signer passed matches to what is present in the metadata +// VerifyAddress Check if the payment address/signer passed matches to what is present in the metadata func VerifyAddress(address common.Address, otherAddress common.Address) error { isSameAddress := otherAddress == address if !isSameAddress { diff --git a/authutils/auth_service_test.go b/authutils/auth_service_test.go index e74fa1d3..e2a10372 100644 --- a/authutils/auth_service_test.go +++ b/authutils/auth_service_test.go @@ -1,4 +1,4 @@ -// authutils package provides functions for all authentication and singature validation related operations +// authutils package provides functions for all authentication and signature validation related operations package authutils import ( diff --git a/blockchain/orginzationMetadata.go b/blockchain/orginzationMetadata.go index b8a54609..f30cbe78 100644 --- a/blockchain/orginzationMetadata.go +++ b/blockchain/orginzationMetadata.go @@ -103,18 +103,18 @@ func InitOrganizationMetaDataFromJson(jsonData string) (metaData *OrganizationMe metaData = new(OrganizationMetaData) err = json.Unmarshal([]byte(jsonData), &metaData) if err != nil { - zap.L().Error("Error in unmarshaling metadata json", zap.Error(err), zap.Any("jsondata", jsonData)) + zap.L().Error("Error in unmarshalling metadata json", zap.Error(err), zap.Any("jsondata", jsonData)) return nil, err } - //Check for mandatory validations + // Check for mandatory validations if err = setDerivedAttributes(metaData); err != nil { - zap.L().Error("Error in setting derived atrributes", zap.Error(err)) + zap.L().Error("Error in setting derived attributes", zap.Error(err)) return nil, err } if err = checkMandatoryFields(metaData); err != nil { - zap.L().Error("Error in check mdandatory fields", zap.Error(err)) + zap.L().Error("Error in check mandatory fields", zap.Error(err)) return nil, err } @@ -126,7 +126,7 @@ func checkMandatoryFields(metaData *OrganizationMetaData) (err error) { err = fmt.Errorf("Mandatory field : ETCD Client Endpoints are mising for the Group %v ", metaData.daemonGroup.GroupName) } if &metaData.recipientPaymentAddress == nil { - err = fmt.Errorf("Mandatory field : Recepient Address is missing for the Group %v ", metaData.daemonGroup.GroupName) + err = fmt.Errorf("Mandatory field : Recipient Address is missing for the Group %v ", metaData.daemonGroup.GroupName) } return } diff --git a/config/configuration_schema_test.go b/config/configuration_schema_test.go index 00e2af8f..a639cf8a 100644 --- a/config/configuration_schema_test.go +++ b/config/configuration_schema_test.go @@ -31,12 +31,11 @@ func Test_getLeafNodeKey(t *testing.T) { } func TestGetSchemaConfiguration(t *testing.T) { - schemaDetails,err := GetConfigurationSchema() - for _,element := range schemaDetails { - if (element.Name == "blockchain_network_selected") { - assert.Equal(t,element.DefaultValue,"local") + schemaDetails, err := GetConfigurationSchema() + for _, element := range schemaDetails { + if element.Name == "blockchain_network_selected" { + assert.Equal(t, element.DefaultValue, "local") } } - assert.Nil(t,err) + assert.Nil(t, err) } - diff --git a/configuration_service/broadcast_message.go b/configuration_service/broadcast_message.go index 80ccda48..a1322fd6 100644 --- a/configuration_service/broadcast_message.go +++ b/configuration_service/broadcast_message.go @@ -7,42 +7,39 @@ import ( type MessageBroadcaster struct { //Operator UI can trigger changes to the Daemon configuration or request the Daemon to stop/start processing requests will , // Hence we need a framework to receive this trigger and broadcast it to all the subscribers. - trigger chan int - quit chan int + trigger chan int + quit chan int subscribers []chan int //This will be used to make sure , we dont interfere with other threads - mutex sync.Mutex + mutex sync.Mutex } - func NewChannelBroadcaster() *MessageBroadcaster { broadcaster := &MessageBroadcaster{} - broadcaster.trigger = make(chan int,1) + broadcaster.trigger = make(chan int, 1) go broadcaster.Publish() return broadcaster } - -//Create a New Subscriber for this broadcaster message -//Interceptors or health checks can subscribe to this and react accordingly +// Create a New Subscriber for this broadcaster message +// Interceptors or health checks can subscribe to this and react accordingly func (broadcast *MessageBroadcaster) NewSubscriber() chan int { ch := make(chan int, 1) broadcast.mutex.Lock() defer broadcast.mutex.Unlock() if broadcast.subscribers == nil { - broadcast.subscribers = make([]chan int,0) + broadcast.subscribers = make([]chan int, 0) } broadcast.subscribers = append(broadcast.subscribers, ch) return ch } - -//Once a message is received, pass it down to all the subscribers +// Once a message is received, pass it down to all the subscribers func (broadcast *MessageBroadcaster) Publish() { for { //Wait for the message to trigger the broadcast - msg := <- broadcast.trigger + msg := <-broadcast.trigger broadcast.mutex.Lock() defer broadcast.mutex.Unlock() for _, subscriber := range broadcast.subscribers { @@ -51,4 +48,4 @@ func (broadcast *MessageBroadcaster) Publish() { } } -} \ No newline at end of file +} diff --git a/configuration_service/broadcast_message_test.go b/configuration_service/broadcast_message_test.go index 69d066cb..66ecfece 100644 --- a/configuration_service/broadcast_message_test.go +++ b/configuration_service/broadcast_message_test.go @@ -12,18 +12,17 @@ func TestNewChannelBroadcaster(t *testing.T) { func TestChannelBroadcaster_NewSubscriber(t *testing.T) { broadcaster := NewChannelBroadcaster() - assert.NotNil(t,broadcaster) + assert.NotNil(t, broadcaster) channel1 := broadcaster.NewSubscriber() channel2 := broadcaster.NewSubscriber() - assert.NotNil(t,channel1) - assert.NotNil(t,channel2) + assert.NotNil(t, channel1) + assert.NotNil(t, channel2) //Add a message to trigger broadcaster.trigger <- 1 - msg1 := <- channel1 - msg2 := <- channel2 - assert.Equal(t,1,msg1) + msg1 := <-channel1 + msg2 := <-channel2 + assert.Equal(t, 1, msg1) //Check if all the subscribers received the same message - assert.Equal(t,msg2,msg1) + assert.Equal(t, msg2, msg1) close(broadcaster.trigger) } - diff --git a/escrow/allowed_user_payment_handler.go b/escrow/allowed_user_payment_handler.go index 54d81c33..f8c26dff 100644 --- a/escrow/allowed_user_payment_handler.go +++ b/escrow/allowed_user_payment_handler.go @@ -17,7 +17,7 @@ func AllowedUserPaymentHandler() handler.PaymentHandler { } } -//clients should be oblivious to this handler +// clients should be oblivious to this handler func (h *allowedUserPaymentHandler) Type() (typ string) { return EscrowPaymentType } diff --git a/escrow/income.go b/escrow/income.go index 18a40e39..88c4b1ee 100644 --- a/escrow/income.go +++ b/escrow/income.go @@ -19,11 +19,11 @@ type IncomeData struct { GrpcContext *handler.GrpcStreamContext } -// IncomeValidator uses pricing information to check that call was payed +// IncomeValidator uses pricing information to check that call was paid // correctly by channel sender. This interface can be implemented differently -// depending on pricing policy. For instance one can verify that call is payed +// depending on pricing policy. For instance one can verify that call is paid // according to invoice. Each RPC method can have different price and so on. To -// implement this strategies additional information from gRPC context can be +// implement these strategies additional information from gRPC context can be // required. In such case it should be added into handler.GrpcStreamContext. type IncomeValidator interface { // Validate returns nil if validation is successful or correct PaymentError @@ -41,7 +41,6 @@ func NewIncomeValidator(pricing *pricing.PricingStrategy) (validator IncomeValid } func (validator *incomeValidator) Validate(data *IncomeData) (err error) { - //TO DO, the user request information from IncomeData needs to be passed here !!!! price, err := validator.priceStrategy.GetPrice(data.GrpcContext) if err != nil { return err diff --git a/escrow/lock.go b/escrow/lock.go index f7eceefa..5819d761 100644 --- a/escrow/lock.go +++ b/escrow/lock.go @@ -5,15 +5,15 @@ import ( "go.uber.org/zap" ) -// Lock is an aquired lock. +// Lock is an acquired lock. type Lock interface { // Unlock frees lock Unlock() (err error) } -// Locker is an interface to aquire lock +// Locker is an interface to acquire lock type Locker interface { - // Lock aquires and returns lock. ok is false if lock cannot be aquired. + // Lock acquires and returns lock. ok is false if lock cannot be acquired. Lock(name string) (lock Lock, ok bool, err error) } diff --git a/escrow/payment_handler.go b/escrow/payment_handler.go index 8b68d91b..0ad64c04 100644 --- a/escrow/payment_handler.go +++ b/escrow/payment_handler.go @@ -27,7 +27,7 @@ type paymentChannelPaymentHandler struct { incomeValidator IncomeValidator } -// NewPaymentHandler retuns new MultiPartyEscrow contract payment handler. +// NewPaymentHandler returns new MultiPartyEscrow contract payment handler. func NewPaymentHandler( service PaymentChannelService, processor *blockchain.Processor, diff --git a/handler/interceptors.go b/handler/interceptors.go index 5633eaac..dc5e2cb7 100644 --- a/handler/interceptors.go +++ b/handler/interceptors.go @@ -92,7 +92,7 @@ type Payment any // Custom gRPC codes to return to the client const ( - // IncorrectNonce is returned to client when payment recieved contains + // IncorrectNonce is returned to client when payment received contains // incorrect nonce value. Client may use PaymentChannelStateService to get // latest channel state and correct nonce value. IncorrectNonce codes.Code = 1000 diff --git a/license_server/license_api.go b/license_server/license_api.go index 382a6b7a..9302ceb5 100644 --- a/license_server/license_api.go +++ b/license_server/license_api.go @@ -22,7 +22,7 @@ type LicenseTransaction interface { Rollback() error } -//this is used to track the license Usage +// this is used to track the license Usage type licenseUsageTrackerTransactionImpl struct { channelId *big.Int usage Usage diff --git a/metrics/request_stats.go b/metrics/request_stats.go index 83e8cbac..cf24dca7 100644 --- a/metrics/request_stats.go +++ b/metrics/request_stats.go @@ -6,7 +6,7 @@ import ( "strconv" ) -//Request stats that will be captured +// Request stats that will be captured type RequestStats struct { Type string `json:"type"` RegistryAddressKey string `json:"registry_address_key"` @@ -26,8 +26,6 @@ type RequestStats struct { ChannelId string `json:"channel_id"` } - - func (request *RequestStats) setDataFromContext(md metadata.MD) { request.InputDataSize = strconv.FormatUint(GetSize(md), 10) diff --git a/metrics/request_stats_test.go b/metrics/request_stats_test.go index 25d6dfca..f7dddaaf 100644 --- a/metrics/request_stats_test.go +++ b/metrics/request_stats_test.go @@ -20,7 +20,7 @@ func TestCreateRequestStat(t *testing.T) { commonStat.ClientType = "snet-cli" commonStat.UserDetails = "0x94d04332C4f5273feF69c4a52D24f42a3aF1F207" commonStat.UserAgent = "python/cli" - commonStat.ChannelId = "2" + commonStat.ChannelId = "2" request := createRequestStat(commonStat) assert.Equal(t, request.RequestID, commonStat.ID) assert.Equal(t, request.GroupID, daemonGroupId) diff --git a/metrics/response_stats.go b/metrics/response_stats.go index c30c3d43..bf4d132c 100644 --- a/metrics/response_stats.go +++ b/metrics/response_stats.go @@ -10,8 +10,9 @@ import ( ) const ( - timeFormat="2006-01-02 15:04:05.999999999" + timeFormat = "2006-01-02 15:04:05.999999999" ) + type CommonStats struct { ID string ServiceMethod string @@ -31,14 +32,15 @@ type CommonStats struct { } type ChannelStats struct { - OrganizationID string - ServiceID string - GroupID string - AuthorizedAmount *big.Int - FullAmount *big.Int - ChannelId *big.Int - Nonce *big.Int + OrganizationID string + ServiceID string + GroupID string + AuthorizedAmount *big.Int + FullAmount *big.Int + ChannelId *big.Int + Nonce *big.Int } + func BuildCommonStats(receivedTime time.Time, methodName string) *CommonStats { commonStats := &CommonStats{ ID: GenXid(), @@ -53,7 +55,7 @@ func BuildCommonStats(receivedTime time.Time, methodName string) *CommonStats { } -//Response stats that will be captured and published +// Response stats that will be captured and published type ResponseStats struct { Type string `json:"type"` RegistryAddressKey string `json:"registry_address_key"` @@ -85,15 +87,15 @@ type ResponseStats struct { UserAddress string `json:"user_address"` } -//Publish response received as a payload for reporting /metrics analysis -//If there is an error in the response received from the service, then send out a notification as well. +// Publish response received as a payload for reporting /metrics analysis +// If there is an error in the response received from the service, then send out a notification as well. func PublishResponseStats(commonStats *CommonStats, duration time.Duration, err error) bool { response := createResponseStats(commonStats, duration, err) - return Publish(response, config.GetString(config.MeteringEndPoint) + "/metering/usage",commonStats) + return Publish(response, config.GetString(config.MeteringEndPoint)+"/metering/usage", commonStats) } func createResponseStats(commonStat *CommonStats, duration time.Duration, err error) *ResponseStats { - currentTime := time.Now().UTC().Format(timeFormat) + currentTime := time.Now().UTC().Format(timeFormat) response := &ResponseStats{ Type: "response", @@ -114,21 +116,23 @@ func createResponseStats(commonStat *CommonStats, duration time.Duration, err er UserDetails: commonStat.UserDetails, UserAgent: commonStat.UserAgent, ChannelId: commonStat.ChannelId, - UserName:commonStat.UserName, - StartTime:commonStat.RequestReceivedTime, - EndTime:currentTime, - Status:getStatus(err), - UsageValue:1, - UsageType:"apicall", - Operation:"read", - PaymentMode:commonStat.PaymentMode, - UserAddress:commonStat.UserAddress, + UserName: commonStat.UserName, + StartTime: commonStat.RequestReceivedTime, + EndTime: currentTime, + Status: getStatus(err), + UsageValue: 1, + UsageType: "apicall", + Operation: "read", + PaymentMode: commonStat.PaymentMode, + UserAddress: commonStat.UserAddress, } return response } func getStatus(err error) string { - if err != nil {return "failed"} + if err != nil { + return "failed" + } return "success" } diff --git a/metrics/response_stats_test.go b/metrics/response_stats_test.go index 544bc705..f62974ea 100644 --- a/metrics/response_stats_test.go +++ b/metrics/response_stats_test.go @@ -17,7 +17,7 @@ func TestCreateResponseStats(t *testing.T) { commonStat.UserAgent = "python/cli" commonStat.ChannelId = "1" commonStat.PaymentMode = "freecall" - commonStat.UserAddress="0x94d04332C4f5273feF69c4a52D24f42a3aF1F207" + commonStat.UserAddress = "0x94d04332C4f5273feF69c4a52D24f42a3aF1F207" response := createResponseStats(commonStat, time.Duration(1234566000), nil) assert.Equal(t, response.RequestID, commonStat.ID) assert.Equal(t, response.Version, commonStat.Version) @@ -56,38 +56,36 @@ func TestJsonCreated(t *testing.T) { fmt.Println(zone, offset) payload := &ResponseStats{ - Type:"grpc", - ChannelId:"123", - - RegistryAddressKey:"", - EthereumJsonRpcEndpointKey:"", - RequestID:"", - OrganizationID:config.GetString(config.OrganizationId), - GroupID:"", - ServiceMethod:"", - ResponseSentTime:"", - RequestReceivedTime:"", - ResponseTime:"", - ResponseCode:"", - ErrorMessage:"", - Version:"", - ClientType:"", - UserDetails:"", - UserAgent:"", - UserName:"whateverDappPasses", - Operation:"", - UsageType:"", - Status:"", - StartTime:"", - EndTime:"", - UsageValue:1, - TimeZone:zone, - + Type: "grpc", + ChannelId: "123", + RegistryAddressKey: "", + EthereumJsonRpcEndpointKey: "", + RequestID: "", + OrganizationID: config.GetString(config.OrganizationId), + GroupID: "", + ServiceMethod: "", + ResponseSentTime: "", + RequestReceivedTime: "", + ResponseTime: "", + ResponseCode: "", + ErrorMessage: "", + Version: "", + ClientType: "", + UserDetails: "", + UserAgent: "", + UserName: "whateverDappPasses", + Operation: "", + UsageType: "", + Status: "", + StartTime: "", + EndTime: "", + UsageValue: 1, + TimeZone: zone, } jsonBytes, err := ConvertStructToJSON(payload) - assert.NotNil(t,jsonBytes) - assert.Contains(t,string(jsonBytes),"whateverDappPasses") - assert.Nil(t,err) + assert.NotNil(t, jsonBytes) + assert.Contains(t, string(jsonBytes), "whateverDappPasses") + assert.Nil(t, err) } diff --git a/pricing/fixed_method_pricing_test.go b/pricing/fixed_method_pricing_test.go index c42044ca..3bd985fc 100644 --- a/pricing/fixed_method_pricing_test.go +++ b/pricing/fixed_method_pricing_test.go @@ -13,28 +13,25 @@ import ( var testJsonDataFixedMethodPrice = "{ \"version\": 1, \"display_name\": \"Example1\", \"encoding\": \"grpc\", \"service_type\": \"grpc\", \"payment_expiration_threshold\": 40320, \"model_ipfs_hash\": \"Qmdiq8Hu6dYiwp712GtnbBxagyfYyvUY1HYqkH7iN76UCc\", \"mpe_address\": \"0x7E6366Fbe3bdfCE3C906667911FC5237Cc96BD08\", \"groups\": [ { \"endpoints\": [\"http://34.344.33.1:2379\",\"http://34.344.33.1:2389\"], \"group_id\": \"88ybRIg2wAx55mqVsA6sB4S7WxPQHNKqa4BPu/bhj+U=\",\"group_name\": \"default_group\", \"pricing\": [ { \"price_model\": \"fixed_price\", \"price_in_cogs\": 2 }, { \"package_name\": \"example_service\", \"price_model\": \"fixed_price_per_method\", \"default\":true, \"details\": [ { \"service_name\": \"Calculator\", \"method_pricing\": [ { \"method_name\": \"add\", \"price_in_cogs\": 2 }, { \"method_name\": \"sub\", \"price_in_cogs\": 1 }, { \"method_name\": \"div\", \"price_in_cogs\": 2 }, { \"method_name\": \"mul\", \"price_in_cogs\": 3 } ] }, { \"service_name\": \"Calculator2\", \"method_pricing\": [ { \"method_name\": \"add\", \"price_in_cogs\": 2 }, { \"method_name\": \"sub\", \"price_in_cogs\": 1 }, { \"method_name\": \"div\", \"price_in_cogs\": 3 }, { \"method_name\": \"mul\", \"price_in_cogs\": 2 } ] } ] }] }, { \"endpoints\": [\"http://97.344.33.1:2379\",\"http://67.344.33.1:2389\"], \"group_id\": \"99ybRIg2wAx55mqVsA6sB4S7WxPQHNKqa4BPu/bhj+U=\", \"pricing\": [ { \"package_name\": \"example_service\", \"price_model\": \"fixed_price_per_method\", \"details\": [ { \"service_name\": \"Calculator\", \"method_pricing\": [ { \"method_name\": \"add\", \"price_in_cogs\": 2 }, { \"method_name\": \"sub\", \"price_in_cogs\": 1 }, { \"method_name\": \"div\", \"price_in_cogs\": 2 }, { \"method_name\": \"mul\", \"price_in_cogs\": 3 } ] }, { \"service_name\": \"Calculator2\", \"method_pricing\": [ { \"method_name\": \"add\", \"price_in_cogs\": 2 }, { \"method_name\": \"sub\", \"price_in_cogs\": 1 }, { \"method_name\": \"div\", \"price_in_cogs\": 3 }, { \"method_name\": \"mul\", \"price_in_cogs\": 2 } ] } ] }] } ] } " - func TestFixedMethodPrice_initPricingData(t *testing.T) { - metadata,_ := blockchain.InitServiceMetaDataFromJson(testJsonDataFixedMethodPrice) - grpcCtx := &handler.GrpcStreamContext{Info:&grpc.StreamServerInfo{FullMethod:"/example_service.Calculator/add"}} - pricing,_ := InitPricingStrategy(metadata) - price,err := pricing.GetPrice(grpcCtx) - assert.Equal(t,price,big.NewInt(2)) - assert.Nil(t,err) + metadata, _ := blockchain.InitServiceMetaDataFromJson(testJsonDataFixedMethodPrice) + grpcCtx := &handler.GrpcStreamContext{Info: &grpc.StreamServerInfo{FullMethod: "/example_service.Calculator/add"}} + pricing, _ := InitPricingStrategy(metadata) + price, err := pricing.GetPrice(grpcCtx) + assert.Equal(t, price, big.NewInt(2)) + assert.Nil(t, err) //Test with an undefined method Name - grpcCtx.Info.FullMethod= "NonDefinedMethod" - price,err = pricing.GetPrice(grpcCtx) - assert.Nil(t,price) + grpcCtx.Info.FullMethod = "NonDefinedMethod" + price, err = pricing.GetPrice(grpcCtx) + assert.Nil(t, price) if err != nil { assert.Equal(t, err.Error(), "price is not defined for the Method NonDefinedMethod") } -/* //Test if the metadata is not properly defined - //metadata.GetDefaultPricing().Details = nil + /* //Test if the metadata is not properly defined + //metadata.GetDefaultPricing().Details = nil - pricing,err = InitPricingStrategy(metadata) - assert.Equal(t,err.Error(),"service / method level pricing is not defined correctly") - assert.Nil(t,pricing)*/ + pricing,err = InitPricingStrategy(metadata) + assert.Equal(t,err.Error(),"service / method level pricing is not defined correctly") + assert.Nil(t,pricing)*/ } - - diff --git a/pricing/price_type.go b/pricing/price_type.go index 2ffb42ea..32174b9f 100644 --- a/pricing/price_type.go +++ b/pricing/price_type.go @@ -11,7 +11,7 @@ const ( DYNAMIC_PRICING = "dynamic_pricing" ) -//Based on the request passed, a particular strategy will be picked up for processing +// Based on the request passed, a particular strategy will be picked up for processing type PriceType interface { //Based on the user input determine how will the price be determined diff --git a/ratelimit/rateLimit.go b/ratelimit/rateLimit.go index b52b1902..c8df3646 100644 --- a/ratelimit/rateLimit.go +++ b/ratelimit/rateLimit.go @@ -21,7 +21,6 @@ func NewRateLimiter() rate.Limiter { func getLimit() rate.Limit { - ratePerMin, err := strconv.ParseFloat(config.GetString(config.RateLimitPerMinute), 32) if err != nil { return rate.Inf diff --git a/ratelimit/rateLimit_test.go b/ratelimit/rateLimit_test.go index 588f399a..549b159c 100644 --- a/ratelimit/rateLimit_test.go +++ b/ratelimit/rateLimit_test.go @@ -2,11 +2,11 @@ package ratelimit import ( assert2 "github.com/stretchr/testify/assert" - "testing" "math" + "testing" ) -//TO DO , Add more test cases +// TO DO , Add more test cases func TestGetRateLimiter(t *testing.T) { limit := getLimit() assert2.NotEqual(t, nil, limit) @@ -14,5 +14,5 @@ func TestGetRateLimiter(t *testing.T) { func TestNewRateLimiter(t *testing.T) { rateLimit := NewRateLimiter() - assert2.Equal(t,rateLimit.Burst(),math.MaxInt32) -} \ No newline at end of file + assert2.Equal(t, rateLimit.Burst(), math.MaxInt32) +} diff --git a/snetd/cmd/version_details.go b/snetd/cmd/version_details.go index 7688fb42..3ab4b8f9 100644 --- a/snetd/cmd/version_details.go +++ b/snetd/cmd/version_details.go @@ -7,32 +7,29 @@ import ( "os" ) - -//Shows the current version of the Daemons -//Version tag: v0.1.4-181-g2fd9f04 was build on: 2019-03-19_13:52:58 with sha1 revision from github: 2fd9f04bfb279aaf66291cd6bd2ca734fd4f70b5 +// Shows the current version of the Daemons +// Version tag: v0.1.4-181-g2fd9f04 was build on: 2019-03-19_13:52:58 with sha1 revision from github: 2fd9f04bfb279aaf66291cd6bd2ca734fd4f70b5 var VersionCmd = &cobra.Command{ Use: "version", Short: "List the current version of the Daemon.", - Long: "To check the current version of the Daemon, the sha1 revision and the time the Binary was built User can use `snetd version`" , + Long: "To check the current version of the Daemon, the sha1 revision and the time the Binary was built User can use `snetd version`", RunE: func(cmd *cobra.Command, args []string) error { return RunAndCleanup(cmd, args, newListVersionCommand) }, } type ListVersionCommand struct { - } func newListVersionCommand(cmd *cobra.Command, args []string, components *Components) (command Command, err error) { - command = &ListVersionCommand { - } + command = &ListVersionCommand{} return } func (command *ListVersionCommand) Run() (err error) { - fmt.Printf("version tag: %s\n", config.GetVersionTag()) - fmt.Printf("built on: %s\n",config.GetBuildTime()) - fmt.Printf("sha1 revision: %s\n",config.GetSha1Revision()) - os.Exit(0) + fmt.Printf("version tag: %s\n", config.GetVersionTag()) + fmt.Printf("built on: %s\n", config.GetBuildTime()) + fmt.Printf("sha1 revision: %s\n", config.GetSha1Revision()) + os.Exit(0) return nil } From 29de91e4a1f20b3c90adfcb8365389b06802a691 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Fri, 26 Jul 2024 13:28:48 +0300 Subject: [PATCH 08/12] fix scripts and update readme --- README.md | 57 ++++++++++++++++++++++++++++++++---------- scripts/build | 10 +++++++- scripts/build.ps1 | 63 +++++++++++++++++++++++++++++------------------ 3 files changed, 92 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 8c1ba40c..39e01305 100644 --- a/README.md +++ b/README.md @@ -17,26 +17,34 @@ passthrough for making API calls to the service.The daemon is the endpoint a cli are then passed to the service after validation by the daemon. # Table of contents + 1. [Install and use](#use) 2. [Configuration](#configuration) 1. [Main properties](#main_properties) 2. [Additional properties](#other_properties) -3. [Channel Claim and other commands](#commands) +3. [Channel Claim and other commands](#commands) 4. [Build and development](#build) ## Install and use -Precompiled binaries are published with each release, download [from releases page](https://github.com/singnet/snet-daemon/releases) or use terminal: +Precompiled binaries are published with each release, +download [from releases page](https://github.com/singnet/snet-daemon/releases) or use terminal: + ```bash curl -LJO https://github.com/singnet/snet-daemon/releases/download/v5.1.4/snetd-linux-amd64-v5.1.4 chmod +x snetd-linux-amd64-v5.1.4 ``` + #### Generate basic config file + For most users, a simple config is enough: + ```bash ./snetd-linux-amd64-v5.1.4 init ``` -This command will generate a file `snetd.config.json` in which you will need to change [some parameters](#main_properties). + +This command will generate a file `snetd.config.json` in which you will need to +change [some parameters](#main_properties). #### Generate default full config file @@ -49,7 +57,9 @@ This command will generate a file `snetd.config.json` in which you will need to ```bash ./snetd-linux-amd64-v5.1.4 ``` + Specifying the path to the config using the '-c' argument: + ```bash ./snetd-linux-amd64-v5.1.4 -c name_of_config.json ``` @@ -83,7 +93,8 @@ time. Based on the network selected blockchain_network_selected the end point is auto determined Example `"https://sepolia.infura.io/v3"` for sepolia testnet. -* **blockchain_provider_api_key** (optional, default: `""`) - basic header authorization key for blockchain providers. Tested with +* **blockchain_provider_api_key** (optional, default: `""`) - basic header authorization key for blockchain providers. + Tested with [infura api key secret](https://docs.infura.io/dashboard/secure-an-api/api-key-secret). * **organization_id** (required) - @@ -272,7 +283,8 @@ confirmation from the treasurer on the blockchain. **Claim funds from the channel** -Refer to the link below on an end to end [Example of MPE](https://github.com/singnet/wiki/tree/master/multiPartyEscrowContract/front-to-back-examples) +Refer to the link below on an end to +end [Example of MPE](https://github.com/singnet/wiki/tree/master/multiPartyEscrowContract/front-to-back-examples) At the moment treasurer server is a part of snet-daemon command line interface. ```bash @@ -305,7 +317,7 @@ Flags: Use "snetd [command] --help" for more information about a command. ``` -## Build & Development +## Build & Development These instructions are intended to facilitate the development and testing of SingularityNET Daemon. @@ -325,25 +337,41 @@ git clone git@github.com:singnet/snet-daemon.git cd snet-daemon ``` -* Install dependencies and generate bindings +**Install dependencies and generate bindings** + +Bash ```bash -./scripts/install +./scripts/install_deps ``` -* Build snet-daemon. Please note using ldflags, the latest tagged version, sha1 revision and the build time are set as - part of the build. You need to pass the version as shown in the example below: +PowerShell + +```powershell +./scripts/install_deps.ps1 +``` + +**Build snet-daemon**. Please note using ldflags, the latest tagged version, sha1 revision and the build time are set as +part of the build. You need to pass the version as shown in the example below: ```bash ./scripts/build ``` - -Example: + +**Examples** + +Bash: ```bash ./scripts/build linux amd64 v5.1.4 ``` +Powershell: + +```powershell +./scripts/build.ps1 linux amd64 v5.1.4 +``` + The final binaries will be in the `/build` folder. #### Multi-compiling @@ -351,14 +379,17 @@ The final binaries will be in the `/build` folder. If you want to build daemon for several platforms, run `./scripts/build-all ` instead of `./scripts/build`. -You can edit the script to choose the specific platforms, but by default it will build for Linux, Darwin (OSX), and Windows. +You can edit the script to choose the specific platforms, but by default it will build for Linux, Darwin (OSX), and +Windows. #### Unit Testing ```bash ./scripts/test ``` + or + ```bash go test ./... ``` diff --git a/scripts/build b/scripts/build index cccddac7..d106fae1 100755 --- a/scripts/build +++ b/scripts/build @@ -1,6 +1,7 @@ #!/bin/bash -set -ex +# for debug: +# set -ex PARENT_PATH="$(dirname "$(cd "$("dirname" "$0")"; pwd -P)")" @@ -19,9 +20,14 @@ networkJson=$( and for the build script, as an example: '/scripts/build linux amd64 v.0.1.8'" exit 1 } -# Change directory +$GOOS = $args[0] # linux +$GOARCH = $args[1] # amd64 +$Version = $args[2] # v5.1.4 + +# change directory Push-Location $ParentPath -# Create build directory if not exists +# create build directory if not exists $BuildDirectory = Join-Path $ParentPath "build" -if (-not (Test-Path $BuildDirectory)) { +if (-not (Test-Path $BuildDirectory)) +{ New-Item -ItemType Directory -Path $BuildDirectory | Out-Null } -# Get current timestamp +# get current timestamp $Now = Get-Date -Format "yyyy-MM-dd_HH:mm:ss" -# Read blockchain network config +# reading blockchain config $NetworkJson = Get-Content (Join-Path $ParentPath "resources\blockchain_network_config.json") -Raw -# Construct build name -$BuildName = "$($args[0])-$($args[1])-$($args[2])" +# removing unnecessary symbols +$NetworkJson = $NetworkJson -replace ' ', '' +$NetworkJson = $NetworkJson -replace '\n', '' +$NetworkJson = $NetworkJson -replace '\r', '' +$NetworkJson = $NetworkJson -replace '\t', '' +Write-Output "Network config passed to daemon:" +Write-Output $NetworkJson -# Get git hash -$GitHash = git rev-parse HEAD +# construct build name +$BuildName = 'snetd-{0}-{1}-{2}' -f $GOOS, $GOARCH, $Version -# Build with Go -$GOOS = $args[0] -$OutputFile = "snetd-$BuildName" +# get git hash +$GitHash = git rev-parse HEAD -if ($GOOS -eq "windows") { - $OutputFile += ".exe" +# add .exe for windows +if ($GOOS -eq "windows") +{ + $BuildName += ".exe" } -go build -ldflags " +# build with Go +$Env:GOOS = $GOOS; $Env:GOARCH = $GOARCH; go build -ldflags " -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore -X github.com/singnet/snet-daemon/config.sha1Revision=$GitHash --X github.com/singnet/snet-daemon/config.versionTag=$($args[2]) +-X github.com/singnet/snet-daemon/config.versionTag=$Version -X github.com/singnet/snet-daemon/config.buildTime=$Now --X 'github.com/singnet/snet-daemon/config.networkIdNameMapping=$NetworkJson'" -o (Join-Path $BuildDirectory $OutputFile) "snetd/main.go" +-X 'github.com/singnet/snet-daemon/config.networkIdNameMapping=$NetworkJson'" -o (Join-Path $BuildDirectory $BuildName) snetd/main.go -# Return to previous directory +# return to previous directory Pop-Location + +Write-Output "✅ The daemon has been successfully compiled to:"(Join-Path $BuildDirectory $BuildName) \ No newline at end of file From 16fca30ed6bb999fecfdc8171e87db6e8631a35b Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Fri, 26 Jul 2024 13:49:15 +0300 Subject: [PATCH 09/12] ci/cd: refactor --- .github/workflows/build.yml | 24 +++++++++--------------- .github/workflows/test.yml | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d687cc86..9debafa3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,25 +22,19 @@ jobs: with: go-version: '1.22.5' - - name: protobuff install + - name: install protobuf run: | sudo apt update sudo apt install protobuf-compiler - - name: go_ins_1 - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest + - name: install dependencies + run: ./scripts/install_deps - - name: go_ins_2 - run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + - name: build linux + run: ./scripts/build linux amd64 dev - - name: generate - run: go generate ./... + - name: build darwin + run: ./scripts/build darwin amd64 dev - - name: check version - run: go version - - - name: check folder - run: ls - - - name: do build - run: go build snetd/main.go + - name: build windows + run: ./scripts/build windows amd64 dev diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ee26904..a909bca1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: with: go-version: '1.22.5' - - name: protobuff install + - name: install protobuf run: | sudo apt update sudo apt install protobuf-compiler From 4d9e1037764049919d59ee0cd382303299bf3547 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Fri, 26 Jul 2024 17:02:11 +0300 Subject: [PATCH 10/12] ci/cd: refactor (#9) update protoc, use internal bash scripts --- .github/workflows/build.yml | 14 +++++++++----- .github/workflows/test.yml | 31 +++++++++++-------------------- scripts/build_all_platforms | 0 scripts/install_deps | 0 4 files changed, 20 insertions(+), 25 deletions(-) mode change 100644 => 100755 scripts/build_all_platforms mode change 100644 => 100755 scripts/install_deps diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9debafa3..55042ed6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ env: GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore jobs: - run_build: + build: runs-on: ubuntu-latest steps: @@ -22,10 +22,14 @@ jobs: with: go-version: '1.22.5' - - name: install protobuf - run: | - sudo apt update - sudo apt install protobuf-compiler + - name: install protoc (protobuf) + uses: arduino/setup-protoc@v3 + with: + version: v27.2 + include-pre-releases: false + + - name: chmod +x + run: chmod +x ./scripts/install_deps && chmod +x ./scripts/build - name: install dependencies run: ./scripts/install_deps diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a909bca1..c63d5abb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,10 +10,9 @@ env: GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore jobs: - run_tests: + tests: runs-on: ubuntu-latest steps: - - name: clone repo uses: actions/checkout@v3 @@ -22,25 +21,17 @@ jobs: with: go-version: '1.22.5' - - name: install protobuf - run: | - sudo apt update - sudo apt install protobuf-compiler - - - name: go_ins_1 - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest - - - name: go_ins_2 - run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest - - - name: generate - run: go generate ./... + - name: install protoc (protobuf) + uses: arduino/setup-protoc@v3 + with: + version: v27.2 + include-pre-releases: false - - name: check version - run: go version + - name: chmod to allow run script + run: chmod +x ./scripts/install_deps - - name: check folder - run: ls + - name: install dependencies + run: ./scripts/install_deps - - name: do tests + - name: go tests run: go test -v ./... diff --git a/scripts/build_all_platforms b/scripts/build_all_platforms old mode 100644 new mode 100755 diff --git a/scripts/install_deps b/scripts/install_deps old mode 100644 new mode 100755 From 7c750b2eff2b10683255b08aead77b502768f249 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Fri, 9 Aug 2024 15:23:45 +0300 Subject: [PATCH 11/12] better logging and CGO_ENABLED=0 for builds --- blockchain/serviceMetadata.go | 4 ++-- etcddb/etcddb_client.go | 4 ++-- etcddb/etcddb_conf.go | 5 ++--- go.mod | 16 ++++++++-------- go.sum | 18 ++++++++++++++++++ handler/grpc.go | 8 ++++++-- scripts/build | 2 +- scripts/build.ps1 | 2 +- scripts/install_deps.ps1 | 8 +++++++- 9 files changed, 47 insertions(+), 20 deletions(-) diff --git a/blockchain/serviceMetadata.go b/blockchain/serviceMetadata.go index 31b5ab74..ea18972c 100644 --- a/blockchain/serviceMetadata.go +++ b/blockchain/serviceMetadata.go @@ -253,12 +253,12 @@ func ServiceMetaData() *ServiceMetadata { ipfsHash := string(getServiceMetaDataUrifromRegistry()) metadata, err = GetServiceMetaDataFromIPFS(FormatHash(ipfsHash)) if err != nil { - zap.L().Panic("error on determining service metadata from file", zap.Error(err)) } } else { metadata = &ServiceMetadata{Encoding: "proto", ServiceType: "grpc"} } + zap.L().Debug("service_type: " + metadata.GetServiceType()) return metadata } @@ -491,7 +491,7 @@ func setServiceProto(metaData *ServiceMetadata) (err error) { for _, file := range protoFiles { zap.L().Debug("Protofile", zap.String("file", file)) - //If Dynamic pricing is enabled ,there will be mandatory checks on the service proto + // If Dynamic pricing is enabled, there will be mandatory checks on the service proto //this is to ensure that the standards on how one defines the methods to invoke is followed if config.GetBool(config.EnableDynamicPricing) { if srvProto, err := parseServiceProto(file); err != nil { diff --git a/etcddb/etcddb_client.go b/etcddb/etcddb_client.go index 529f9ea4..2b5c88ef 100644 --- a/etcddb/etcddb_client.go +++ b/etcddb/etcddb_client.go @@ -66,7 +66,7 @@ func NewEtcdClientFromVip(vip *viper.Viper, metaData *blockchain.OrganizationMet if utils.CheckIfHttps(metaData.GetPaymentStorageEndPoints()) { if tlsConfig, err := getTlsConfig(); err == nil { etcdv3, err = clientv3.New(clientv3.Config{ - Endpoints: metaData.GetPaymentStorageEndPoints(), + Endpoints: conf.Endpoints, DialTimeout: conf.ConnectionTimeout, TLS: tlsConfig, }) @@ -77,7 +77,7 @@ func NewEtcdClientFromVip(vip *viper.Viper, metaData *blockchain.OrganizationMet } else { //Regular http call etcdv3, err = clientv3.New(clientv3.Config{ - Endpoints: metaData.GetPaymentStorageEndPoints(), + Endpoints: conf.Endpoints, DialTimeout: conf.ConnectionTimeout, }) if err != nil { diff --git a/etcddb/etcddb_conf.go b/etcddb/etcddb_conf.go index 1414385a..653ec338 100644 --- a/etcddb/etcddb_conf.go +++ b/etcddb/etcddb_conf.go @@ -19,10 +19,9 @@ type EtcdClientConf struct { Endpoints []string } -// GetEtcdClientConf gets EtcdServerConf from viper +// GetEtcdClientConf returns EtcdClientConf from viper and ipfs metadata // The DefaultEtcdClientConf is used in case the PAYMENT_CHANNEL_STORAGE_CLIENT field -// is not set in the configuration file -// Left Vip, just in case we need to read something from configuration in the future +// if ConnectionTimeout or RequestTimeout are set in the config, they will be taken from there func GetEtcdClientConf(vip *viper.Viper, metaData *blockchain.OrganizationMetaData) (conf *EtcdClientConf, err error) { conf = &EtcdClientConf{ diff --git a/go.mod b/go.mod index 68348c06..64015900 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/rs/xid v1.5.0 github.com/singnet/snet-ecosystem-contracts v0.1.1 github.com/soheilhy/cmux v0.1.5 - github.com/spf13/cast v1.6.0 + github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 @@ -29,9 +29,9 @@ require ( go.etcd.io/etcd/client/v3 v3.5.15 go.etcd.io/etcd/server/v3 v3.5.15 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.25.0 - golang.org/x/net v0.27.0 - golang.org/x/time v0.5.0 + golang.org/x/crypto v0.26.0 + golang.org/x/net v0.28.0 + golang.org/x/time v0.6.0 google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.2.1 @@ -217,15 +217,15 @@ require ( go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/exp v0.0.0-20240707233637-46b078467d37 // indirect golang.org/x/mod v0.19.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.23.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto v0.0.0-20240722135656-d784300faade // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.3.0 // indirect diff --git a/go.sum b/go.sum index cb3904ea..728e1f43 100644 --- a/go.sum +++ b/go.sum @@ -891,6 +891,8 @@ 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/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= @@ -1067,6 +1069,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= 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= @@ -1141,6 +1145,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= 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= @@ -1157,6 +1163,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1216,6 +1224,10 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -1229,12 +1241,16 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 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/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= +golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1319,6 +1335,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade h1: google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade h1:oCRSWfwGXQsqlVdErcyTt4A93Y8fo0/9D4b1gnI++qo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= diff --git a/handler/grpc.go b/handler/grpc.go index 8addedf0..33d81fa7 100644 --- a/handler/grpc.go +++ b/handler/grpc.go @@ -321,7 +321,11 @@ func (g grpcHandler) grpcToHTTP(srv any, inStream grpc.ServerStream) error { } base.RawQuery = params.Encode() - zap.L().Debug("Calling URL", zap.String("Url", base.String())) + zap.L().Debug("Calling http service", + zap.String("url", base.String()), + zap.String("body", string(jsonBody)), + zap.String("method", "POST")) + httpReq, err := http.NewRequest("POST", base.String(), bytes.NewBuffer(jsonBody)) httpReq.Header = headers if err != nil { @@ -372,7 +376,7 @@ func jsonToProto(protoFile protoreflect.FileDescriptor, json []byte, methodName return proto } output := method.Output() - zap.L().Debug("output of calling method", zap.Any("method", output.FullName())) + zap.L().Debug("output msg descriptor", zap.Any("fullname", output.FullName())) proto = dynamicpb.NewMessage(output) err := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}.Unmarshal(json, proto) if err != nil { diff --git a/scripts/build b/scripts/build index d106fae1..6269370b 100755 --- a/scripts/build +++ b/scripts/build @@ -35,7 +35,7 @@ if [ "$1" == "windows" ] then buildname+=".exe" fi -GOOS=$1 GOARCH=$2 go build -ldflags " +CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags " -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore -X github.com/singnet/snet-daemon/config.sha1Revision=$githash -X github.com/singnet/snet-daemon/config.versionTag=$3 diff --git a/scripts/build.ps1 b/scripts/build.ps1 index abcb1be5..ba974563 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -55,7 +55,7 @@ if ($GOOS -eq "windows") } # build with Go -$Env:GOOS = $GOOS; $Env:GOARCH = $GOARCH; go build -ldflags " +$Env:CGO_ENABLED = 0; $Env:GOOS = $GOOS; $Env:GOARCH = $GOARCH; go build -ldflags " -X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore -X github.com/singnet/snet-daemon/config.sha1Revision=$GitHash -X github.com/singnet/snet-daemon/config.versionTag=$Version diff --git a/scripts/install_deps.ps1 b/scripts/install_deps.ps1 index d1febdcf..36dbccb7 100644 --- a/scripts/install_deps.ps1 +++ b/scripts/install_deps.ps1 @@ -3,7 +3,7 @@ $ErrorActionPreference = "Stop" $VerbosePreference = "Continue" # Enable debug info in stdout -Set-PSDebug -Trace 2 +#Set-PSDebug -Trace 2 # Determine the parent directory of the script $ScriptPath = $MyInvocation.MyCommand.Path @@ -12,10 +12,16 @@ $ParentPath = Split-Path -Parent (Split-Path -Parent $ScriptPath) # Change to the parent directory Push-Location -Path $ParentPath +Write-Output "Install the required Go tools:" +Write-Output "go install protoc-gen-go@latest" +Write-Output "go install protoc-gen-go-grpc@latest" + # Install the required Go tools go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest +Write-Output "go generate ./..." + # Run go generate go generate ./... From dad208e3abae125f5494dfc0ba9fe52f61c2719f Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Wed, 11 Sep 2024 16:18:08 +0300 Subject: [PATCH 12/12] refactoring and add linter config --- .golangci.yml | 52 ++++++ authutils/auth_service_test.go | 4 +- blockchain/ethereum_test_util.go | 34 ++-- blockchain/utils.go | 5 +- config/blockchain_network_config.go | 4 +- config/config.go | 4 +- config/configuration_schema.go | 1 - config/version.go | 3 +- configuration_service/broadcast_message.go | 11 +- .../configuration_service.go | 8 +- escrow/control_service.go | 6 +- escrow/escrow.go | 4 +- escrow/free_call.go | 4 +- escrow/payment_channel_storage.go | 3 +- escrow/prepaid_handler.go | 2 +- escrow/token_service.go | 2 +- etcddb/etcddb_client.go | 29 ++- go.mod | 81 ++++---- go.sum | 176 ++++++++---------- handler/grpc.go | 20 +- handler/httphandler/http.go | 4 +- handler/interceptors.go | 10 +- ipfsutils/ipfsutils.go | 19 +- license_server/license_storage.go | 8 +- logger/hook.go | 1 - metrics/clients.go | 3 +- metrics/utils.go | 1 - pricing/dynamic_method_pricing.go | 6 +- ratelimit/rateLimit.go | 10 +- storage/atomic_storage.go | 5 +- storage/memory_storage.go | 13 +- training/service.go | 10 +- utils/common.go | 2 +- 33 files changed, 285 insertions(+), 260 deletions(-) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..7d22e94c --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,52 @@ +# This file configures github.com/golangci/golangci-lint. + +run: + concurrency: 4 + timeout: 5m + tests: false + issues-exit-code: 3 + modules-download-mode: readonly + allow-parallel-runners: true + +linters: + disable-all: true + enable: + - gosimple + - govet + - ineffassign + - misspell + - unconvert + - typecheck + # - unused + - staticcheck + - bidichk + - durationcheck + - exportloopref + - whitespace + - revive # only certain checks enabled + +linters-settings: + gofmt: + simplify: true + revive: + enable-all-rules: false + # here we enable specific useful rules + # see https://golangci-lint.run/usage/linters/#revive for supported rules + rules: + - name: receiver-naming + severity: warning + disabled: false + exclude: [ "" ] + +issues: + exclude-dirs-use-default: true + exclude-dirs: + - bin + - build + - \.git + exclude-files: + - ".pb" + exclude-rules: + - linters: + - lll + source: "^//go:generate " \ No newline at end of file diff --git a/authutils/auth_service_test.go b/authutils/auth_service_test.go index e2a10372..cf5a57d9 100644 --- a/authutils/auth_service_test.go +++ b/authutils/auth_service_test.go @@ -4,6 +4,7 @@ package authutils import ( "math/big" "testing" + "time" "github.com/singnet/snet-daemon/config" "github.com/stretchr/testify/assert" @@ -28,9 +29,8 @@ func TestCheckAllowedBlockDifferenceForToken(t *testing.T) { currentBlockNum, _ := CurrentBlock() err := CheckIfTokenHasExpired(currentBlockNum.Sub(currentBlockNum, big.NewInt(20000))) assert.Equal(t, err.Error(), "authentication failed as the Free Call Token passed has expired") - + time.Sleep(250 * time.Millisecond) // because of HTTP 429 Too Many Requests currentBlockNum, _ = CurrentBlock() err = CheckIfTokenHasExpired(currentBlockNum.Add(currentBlockNum, big.NewInt(20))) assert.Equal(t, nil, err) - } diff --git a/blockchain/ethereum_test_util.go b/blockchain/ethereum_test_util.go index c25f52b2..2e23bfd9 100644 --- a/blockchain/ethereum_test_util.go +++ b/blockchain/ethereum_test_util.go @@ -3,12 +3,12 @@ package blockchain import ( "crypto/ecdsa" "fmt" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient/simulated" "math/big" "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" ) @@ -19,7 +19,7 @@ type SimulatedEthereumEnvironment struct { ClientPrivateKey *ecdsa.PrivateKey ServerWallet *bind.TransactOpts ServerPrivateKey *ecdsa.PrivateKey - Backend *backends.SimulatedBackend + Backend *simulated.Backend SingularityNetToken *SingularityNetToken MultiPartyEscrowAddress common.Address MultiPartyEscrow *MultiPartyEscrow @@ -63,40 +63,48 @@ func (env *SimulatedEthereumEnvironment) Commit() *SimulatedEthereumEnvironment } func GetSimulatedEthereumEnvironment() (env SimulatedEthereumEnvironment) { - env.SingnetPrivateKey, env.SingnetWallet = getTestWallet() - env.ClientPrivateKey, env.ClientWallet = getTestWallet() - env.ServerPrivateKey, env.ServerWallet = getTestWallet() + var chainID = big.NewInt(11155111) + env.SingnetPrivateKey, env.SingnetWallet, _ = getTestWallet(chainID) + env.ClientPrivateKey, env.ClientWallet, _ = getTestWallet(chainID) + env.ServerPrivateKey, env.ServerWallet, _ = getTestWallet(chainID) - alloc := map[common.Address]core.GenesisAccount{ + alloc := map[common.Address]types.Account{ env.SingnetWallet.From: {Balance: big.NewInt(1000000000000)}, env.ClientWallet.From: {Balance: big.NewInt(1000000000000)}, env.ServerWallet.From: {Balance: big.NewInt(10000000)}, } - env.Backend = backends.NewSimulatedBackend(alloc, 0) + b := simulated.NewBackend(alloc, simulated.WithBlockGasLimit(0)) + + env.Backend = b deployContracts(&env) return } -func getTestWallet() (privateKey *ecdsa.PrivateKey, wallet *bind.TransactOpts) { - privateKey, err := crypto.GenerateKey() +func getTestWallet(chainID *big.Int) (privateKey *ecdsa.PrivateKey, wallet *bind.TransactOpts, err error) { + privateKey, err = crypto.GenerateKey() if err != nil { panic(fmt.Sprintf("Unable to generate private key, error: %v", err)) } - return privateKey, bind.NewKeyedTransactor(privateKey) + wallet, err = bind.NewKeyedTransactorWithChainID(privateKey, chainID) + if err != nil { + return nil, nil, err + } + + return privateKey, wallet, err } func deployContracts(env *SimulatedEthereumEnvironment) { - tokenAddress, _, token, err := DeploySingularityNetToken(EstimateGas(env.SingnetWallet), env.Backend, "SingularityNet Token", "AGI") + tokenAddress, _, token, err := DeploySingularityNetToken(EstimateGas(env.SingnetWallet), env.Backend.Client(), "SingularityNet Token", "AGI") if err != nil { panic(fmt.Sprintf("Unable to deploy SingularityNetToken contract, error: %v", err)) } env.Backend.Commit() env.SingularityNetToken = token - mpeAddress, _, mpe, err := DeployMultiPartyEscrow(EstimateGas(env.SingnetWallet), env.Backend, tokenAddress) + mpeAddress, _, mpe, err := DeployMultiPartyEscrow(EstimateGas(env.SingnetWallet), env.Backend.Client(), tokenAddress) if err != nil { panic(fmt.Sprintf("Unable to deploy MultiPartyEscrow contract, error: %v", err)) } diff --git a/blockchain/utils.go b/blockchain/utils.go index eba3974b..7bca8a61 100644 --- a/blockchain/utils.go +++ b/blockchain/utils.go @@ -43,13 +43,12 @@ func HexToBytes(str string) []byte { // HexToAddress converts hex string to Ethreum address. func HexToAddress(str string) common.Address { - return common.Address(common.BytesToAddress(HexToBytes(str))) + return common.BytesToAddress(HexToBytes(str)) } func StringToBytes32(str string) [32]byte { - var byte32 [32]byte - copy(byte32[:], []byte(str)) + copy(byte32[:], str) return byte32 } diff --git a/config/blockchain_network_config.go b/config/blockchain_network_config.go index cd2f37d7..92c30ea5 100644 --- a/config/blockchain_network_config.go +++ b/config/blockchain_network_config.go @@ -73,8 +73,7 @@ func GetRegistryAddress() string { // Read the Registry address from JSON file passed func setRegistryAddress() (err error) { - - //if address is already set in the config file and has been initialized , then skip the setting process + //if the address is already set in the config file and has been initialized, then skip the setting process if len(networkSelected.RegistryAddressKey) > 0 { return } @@ -125,7 +124,6 @@ func ReadFromFile(filename string) ([]byte, error) { } } return file, nil - } // Read from the blockchain network config json diff --git a/config/config.go b/config/config.go index c88942dc..802f5caa 100644 --- a/config/config.go +++ b/config/config.go @@ -406,11 +406,11 @@ func ValidateEmail(email string) bool { } func ValidateEndpoints(daemonEndpoint string, passthroughEndpoint string) error { - passthroughURL, err := url.Parse(passthroughEndpoint) if err != nil || passthroughURL.Host == "" { return errors.New("passthrough_endpoint is the endpoint of your AI service in the daemon config and needs to be a valid url.") } + daemonHost, daemonPort, err := net.SplitHostPort(daemonEndpoint) if err != nil { return errors.New("couldn't split host:post of daemon endpoint") @@ -443,7 +443,7 @@ func IsAllowedUser(address *common.Address) bool { // Set the list of allowed users func SetAllowedUsers() (err error) { users := vip.GetStringSlice(AllowedUserAddresses) - if users == nil || len(users) == 0 { + if len(users) == 0 { return fmt.Errorf("a valid Address needs to be specified for the config %v to ensure that, only these users can make calls", AllowedUserAddresses) } userAddress = make([]common.Address, len(users)) diff --git a/config/configuration_schema.go b/config/configuration_schema.go index 505dcf1c..16c78a62 100644 --- a/config/configuration_schema.go +++ b/config/configuration_schema.go @@ -87,7 +87,6 @@ func GetConfigurationSchema() ([]ConfigurationDetails, error) { _ = json.Unmarshal(configurationDetailsJSON, configDetails) allConfigurations = append(allConfigurations, *configDetails) } - } return allConfigurations, nil } diff --git a/config/version.go b/config/version.go index d76f6a02..08bea229 100644 --- a/config/version.go +++ b/config/version.go @@ -2,7 +2,6 @@ package config import ( "encoding/json" - "errors" "fmt" "io" "net/http" @@ -39,7 +38,7 @@ func CheckVersionOfDaemon() (message string, err error) { latestVersionFromGit, err = GetLatestDaemonVersion() if len(versionTag) > 0 && err == nil { if strings.Compare(latestVersionFromGit, versionTag) != 0 { - err = errors.New(fmt.Sprintf("There is a newer version of the Daemon %v available. You are currently on %v, please consider upgrading.", latestVersionFromGit, versionTag)) + err = fmt.Errorf("there is a newer version of the Daemon %v available. You are currently on %v, please consider upgrading", latestVersionFromGit, versionTag) } } return message, err diff --git a/configuration_service/broadcast_message.go b/configuration_service/broadcast_message.go index a1322fd6..3d8164af 100644 --- a/configuration_service/broadcast_message.go +++ b/configuration_service/broadcast_message.go @@ -10,7 +10,7 @@ type MessageBroadcaster struct { trigger chan int quit chan int subscribers []chan int - //This will be used to make sure , we dont interfere with other threads + //This will be used to make sure, we don't interfere with other threads mutex sync.Mutex } @@ -35,17 +35,16 @@ func (broadcast *MessageBroadcaster) NewSubscriber() chan int { return ch } -// Once a message is received, pass it down to all the subscribers +// Publish - Once a message is received, pass it down to all the subscribers func (broadcast *MessageBroadcaster) Publish() { for { - //Wait for the message to trigger the broadcast + // Wait for the message to trigger the broadcast msg := <-broadcast.trigger broadcast.mutex.Lock() - defer broadcast.mutex.Unlock() for _, subscriber := range broadcast.subscribers { - //Now broad the message to all the subscribers. + // Now broad the message to all the subscribers. subscriber <- msg } - + broadcast.mutex.Unlock() } } diff --git a/configuration_service/configuration_service.go b/configuration_service/configuration_service.go index daf8a247..3a7479e0 100644 --- a/configuration_service/configuration_service.go +++ b/configuration_service/configuration_service.go @@ -38,15 +38,15 @@ const ( func getAuthenticationAddress() []common.Address { users := config.Vip().GetStringSlice(config.AuthenticationAddresses) userAddress := make([]common.Address, 0) - if users == nil || len(users) == 0 { + if len(users) == 0 { return userAddress } for _, user := range users { if !common.IsHexAddress(user) { - fmt.Errorf("%v is not a valid hex address", user) - } else { - userAddress = append(userAddress, common.BytesToAddress(common.FromHex(user))) + zap.L().Warn("not a valid hex address in config."+config.AuthenticationAddresses, zap.String("address", user)) + continue } + userAddress = append(userAddress, common.BytesToAddress(common.FromHex(user))) } return userAddress } diff --git a/escrow/control_service.go b/escrow/control_service.go index 333bf250..7225940f 100644 --- a/escrow/control_service.go +++ b/escrow/control_service.go @@ -98,7 +98,6 @@ If an error is encountered , then we return back whatever was successful and sto and return the error that was encountered. */ func (service *ProviderControlService) StartClaimForMultipleChannels(ctx context.Context, request *StartMultipleClaimRequest) (reply *PaymentsListReply, err error) { - if err := service.checkMpeAddress(request.GetMpeAddress()); err != nil { return nil, err } @@ -148,13 +147,10 @@ func (service *ProviderControlService) verifySignerForStartClaimForMultipleChann func getBytesOfChannelIds(request *StartMultipleClaimRequest) []byte { channelIds := make([]uint64, 0) - for _, channelId := range request.GetChannelIds() { - channelIds = append(channelIds, channelId) - } + channelIds = append(channelIds, request.GetChannelIds()...) //sort the channel Ids Uint64s(channelIds) channelIdInBytes := make([]byte, 0) - for index, channelId := range channelIds { if index == 0 { channelIdInBytes = bytes.Join([][]byte{ diff --git a/escrow/escrow.go b/escrow/escrow.go index 5e043ad4..5f941024 100644 --- a/escrow/escrow.go +++ b/escrow/escrow.go @@ -50,8 +50,8 @@ func (h *lockingPaymentChannelService) PaymentChannel(key *PaymentChannelKey) (c blockchainChannel, blockchainOk, err := h.blockchainReader.GetChannelStateFromBlockchain(key) if !storageOk { - // Group ID check is only done for the first time , when the channel is added to storage from the block chain , - //if the channel is already present in the storage the group ID check is skipped. + // Group ID check is only done for the first time, when the channel is added to storage from the blockchain, + // if the channel is already present in the storage the group ID check is skipped. if blockchainChannel != nil { blockChainGroupID, err := h.replicaGroupID() if err = h.verifyGroupId(blockChainGroupID, blockchainChannel.GroupID); err != nil { diff --git a/escrow/free_call.go b/escrow/free_call.go index ecf101c4..7896bd24 100644 --- a/escrow/free_call.go +++ b/escrow/free_call.go @@ -150,7 +150,7 @@ func (transaction *freeCallTransaction) Commit() error { return nil } -func (payment *freeCallTransaction) Rollback() error { +func (transaction *freeCallTransaction) Rollback() error { defer func(payment *freeCallTransaction) { err := payment.lock.Unlock() if err != nil { @@ -159,6 +159,6 @@ func (payment *freeCallTransaction) Rollback() error { } else { zap.L().Debug("Free call Payment rolled back, free call user unlocked") } - }(payment) + }(transaction) return nil } diff --git a/escrow/payment_channel_storage.go b/escrow/payment_channel_storage.go index e402e9e2..bddd78bb 100644 --- a/escrow/payment_channel_storage.go +++ b/escrow/payment_channel_storage.go @@ -44,8 +44,7 @@ func serialize(value any) (slice string, err error) { return } - slice = string(b.Bytes()) - return + return b.String(), err } func deserialize(slice string, value any) (err error) { diff --git a/escrow/prepaid_handler.go b/escrow/prepaid_handler.go index 40df2439..d100e84d 100644 --- a/escrow/prepaid_handler.go +++ b/escrow/prepaid_handler.go @@ -34,7 +34,7 @@ type PrePaidPaymentHandler struct { func (validator *PrePaidPaymentValidator) Validate(payment *PrePaidPayment) (err error) { //Validate the token - return validator.tokenManager.VerifyToken(string(payment.AuthToken), payment.ChannelID) + return validator.tokenManager.VerifyToken(payment.AuthToken, payment.ChannelID) } // NewPaymentHandler returns new MultiPartyEscrow contract payment handler. diff --git a/escrow/token_service.go b/escrow/token_service.go index 68dfdb49..5cf7e630 100644 --- a/escrow/token_service.go +++ b/escrow/token_service.go @@ -164,5 +164,5 @@ func (service *TokenService) GetToken(ctx context.Context, request *TokenRequest } tokenGenerated, err := service.tokenManager.CreateToken(channelID) return &TokenReply{ChannelId: request.ChannelId, Token: fmt.Sprintf("%v", tokenGenerated), PlannedAmount: plannedAmount.Amount.Uint64(), - UsedAmount: usageAmount.Uint64()}, nil + UsedAmount: usageAmount.Uint64()}, err } diff --git a/etcddb/etcddb_client.go b/etcddb/etcddb_client.go index 2b5c88ef..f36473dc 100644 --- a/etcddb/etcddb_client.go +++ b/etcddb/etcddb_client.go @@ -35,7 +35,7 @@ func (mutex *EtcdClientMutex) Unlock(ctx context.Context) (err error) { return mutex.mutex.Unlock(ctx) } -// EtcdClient struct has some useful methods to wolrk with etcd client +// EtcdClient struct has some useful methods to work with an etcd client type EtcdClient struct { timeout time.Duration session *concurrency.Session @@ -64,25 +64,25 @@ func NewEtcdClientFromVip(vip *viper.Viper, metaData *blockchain.OrganizationMet var etcdv3 *clientv3.Client if utils.CheckIfHttps(metaData.GetPaymentStorageEndPoints()) { - if tlsConfig, err := getTlsConfig(); err == nil { - etcdv3, err = clientv3.New(clientv3.Config{ - Endpoints: conf.Endpoints, - DialTimeout: conf.ConnectionTimeout, - TLS: tlsConfig, - }) - } else { + tlsConfig, err := getTlsConfig() + if err != nil { return nil, err } - + etcdv3, err = clientv3.New(clientv3.Config{ + Endpoints: conf.Endpoints, + DialTimeout: conf.ConnectionTimeout, + TLS: tlsConfig, + }) } else { - //Regular http call + // Regular http call etcdv3, err = clientv3.New(clientv3.Config{ Endpoints: conf.Endpoints, DialTimeout: conf.ConnectionTimeout, }) - if err != nil { - return nil, err - } + } + + if err != nil { + return nil, err } ctx, cancel := context.WithTimeout(context.Background(), conf.RequestTimeout) @@ -101,7 +101,6 @@ func NewEtcdClientFromVip(vip *viper.Viper, metaData *blockchain.OrganizationMet } func getTlsConfig() (*tls.Config, error) { - zap.L().Debug("enabling SSL support via X509 keypair") cert, err := tls.LoadX509KeyPair(config.GetString(config.PaymentChannelCertPath), config.GetString(config.PaymentChannelKeyPath)) @@ -119,12 +118,10 @@ func getTlsConfig() (*tls.Config, error) { RootCAs: caCertPool, } return tlsConfig, nil - } // Get gets value from etcd by key func (client *EtcdClient) Get(key string) (value string, ok bool, err error) { - ctx, cancel := context.WithTimeout(context.Background(), client.timeout) defer cancel() diff --git a/go.mod b/go.mod index 64015900..b830c4bc 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/singnet/snet-daemon -go 1.22 +go 1.23 require ( github.com/OneOfOne/go-utils v0.0.0-20180319162427-6019ff89a94e - github.com/bufbuild/protocompile v0.14.0 + github.com/bufbuild/protocompile v0.14.1 github.com/emicklei/proto v1.13.2 - github.com/ethereum/go-ethereum v1.14.7 + github.com/ethereum/go-ethereum v1.14.8 github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/gorilla/handlers v1.5.2 @@ -17,8 +17,8 @@ require ( github.com/ipfs/kubo v0.29.0 github.com/magiconair/properties v1.8.7 github.com/pkg/errors v0.9.1 - github.com/rs/cors v1.11.0 - github.com/rs/xid v1.5.0 + github.com/rs/cors v1.11.1 + github.com/rs/xid v1.6.0 github.com/singnet/snet-ecosystem-contracts v0.1.1 github.com/soheilhy/cmux v0.1.5 github.com/spf13/cast v1.7.0 @@ -26,13 +26,13 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 - go.etcd.io/etcd/client/v3 v3.5.15 - go.etcd.io/etcd/server/v3 v3.5.15 + go.etcd.io/etcd/client/v3 v3.5.16 + go.etcd.io/etcd/server/v3 v3.5.16 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.26.0 - golang.org/x/net v0.28.0 + golang.org/x/crypto v0.27.0 + golang.org/x/net v0.29.0 golang.org/x/time v0.6.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.1 google.golang.org/protobuf v1.34.2 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) @@ -44,9 +44,9 @@ require ( github.com/VictoriaMetrics/fastcache v1.12.2 // indirect github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.13.0 // indirect + github.com/bits-and-blooms/bitset v1.14.2 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect @@ -56,23 +56,22 @@ require ( github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect + github.com/consensys/gnark-crypto v0.13.0 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect - github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect + github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/ethereum/c-kzg-4844 v1.0.2 // indirect + github.com/ethereum/c-kzg-4844 v1.0.3 // indirect github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fjl/memsize v0.0.2 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.27.0 // indirect @@ -84,13 +83,13 @@ require ( github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect - github.com/google/btree v1.1.2 // indirect + github.com/google/btree v1.1.3 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-bexpr v0.1.10 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect @@ -99,7 +98,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.3.0 // indirect + github.com/holiman/uint256 v1.3.1 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect @@ -125,7 +124,7 @@ require ( github.com/jbenet/goprocess v0.1.4 // indirect github.com/jonboulle/clockwork v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.8 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -168,9 +167,9 @@ require ( github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polydawn/refmt v0.89.0 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.20.3 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.59.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect @@ -185,7 +184,7 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/supranational/blst v0.3.12 // indirect + github.com/supranational/blst v0.3.13 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect @@ -198,34 +197,34 @@ require ( github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - go.etcd.io/bbolt v1.3.10 // indirect - go.etcd.io/etcd/api/v3 v3.5.15 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect - go.etcd.io/etcd/client/v2 v2.305.15 // indirect - go.etcd.io/etcd/pkg/v3 v3.5.15 // indirect - go.etcd.io/etcd/raft/v3 v3.5.15 // indirect + go.etcd.io/bbolt v1.3.11 // indirect + go.etcd.io/etcd/api/v3 v3.5.16 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.16 // indirect + go.etcd.io/etcd/client/v2 v2.305.16 // indirect + go.etcd.io/etcd/pkg/v3 v3.5.16 // indirect + go.etcd.io/etcd/raft/v3 v3.5.16 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/sdk v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect + go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/sdk v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/exp v0.0.0-20240707233637-46b078467d37 // indirect golang.org/x/mod v0.19.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/tools v0.23.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect gonum.org/v1/gonum v0.15.0 // indirect - google.golang.org/genproto v0.0.0-20240722135656-d784300faade // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a // indirect + google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.3.0 // indirect diff --git a/go.sum b/go.sum index 728e1f43..e3f7c7de 100644 --- a/go.sum +++ b/go.sum @@ -67,16 +67,16 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= -github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.14.2 h1:YXVoyPndbdvcEVcseEovVfp0qjJp7S+i5+xgp/Nfbdc= +github.com/bits-and-blooms/bitset v1.14.2/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/bufbuild/protocompile v0.14.0 h1:z3DW4IvXE5G/uTOnSQn+qwQQxvhckkTWLS/0No/o7KU= -github.com/bufbuild/protocompile v0.14.0/go.mod h1:N6J1NYzkspJo3ZwyL4Xjvli86XOj1xq4qAasUFxGups= +github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= +github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= @@ -117,8 +117,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= -github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/consensys/gnark-crypto v0.13.0 h1:VPULb/v6bbYELAPTDFINEVaMTTybV5GLxDdcjnS+4oc= +github.com/consensys/gnark-crypto v0.13.0/go.mod h1:wKqwsieaKPThcFkHe0d0zMsbHEUWFmZcG7KBCse210o= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -135,8 +135,8 @@ github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 h1:ZFUue+PN github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE= github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I= github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= -github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI= -github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= +github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= +github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= @@ -178,10 +178,10 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF 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/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/c-kzg-4844 v1.0.2 h1:8tV84BCEiPeOkiVgW9mpYBeBUir2bkCNVqxPwwVeO+s= -github.com/ethereum/c-kzg-4844 v1.0.2/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.14.7 h1:EHpv3dE8evQmpVEQ/Ne2ahB06n2mQptdwqaMNhAT29g= -github.com/ethereum/go-ethereum v1.14.7/go.mod h1:Mq0biU2jbdmKSZoqOj29017ygFrMnB5/Rifwp980W4o= +github.com/ethereum/c-kzg-4844 v1.0.3 h1:IEnbOHwjixW2cTvKRUlAAUOeleV7nNM/umJR+qy4WDs= +github.com/ethereum/c-kzg-4844 v1.0.3/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +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/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4= github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w= github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 h1:BBso6MBKW8ncyZLv37o+KNyy0HrrHgfnOaGQC2qvN+A= @@ -189,8 +189,6 @@ github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5/go.mod h1:Jp github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= -github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= @@ -308,8 +306,8 @@ github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXi 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/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= 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= @@ -363,8 +361,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -401,8 +399,8 @@ github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6w github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.3.0 h1:4wdcm/tnd0xXdu7iS3ruNvxkWwrb4aeBQv19ayYn8F4= -github.com/holiman/uint256 v1.3.0/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +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/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= @@ -539,8 +537,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -801,8 +799,8 @@ github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= +github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -816,8 +814,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= +github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -844,10 +842,10 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= -github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc= -github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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= @@ -889,8 +887,6 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= 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/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -923,8 +919,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT 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/supranational/blst v0.3.12 h1:Vfas2U2CFHhniv2QkUm2OVa1+pGTdqtpqm9NnhUUbZ8= -github.com/supranational/blst v0.3.12/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= +github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= 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/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= @@ -974,23 +970,23 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= -go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= +go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= +go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk= -go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM= -go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA= -go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU= -go.etcd.io/etcd/client/v2 v2.305.15 h1:VG2xbf8Vz1KJh65Ar2V5eDmfkp1bpzkSEHlhJM3usp8= -go.etcd.io/etcd/client/v2 v2.305.15/go.mod h1:Ad5dRjPVb/n5yXgAWQ/hXzuXXkBk0Y658ocuXYaUU48= -go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4= -go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU= -go.etcd.io/etcd/pkg/v3 v3.5.15 h1:/Iu6Sr3iYaAjy++8sIDoZW9/EfhcwLZwd4FOZX2mMOU= -go.etcd.io/etcd/pkg/v3 v3.5.15/go.mod h1:e3Acf298sPFmTCGTrnGvkClEw9RYIyPtNzi1XM8rets= -go.etcd.io/etcd/raft/v3 v3.5.15 h1:jOA2HJF7zb3wy8H/pL13e8geWqkEa/kUs0waUggZC0I= -go.etcd.io/etcd/raft/v3 v3.5.15/go.mod h1:k3r7P4seEiUcgxOPLp+mloJWV3Q4QLPGNvy/OgC8OtM= -go.etcd.io/etcd/server/v3 v3.5.15 h1:x35jrWnZgsRwMsFsUJIUdT1bvzIz1B+29HjMfRYVN/E= -go.etcd.io/etcd/server/v3 v3.5.15/go.mod h1:l9jX9oa/iuArjqz0RNX/TDbc70dLXxRZo/nmPucrpFo= +go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0= +go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28= +go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q= +go.etcd.io/etcd/client/pkg/v3 v3.5.16/go.mod h1:V8acl8pcEK0Y2g19YlOV9m9ssUe6MgiDSobSoaBAM0E= +go.etcd.io/etcd/client/v2 v2.305.16 h1:kQrn9o5czVNaukf2A2At43cE9ZtWauOtf9vRZuiKXow= +go.etcd.io/etcd/client/v2 v2.305.16/go.mod h1:h9YxWCzcdvZENbfzBTFCnoNumr2ax3F19sKMqHFmXHE= +go.etcd.io/etcd/client/v3 v3.5.16 h1:sSmVYOAHeC9doqi0gv7v86oY/BTld0SEFGaxsU9eRhE= +go.etcd.io/etcd/client/v3 v3.5.16/go.mod h1:X+rExSGkyqxvu276cr2OwPLBaeqFu1cIl4vmRjAD/50= +go.etcd.io/etcd/pkg/v3 v3.5.16 h1:cnavs5WSPWeK4TYwPYfmcr3Joz9BH+TZ6qoUtz6/+mc= +go.etcd.io/etcd/pkg/v3 v3.5.16/go.mod h1:+lutCZHG5MBBFI/U4eYT5yL7sJfnexsoM20Y0t2uNuY= +go.etcd.io/etcd/raft/v3 v3.5.16 h1:zBXA3ZUpYs1AwiLGPafYAKKl/CORn/uaxYDwlNwndAk= +go.etcd.io/etcd/raft/v3 v3.5.16/go.mod h1:P4UP14AxofMJ/54boWilabqqWoW9eLodl6I5GdGzazI= +go.etcd.io/etcd/server/v3 v3.5.16 h1:d0/SAdJ3vVsZvF8IFVb1k8zqMZ+heGcNfft71ul9GWE= +go.etcd.io/etcd/server/v3 v3.5.16/go.mod h1:ynhyZZpdDp1Gq49jkUg5mfkDWZwXnn3eIqCqtJnrD/s= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -999,28 +995,28 @@ 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.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 h1:9G6E0TXzGFVfTnawRzrPl83iHOAV7L8NJiR8RSGYV1g= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0/go.mod h1:azvtTADFQJA8mX80jIH/akaE7h+dbm/sVuaHqN13w74= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 h1:Xs2Ncz0gNihqu9iosIZ5SkBbWo5T8JhhLJFMQL1qmLI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0/go.mod h1:vy+2G/6NvVMpwGX/NyLqcC41fxepnuKHk16E6IZUcJc= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6ZXmNPRR8ul6i3WgFURCHzaXjHdm0karRG/+dj3s= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0 h1:lsInsfvhVIfOI6qHVyysXMNDnjO9Npvl7tlDPJFBVd4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.30.0/go.mod h1:KQsVNh4OjgjTG0G6EiNi1jVpnaeeKsKMRwbLN+f1+8M= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0 h1:m0yTiGDLUvVYaTFbAvCkVYIYcvwKt3G7OLoN77NUs/8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.30.0/go.mod h1:wBQbT4UekBfegL2nx0Xk1vBcnzyBPsIVm9hRG4fYcr4= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0 h1:1wp/gyxsuYtuE/JFxsQRtcCDtMrO2qMvlfXALU5wkzI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0/go.mod h1:gbTHmghkGgqxMomVQQMur1Nba4M0MQ8AYThXDUjsJ38= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.26.0 h1:0W5o9SzoR15ocYHEQfvfipzcNog1lBxOLfnex91Hk6s= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.26.0/go.mod h1:zVZ8nz+VSggWmnh6tTsJqXQ7rU4xLwRtna1M4x5jq58= go.opentelemetry.io/otel/exporters/zipkin v1.26.0 h1:sBk6A62GgcQRwcxcBwRMPkqeuSizcpHkXyZNyP281Fw= go.opentelemetry.io/otel/exporters/zipkin v1.26.0/go.mod h1:fLzYtPUxPFzu7rSqhYsCxYheT2dNoPjtKovCLzLm07w= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/sdk v1.30.0 h1:cHdik6irO49R5IysVhdn8oaiR9m8XluDaJAs4DfOrYE= +go.opentelemetry.io/otel/sdk v1.30.0/go.mod h1:p14X4Ok8S+sygzblytT1nqG98QG2KYKv++HE0LY/mhg= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1067,10 +1063,8 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= 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= @@ -1143,10 +1137,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= 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= @@ -1161,8 +1153,6 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1222,12 +1212,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -1239,16 +1225,12 @@ golang.org/x/text v0.3.3/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.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 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/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1329,14 +1311,12 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20240722135656-d784300faade h1:lKFsS7wpngDgSCeFn7MoLy+wBDQZ1UQIJD4UNM1Qvkg= -google.golang.org/genproto v0.0.0-20240722135656-d784300faade/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY= -google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade h1:WxZOF2yayUHpHSbUE6NMzumUzBxYc3YGwo0YHnbzsJY= -google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade h1:oCRSWfwGXQsqlVdErcyTt4A93Y8fo0/9D4b1gnI++qo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a h1:EKiZZXueP9/T68B8Nl0GAx9cjbQnCId0yP3qPMgaaHs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240808171019-573a1156607a/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= +google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:hL97c3SYopEHblzpxRL4lSs523++l8DYxGM1FQiYmb4= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1354,8 +1334,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.1 h1:hO5qAXR19+/Z44hmvIM4dQFMSYX9XcWsByfoxutBpAM= +google.golang.org/grpc v1.66.1/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 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= diff --git a/handler/grpc.go b/handler/grpc.go index 33d81fa7..3188efb7 100644 --- a/handler/grpc.go +++ b/handler/grpc.go @@ -10,21 +10,22 @@ import ( "os/exec" "strings" - "github.com/singnet/snet-daemon/blockchain" - "github.com/singnet/snet-daemon/codec" - "github.com/singnet/snet-daemon/config" - "github.com/gorilla/rpc/v2/json2" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/dynamicpb" + + "github.com/singnet/snet-daemon/blockchain" + "github.com/singnet/snet-daemon/codec" + "github.com/singnet/snet-daemon/config" ) var grpcDesc = &grpc.StreamDesc{ServerStreams: true, ClientStreams: true} @@ -89,20 +90,19 @@ func NewGrpcHandler(serviceMetadata *blockchain.ServiceMetadata) grpc.StreamHand return nil } -func (h grpcHandler) getConnection(endpoint string) (conn *grpc.ClientConn) { +func (g grpcHandler) getConnection(endpoint string) (conn *grpc.ClientConn) { passthroughURL, err := url.Parse(endpoint) if err != nil { zap.L().Panic("error parsing passthrough endpoint", zap.Error(err)) } if strings.Compare(passthroughURL.Scheme, "https") == 0 { - conn, err = grpc.Dial(passthroughURL.Host, - grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")), h.options) + conn, err = grpc.NewClient(passthroughURL.Host, + grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")), g.options) if err != nil { zap.L().Panic("error dialing service", zap.Error(err)) } } else { - conn, err = grpc.Dial(passthroughURL.Host, grpc.WithInsecure(), h.options) - + conn, err = grpc.NewClient(passthroughURL.Host, grpc.WithTransportCredentials(insecure.NewCredentials()), g.options) if err != nil { zap.L().Panic("error dialing service", zap.Error(err)) } @@ -230,7 +230,6 @@ func forwardServerToClient(src grpc.ServerStream, dst grpc.ClientStream) chan er ret <- err break } - } else if err := src.RecvMsg(f); err != nil { ret <- err // this can be io.EOF which is happy case break @@ -387,7 +386,6 @@ func jsonToProto(protoFile protoreflect.FileDescriptor, json []byte, methodName } func protoToJson(protoFile protoreflect.FileDescriptor, in []byte, methodName string) (json []byte) { - if protoFile.Services().Len() == 0 { zap.L().Warn("service in proto not found") return []byte("error, invalid proto file") diff --git a/handler/httphandler/http.go b/handler/httphandler/http.go index 52a6facb..645fa389 100644 --- a/handler/httphandler/http.go +++ b/handler/httphandler/http.go @@ -21,7 +21,7 @@ func NewHTTPHandler(blockProc blockchain.Processor) http.Handler { return &httpHandler{ passthroughEnabled: config.GetBool(config.PassthroughEnabledKey), passthroughEndpoint: config.GetString(config.PassthroughEndpointKey), - rateLimiter: ratelimit.NewRateLimiter(), + rateLimiter: *ratelimit.NewRateLimiter(), } } @@ -29,7 +29,7 @@ func (h *httpHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) { resp.Header().Set("Access-Control-Allow-Origin", "*") log.Printf("ServeHTTP: %#v \n", req) if h.passthroughEnabled { - if h.rateLimiter.Allow() == false { + if !h.rateLimiter.Allow() { http.Error(resp, http.StatusText(429), http.StatusTooManyRequests) return } diff --git a/handler/interceptors.go b/handler/interceptors.go index dc5e2cb7..5edf2e81 100644 --- a/handler/interceptors.go +++ b/handler/interceptors.go @@ -161,7 +161,7 @@ type rateLimitInterceptor struct { func GrpcRateLimitInterceptor(broadcast *configuration_service.MessageBroadcaster) grpc.StreamServerInterceptor { interceptor := &rateLimitInterceptor{ - rateLimiter: ratelimit.NewRateLimiter(), + rateLimiter: *ratelimit.NewRateLimiter(), messageBroadcaster: broadcast, processRequest: configuration_service.START_PROCESSING_ANY_REQUEST, requestProcessingNotification: broadcast.NewSubscriber(), @@ -182,8 +182,10 @@ func GrpcMeteringInterceptor() grpc.StreamServerInterceptor { // Monitor requests arrived and responses sent and publish these stats for Reporting func interceptMetering(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - var err error - var start time.Time + var ( + err error + start time.Time + ) start = time.Now() //Get the method name methodName, _ := grpc.MethodFromServerStream(ss) @@ -196,7 +198,7 @@ func interceptMetering(srv any, ss grpc.ServerStream, info *grpc.StreamServerInf } defer func() { - go metrics.PublishResponseStats(commonStats, time.Now().Sub(start), err) + go metrics.PublishResponseStats(commonStats, time.Since(start), err) }() err = handler(srv, ss) if err != nil { diff --git a/ipfsutils/ipfsutils.go b/ipfsutils/ipfsutils.go index 4debf671..75105ff3 100644 --- a/ipfsutils/ipfsutils.go +++ b/ipfsutils/ipfsutils.go @@ -23,7 +23,7 @@ func ReadFilesCompressed(compressedFile string) (protofiles []string, err error) f := strings.NewReader(compressedFile) tarReader := tar.NewReader(f) protofiles = make([]string, 0) - for true { + for { header, err := tarReader.Next() if err == io.EOF { break @@ -67,27 +67,28 @@ func GetIpfsFile(hash string) (content string) { cID, err := cid.Parse(hash) if err != nil { - zap.L().Panic("error parsing the ipfs hash", zap.String("hashFromMetaData", hash), zap.Error(err)) + zap.L().Fatal("error parsing the ipfs hash", zap.String("hashFromMetaData", hash), zap.Error(err)) } req := ipfsClient.Request("cat", cID.String()) if err != nil { - zap.L().Panic("error executing the cat command in ipfs", zap.String("hashFromMetaData", hash), zap.Error(err)) + zap.L().Fatal("error executing the cat command in ipfs", zap.String("hashFromMetaData", hash), zap.Error(err)) return } resp, err := req.Send(context.Background()) - defer resp.Close() if err != nil { - zap.L().Panic("error executing the cat command in ipfs", zap.String("hashFromMetaData", hash), zap.Error(err)) + zap.L().Fatal("error executing the cat command in ipfs", zap.String("hashFromMetaData", hash), zap.Error(err)) return } + defer resp.Close() + if resp.Error != nil { - zap.L().Panic("error executing the cat command in ipfs", zap.String("hashFromMetaData", hash), zap.Error(err)) + zap.L().Fatal("error executing the cat command in ipfs", zap.String("hashFromMetaData", hash), zap.Error(err)) return } fileContent, err := io.ReadAll(resp.Output) if err != nil { - zap.L().Panic("error: in Reading the meta data file", zap.Error(err), zap.String("hashFromMetaData", hash)) + zap.L().Fatal("error: in Reading the meta data file", zap.Error(err), zap.String("hashFromMetaData", hash)) return } @@ -96,13 +97,13 @@ func GetIpfsFile(hash string) (content string) { // Create a cid manually to check cid _, c, err := cid.CidFromBytes(append(cID.Bytes(), fileContent...)) if err != nil { - zap.L().Panic("error generating ipfs hash", zap.String("hashFromMetaData", hash), zap.Error(err)) + zap.L().Fatal("error generating ipfs hash", zap.String("hashFromMetaData", hash), zap.Error(err)) return } // To test if two cid's are equivalent, be sure to use the 'Equals' method: if !c.Equals(cID) { - zap.L().Panic("IPFS hash verification failed. Generated hash doesnt match with expected hash", + zap.L().Fatal("IPFS hash verification failed. Generated hash doesnt match with expected hash", zap.String("expectedHash", hash), zap.String("hashFromIPFSContent", c.String())) } diff --git a/license_server/license_storage.go b/license_server/license_storage.go index ba31c41a..3ece6801 100644 --- a/license_server/license_storage.go +++ b/license_server/license_storage.go @@ -354,13 +354,10 @@ func serializeLicenseDetailsData(value any) (slice string, err error) { gob.Register(&ServiceMethodCostDetails{}) err = e.Encode(value) - if err != nil { return } - - slice = string(b.Bytes()) - return + return b.String(), err } func deserializeLicenseDetailsData(slice string, value any) (err error) { b := bytes.NewBuffer([]byte(slice)) @@ -386,8 +383,7 @@ func serializeLicenseTrackerData(value any) (slice string, err error) { return } - slice = string(b.Bytes()) - return + return b.String(), err } func deserializeLicenseTrackerData(slice string, value any) (err error) { diff --git a/logger/hook.go b/logger/hook.go index 27b92eaf..c23f4914 100644 --- a/logger/hook.go +++ b/logger/hook.go @@ -165,7 +165,6 @@ func newTelegramBotHook(config *viper.Viper) (hook, error) { } func (t telegramBotHook) call(entry zapcore.Entry) error { - msg := "⚠️Daemon hook⚠️\r\n" + "\r\nOrgID: " + config.GetString(config.OrganizationId) + "\r\nServiceID: " + config.GetString(config.ServiceId) + diff --git a/metrics/clients.go b/metrics/clients.go index 61ee8caf..2f3de8c9 100644 --- a/metrics/clients.go +++ b/metrics/clients.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "errors" + "google.golang.org/grpc/credentials/insecure" "io" "net/http" "time" @@ -27,7 +28,7 @@ type Response struct { // Calls a gRPC endpoint for heartbeat (gRPC Client) func callgRPCServiceHeartbeat(serviceUrl string) (grpc_health_v1.HealthCheckResponse_ServingStatus, error) { // Set up a connection to the server. - conn, err := grpc.Dial(serviceUrl, grpc.WithInsecure()) + conn, err := grpc.NewClient(serviceUrl, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { zap.L().Warn("unable to connect to grpc endpoint", zap.Error(err)) return grpc_health_v1.HealthCheckResponse_NOT_SERVING, err diff --git a/metrics/utils.go b/metrics/utils.go index f69c5b39..350d19af 100644 --- a/metrics/utils.go +++ b/metrics/utils.go @@ -101,7 +101,6 @@ func sendRequest(json []byte, serviceURL string, commonStats *CommonStats) (*htt SignMessageForMetering(req, commonStats) return client.Do(req) - } func SignMessageForMetering(req *http.Request, commonStats *CommonStats) { diff --git a/pricing/dynamic_method_pricing.go b/pricing/dynamic_method_pricing.go index 452673e6..8e7cff80 100644 --- a/pricing/dynamic_method_pricing.go +++ b/pricing/dynamic_method_pricing.go @@ -3,6 +3,7 @@ package pricing import ( "fmt" + "google.golang.org/grpc/credentials/insecure" "math/big" "net/url" @@ -51,7 +52,7 @@ func (priceType *DynamicMethodPrice) checkForDynamicPricing( grpc.MaxCallRecvMsgSize(config.GetInt(config.MaxMessageSizeInMB)*1024*1024), grpc.MaxCallSendMsgSize(config.GetInt(config.MaxMessageSizeInMB)*1024*1024)) - conn, _ := grpc.Dial(passThroughURL.Host, grpc.WithInsecure(), options) + conn, _ := grpc.NewClient(passThroughURL.Host, grpc.WithTransportCredentials(insecure.NewCredentials()), options) md, ok := metadata.FromIncomingContext(derivedContext.InStream.Context()) if !ok { @@ -67,6 +68,9 @@ func (priceType *DynamicMethodPrice) checkForDynamicPricing( clientStream, err := conn.NewStream(outCtx, &grpc.StreamDesc{ServerStreams: true, ClientStreams: true}, pricingMethod, grpc.CallContentSubtype("proto")) + if err != nil { + zap.L().Error(err.Error()) + } return priceType.getPriceFromPricingMethod(derivedContext.InStream, clientStream) } diff --git a/ratelimit/rateLimit.go b/ratelimit/rateLimit.go index c8df3646..dac3cf0f 100644 --- a/ratelimit/rateLimit.go +++ b/ratelimit/rateLimit.go @@ -8,15 +8,15 @@ import ( "time" ) -func NewRateLimiter() rate.Limiter { - //Please note that the burst size is ignored when getLimit() returns rate is infinity - //By Default set the maximum value possible for the Burst Size ( assuming rate was defined ,but burst was not defined) +func NewRateLimiter() *rate.Limiter { + // Please note that the burst size is ignored when getLimit() returns rate is infinity + // By Default set the maximum value possible for the Burst Size + // (assuming rate was defined, but burst was not defined) burstSize := config.GetInt(config.BurstSize) if burstSize == 0 { burstSize = math.MaxInt32 } - limiter := rate.NewLimiter(getLimit(), burstSize) - return *limiter + return rate.NewLimiter(getLimit(), burstSize) } func getLimit() rate.Limit { diff --git a/storage/atomic_storage.go b/storage/atomic_storage.go index e72dc9dc..cc421f0d 100644 --- a/storage/atomic_storage.go +++ b/storage/atomic_storage.go @@ -217,7 +217,6 @@ func NewTypedAtomicStorageImpl(storage AtomicStorage, keySerializer func(key any keyType reflect.Type, valueSerializer func(value any) (serialized string, err error), valueDeserializer func(serialized string, value any) (err error), valueType reflect.Type) TypedAtomicStorage { - return &TypedAtomicStorageImpl{ atomicStorage: storage, keySerializer: keySerializer, @@ -226,7 +225,6 @@ func NewTypedAtomicStorageImpl(storage AtomicStorage, keySerializer func(key any valueDeserializer: valueDeserializer, valueType: valueType, } - } // Get implements TypedAtomicStorage.Get @@ -268,7 +266,7 @@ func (storage *TypedAtomicStorageImpl) GetAll() (array any, err error) { } values := reflect.MakeSlice( - reflect.SliceOf(reflect.PtrTo(storage.valueType)), + reflect.SliceOf(reflect.PointerTo(storage.valueType)), 0, len(stringValues)) for _, stringValue := range stringValues { @@ -380,7 +378,6 @@ func findKeyValueByKey(keyValueData []KeyValueData, key string) (keyValueString } func (storage *TypedAtomicStorageImpl) ExecuteTransaction(request TypedCASRequest) (ok bool, err error) { - updateFunction := func(conditionValues []KeyValueData) (update []KeyValueData, ok bool, err error) { typedValues, err := storage.convertKeyValueDataToTyped(request.ConditionKeys, conditionValues) if err != nil { diff --git a/storage/memory_storage.go b/storage/memory_storage.go index d1031b25..d937e489 100644 --- a/storage/memory_storage.go +++ b/storage/memory_storage.go @@ -108,10 +108,10 @@ func (storage *MemoryStorage) Clear() (err error) { return } -func (memStorage *MemoryStorage) StartTransaction(conditionKeys []string) (transaction Transaction, err error) { +func (storage *MemoryStorage) StartTransaction(conditionKeys []string) (transaction Transaction, err error) { conditionKeyValues := make([]KeyValueData, len(conditionKeys)) for i, key := range conditionKeys { - value, ok, err := memStorage.Get(key) + value, ok, err := storage.Get(key) if err != nil { return nil, err } else if !ok { @@ -119,7 +119,6 @@ func (memStorage *MemoryStorage) StartTransaction(conditionKeys []string) (trans } else { conditionKeyValues[i] = KeyValueData{Key: key, Value: value, Present: true} } - } transaction = &memoryStorageTransaction{ConditionKeys: conditionKeys, ConditionValues: conditionKeyValues} return transaction, nil @@ -165,9 +164,8 @@ func (storage *MemoryStorage) CompleteTransaction(transaction Transaction, updat return true, nil } -func (client *MemoryStorage) ExecuteTransaction(request CASRequest) (ok bool, err error) { - - transaction, err := client.StartTransaction(request.ConditionKeys) +func (storage *MemoryStorage) ExecuteTransaction(request CASRequest) (ok bool, err error) { + transaction, err := storage.StartTransaction(request.ConditionKeys) if err != nil { return false, err } @@ -180,7 +178,7 @@ func (client *MemoryStorage) ExecuteTransaction(request CASRequest) (ok bool, er if err != nil { return false, err } - ok, err = client.CompleteTransaction(transaction, newvalues) + ok, err = storage.CompleteTransaction(transaction, newvalues) if err != nil { return false, err } @@ -191,6 +189,7 @@ func (client *MemoryStorage) ExecuteTransaction(request CASRequest) (ok bool, er continue } } + // TODO: refactor this return true, nil } diff --git a/training/service.go b/training/service.go index aabd8296..028dbbf9 100644 --- a/training/service.go +++ b/training/service.go @@ -4,6 +4,7 @@ package training import ( "bytes" "fmt" + "google.golang.org/grpc/credentials/insecure" "math/big" "net/url" "strings" @@ -91,13 +92,13 @@ func getConnection(endpoint string) (conn *grpc.ClientConn) { zap.L().Panic("error parsing passthrough endpoint", zap.Error(err)) } if strings.Compare(passthroughURL.Scheme, "https") == 0 { - conn, err = grpc.Dial(passthroughURL.Host, + conn, err = grpc.NewClient(passthroughURL.Host, grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")), options) if err != nil { zap.L().Panic("error dialing service", zap.Error(err)) } } else { - conn, err = grpc.Dial(passthroughURL.Host, grpc.WithInsecure(), options) + conn, err = grpc.NewClient(passthroughURL.Host, grpc.WithTransportCredentials(insecure.NewCredentials()), options) if err != nil { zap.L().Panic("error dialing service", zap.Error(err)) @@ -176,6 +177,9 @@ func (service ModelService) deleteUserModelDetails(key *ModelKey, data *ModelDat if data, ok, err := service.userStorage.Get(userKey); ok && err == nil && data != nil { data.ModelIds = remove(data.ModelIds, key.ModelId) err = service.userStorage.Put(userKey, data) + if err != nil { + zap.L().Error(err.Error()) + } } } return @@ -225,7 +229,7 @@ func (service ModelService) updateModelDetails(request *UpdateModelRequest, resp key := service.getModelKeyToUpdate(request) oldAddresses := make([]string, 0) var latestAddresses []string - //by default add the creator to the Authorized list of Address + // by default add the creator to the Authorized list of Address if request.UpdateModelDetails.AddressList != nil || len(request.UpdateModelDetails.AddressList) > 0 { latestAddresses = request.UpdateModelDetails.AddressList } diff --git a/utils/common.go b/utils/common.go index a62c6e7d..3352464a 100644 --- a/utils/common.go +++ b/utils/common.go @@ -18,7 +18,7 @@ func Serialize(value any) (slice string, err error) { return } - slice = string(b.Bytes()) + slice = b.String() return }