diff --git a/.tool-versions b/.tool-versions index e2f7aa87c..2bbf20a04 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -golang 1.20.1 +golang 1.20.4 golangci-lint 1.51.1 diff --git a/go.mod b/go.mod index cd19e2969..b909baae1 100644 --- a/go.mod +++ b/go.mod @@ -4,22 +4,21 @@ go 1.20 require ( github.com/confluentinc/confluent-kafka-go v1.9.2 - github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.3.0 github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 github.com/hashicorp/go-plugin v1.4.10 github.com/jpillora/backoff v1.0.0 github.com/linkedin/goavro/v2 v2.12.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_golang v1.15.0 github.com/riferrei/srclient v0.5.4 - github.com/smartcontractkit/libocr v0.0.0-20230525150148-a75f6e244bb3 - github.com/stretchr/testify v1.8.3 + github.com/smartcontractkit/libocr v0.0.0-20230606215712-82b910bef5c1 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - go.uber.org/goleak v1.1.12 + go.uber.org/goleak v1.2.1 go.uber.org/zap v1.24.0 golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 google.golang.org/grpc v1.55.0 @@ -27,39 +26,40 @@ require ( ) require ( - github.com/benbjohnson/clock v1.1.0 // indirect + github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/fatih/color v1.7.0 // indirect + github.com/fatih/color v1.13.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/snappy v0.0.4 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect github.com/hashicorp/go-hclog v0.14.1 // indirect github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect - github.com/mattn/go-colorable v0.1.8 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/oklog/run v1.0.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect + github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.uber.org/atomic v1.7.0 // indirect - go.uber.org/multierr v1.6.0 // indirect - golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.9.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 0626d1a94..3afb49a66 100644 --- a/go.sum +++ b/go.sum @@ -39,21 +39,13 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/actgardner/gogen-avro/v10 v10.1.0/go.mod h1:o+ybmVjEa27AAr35FRqU98DJu1fXES56uXniYFv4yDA= github.com/actgardner/gogen-avro/v10 v10.2.1/go.mod h1:QUhjeHPchheYmMDni/Nx7VB0RsT/ee8YIgGY/xpEQgQ= github.com/actgardner/gogen-avro/v9 v9.1.0/go.mod h1:nyTj6wPqDJoxM3qdnjcLv+EnMDSDFqE0qDpva2QRmKc= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= 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/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -79,8 +71,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20= github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= @@ -89,21 +82,11 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -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-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 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-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -135,8 +118,9 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -147,7 +131,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -195,24 +178,16 @@ github.com/jmank88/go-plugin v0.0.0-20230604120638-7bb12ec27e75 h1:KYTOmcwuezD27 github.com/jmank88/go-plugin v0.0.0-20230604120638-7bb12ec27e75/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= 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.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/juju/qthttptest v0.1.1/go.mod h1:aTlAv8TYaflIiTDIQYzxnl1QdPjAg8Q8qJMErpKy6A4= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -225,79 +200,58 @@ github.com/linkedin/goavro/v2 v2.11.1/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF github.com/linkedin/goavro/v2 v2.12.0 h1:rIQQSj8jdAUlKQh6DttK8wCRv4t4QO09g1C4aBWXslg= github.com/linkedin/goavro/v2 v2.12.0/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 h1:7GoSOOW2jpsfkntVKaS2rAr1TJqfcxotyaUcuxoZSzg= -github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -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/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nrwiersma/avro-benchmarks v0.0.0-20210913175520-21aec48c8f76/go.mod h1:iKyFMidsk/sVYONJRE372sJuX/QTRPacU7imPqqsu7g= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/riferrei/srclient v0.5.4 h1:dfwyR5u23QF7beuVl2WemUY2KXh5+Sc4DHKyPXBNYuc= github.com/riferrei/srclient v0.5.4/go.mod h1:vbkLmWcgYa7JgfPvuy/+K8fTS0p1bApqadxrxi/S1MI= github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a/go.mod h1:4r5QyqhjIWCcK8DO4KMclc5Iknq5qVBAlbYYzAbUScQ= 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.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/santhosh-tekuri/jsonschema/v5 v5.0.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= github.com/santhosh-tekuri/jsonschema/v5 v5.1.1 h1:lEOLY2vyGIqKWUI9nzsOJRV3mb3WC9dXYORsLEUcoeY= github.com/santhosh-tekuri/jsonschema/v5 v5.1.1/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/smartcontractkit/libocr v0.0.0-20230525150148-a75f6e244bb3 h1:/Gel/U5eIZ/BGGr25OrHaXiVDTAJ5DYX5+UlXp3q7Gg= -github.com/smartcontractkit/libocr v0.0.0-20230525150148-a75f6e244bb3/go.mod h1:5JnCHuYgmIP9ZyXzgAfI5Iwu0WxBtBKp+ApeT5o1Cjw= +github.com/smartcontractkit/libocr v0.0.0-20230606215712-82b910bef5c1 h1:caG9BWjnCxN/HPBA5ltDGadDraZAsjGIct4S8lh8D5c= +github.com/smartcontractkit/libocr v0.0.0-20230606215712-82b910bef5c1/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -310,12 +264,11 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -332,22 +285,21 @@ go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= -go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= 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= @@ -371,7 +323,6 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -381,10 +332,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -392,7 +341,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -414,9 +362,6 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -425,8 +370,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -437,18 +380,14 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -458,7 +397,6 @@ golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -472,25 +410,19 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -498,7 +430,6 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/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.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -545,8 +476,6 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -644,27 +573,20 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/avro.v0 v0.0.0-20171217001914-a730b5802183/go.mod h1:FvqrFXt+jCsyQibeRv4xxEJBL5iG2DDW5aeJwzDiq4A= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v1 v1.0.0/go.mod h1:CxwszS/Xz1C49Ucd2i6Zil5UToP1EmyrFhKaMVbg1mk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/httprequest.v1 v1.2.1/go.mod h1:x2Otw96yda5+8+6ZeWwHIJTFkEHWP/qP8pJOzqEtWPM= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/retry.v1 v1.0.3/go.mod h1:FJkXmWiMaAo7xB+xhvDF59zhfjDWyzmyAxiT4dB688g= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pkg/loop/internal/config.go b/pkg/loop/internal/config.go index 1b2da02ca..72d367b9a 100644 --- a/pkg/loop/internal/config.go +++ b/pkg/loop/internal/config.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal/pb" "github.com/smartcontractkit/chainlink-relay/pkg/types" diff --git a/pkg/loop/internal/datasource.go b/pkg/loop/internal/datasource.go index 0f354c5f0..823cc4276 100644 --- a/pkg/loop/internal/datasource.go +++ b/pkg/loop/internal/datasource.go @@ -9,13 +9,13 @@ import ( "google.golang.org/grpc" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal/pb" "github.com/smartcontractkit/chainlink-relay/pkg/utils" ) -// github.com/smartcontractkit/libocr/offchainreporting2/internal/protocol.ReportingPluginTimeoutWarningGracePeriod +// github.com/smartcontractkit/libocr/offchainreporting2plus/internal/protocol.ReportingPluginTimeoutWarningGracePeriod var datasourceOvertime = 100 * time.Millisecond func init() { @@ -40,7 +40,9 @@ func newDataSourceClient(cc grpc.ClientConnInterface) *dataSourceClient { } func (d *dataSourceClient) Observe(ctx context.Context, timestamp types.ReportTimestamp) (*big.Int, error) { - reply, err := d.grpc.Observe(ctx, &pb.ObserveRequest{ReportTimestamp: pbReportTimestamp(timestamp)}) + reply, err := d.grpc.Observe(ctx, &pb.ObserveRequest{ + ReportTimestamp: pbReportTimestamp(timestamp), + }) if err != nil { return nil, err } diff --git a/pkg/loop/internal/median.go b/pkg/loop/internal/median.go index 201fb9dcc..0a7779dbd 100644 --- a/pkg/loop/internal/median.go +++ b/pkg/loop/internal/median.go @@ -12,7 +12,7 @@ import ( "github.com/smartcontractkit/libocr/commontypes" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/logger" "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal/pb" diff --git a/pkg/loop/internal/pb/median.pb.go b/pkg/loop/internal/pb/median.pb.go index 694a044bc..73b340d68 100644 --- a/pkg/loop/internal/pb/median.pb.go +++ b/pkg/loop/internal/pb/median.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc v3.21.12 // source: median.proto diff --git a/pkg/loop/internal/pb/median_grpc.pb.go b/pkg/loop/internal/pb/median_grpc.pb.go index 21bd93773..61515c1f9 100644 --- a/pkg/loop/internal/pb/median_grpc.pb.go +++ b/pkg/loop/internal/pb/median_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.12 // source: median.proto @@ -19,6 +19,10 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + PluginMedian_NewMedianFactory_FullMethodName = "/loop.PluginMedian/NewMedianFactory" +) + // PluginMedianClient is the client API for PluginMedian service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -36,7 +40,7 @@ func NewPluginMedianClient(cc grpc.ClientConnInterface) PluginMedianClient { func (c *pluginMedianClient) NewMedianFactory(ctx context.Context, in *NewMedianFactoryRequest, opts ...grpc.CallOption) (*NewMedianFactoryReply, error) { out := new(NewMedianFactoryReply) - err := c.cc.Invoke(ctx, "/loop.PluginMedian/NewMedianFactory", in, out, opts...) + err := c.cc.Invoke(ctx, PluginMedian_NewMedianFactory_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -81,7 +85,7 @@ func _PluginMedian_NewMedianFactory_Handler(srv interface{}, ctx context.Context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.PluginMedian/NewMedianFactory", + FullMethod: PluginMedian_NewMedianFactory_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(PluginMedianServer).NewMedianFactory(ctx, req.(*NewMedianFactoryRequest)) @@ -105,6 +109,10 @@ var PluginMedian_ServiceDesc = grpc.ServiceDesc{ Metadata: "median.proto", } +const ( + ErrorLog_SaveError_FullMethodName = "/loop.ErrorLog/SaveError" +) + // ErrorLogClient is the client API for ErrorLog service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -122,7 +130,7 @@ func NewErrorLogClient(cc grpc.ClientConnInterface) ErrorLogClient { func (c *errorLogClient) SaveError(ctx context.Context, in *SaveErrorRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/loop.ErrorLog/SaveError", in, out, opts...) + err := c.cc.Invoke(ctx, ErrorLog_SaveError_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -167,7 +175,7 @@ func _ErrorLog_SaveError_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ErrorLog/SaveError", + FullMethod: ErrorLog_SaveError_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ErrorLogServer).SaveError(ctx, req.(*SaveErrorRequest)) @@ -191,6 +199,12 @@ var ErrorLog_ServiceDesc = grpc.ServiceDesc{ Metadata: "median.proto", } +const ( + ReportCodec_BuildReport_FullMethodName = "/loop.ReportCodec/BuildReport" + ReportCodec_MedianFromReport_FullMethodName = "/loop.ReportCodec/MedianFromReport" + ReportCodec_MaxReportLength_FullMethodName = "/loop.ReportCodec/MaxReportLength" +) + // ReportCodecClient is the client API for ReportCodec service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -210,7 +224,7 @@ func NewReportCodecClient(cc grpc.ClientConnInterface) ReportCodecClient { func (c *reportCodecClient) BuildReport(ctx context.Context, in *BuildReportRequest, opts ...grpc.CallOption) (*BuildReportReply, error) { out := new(BuildReportReply) - err := c.cc.Invoke(ctx, "/loop.ReportCodec/BuildReport", in, out, opts...) + err := c.cc.Invoke(ctx, ReportCodec_BuildReport_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -219,7 +233,7 @@ func (c *reportCodecClient) BuildReport(ctx context.Context, in *BuildReportRequ func (c *reportCodecClient) MedianFromReport(ctx context.Context, in *MedianFromReportRequest, opts ...grpc.CallOption) (*MedianFromReportReply, error) { out := new(MedianFromReportReply) - err := c.cc.Invoke(ctx, "/loop.ReportCodec/MedianFromReport", in, out, opts...) + err := c.cc.Invoke(ctx, ReportCodec_MedianFromReport_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -228,7 +242,7 @@ func (c *reportCodecClient) MedianFromReport(ctx context.Context, in *MedianFrom func (c *reportCodecClient) MaxReportLength(ctx context.Context, in *MaxReportLengthRequest, opts ...grpc.CallOption) (*MaxReportLengthReply, error) { out := new(MaxReportLengthReply) - err := c.cc.Invoke(ctx, "/loop.ReportCodec/MaxReportLength", in, out, opts...) + err := c.cc.Invoke(ctx, ReportCodec_MaxReportLength_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -281,7 +295,7 @@ func _ReportCodec_BuildReport_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportCodec/BuildReport", + FullMethod: ReportCodec_BuildReport_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportCodecServer).BuildReport(ctx, req.(*BuildReportRequest)) @@ -299,7 +313,7 @@ func _ReportCodec_MedianFromReport_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportCodec/MedianFromReport", + FullMethod: ReportCodec_MedianFromReport_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportCodecServer).MedianFromReport(ctx, req.(*MedianFromReportRequest)) @@ -317,7 +331,7 @@ func _ReportCodec_MaxReportLength_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportCodec/MaxReportLength", + FullMethod: ReportCodec_MaxReportLength_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportCodecServer).MaxReportLength(ctx, req.(*MaxReportLengthRequest)) @@ -349,6 +363,11 @@ var ReportCodec_ServiceDesc = grpc.ServiceDesc{ Metadata: "median.proto", } +const ( + MedianContract_LatestTransmissionDetails_FullMethodName = "/loop.MedianContract/LatestTransmissionDetails" + MedianContract_LatestRoundRequested_FullMethodName = "/loop.MedianContract/LatestRoundRequested" +) + // MedianContractClient is the client API for MedianContract service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -367,7 +386,7 @@ func NewMedianContractClient(cc grpc.ClientConnInterface) MedianContractClient { func (c *medianContractClient) LatestTransmissionDetails(ctx context.Context, in *LatestTransmissionDetailsRequest, opts ...grpc.CallOption) (*LatestTransmissionDetailsReply, error) { out := new(LatestTransmissionDetailsReply) - err := c.cc.Invoke(ctx, "/loop.MedianContract/LatestTransmissionDetails", in, out, opts...) + err := c.cc.Invoke(ctx, MedianContract_LatestTransmissionDetails_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -376,7 +395,7 @@ func (c *medianContractClient) LatestTransmissionDetails(ctx context.Context, in func (c *medianContractClient) LatestRoundRequested(ctx context.Context, in *LatestRoundRequestedRequest, opts ...grpc.CallOption) (*LatestRoundRequestedReply, error) { out := new(LatestRoundRequestedReply) - err := c.cc.Invoke(ctx, "/loop.MedianContract/LatestRoundRequested", in, out, opts...) + err := c.cc.Invoke(ctx, MedianContract_LatestRoundRequested_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -425,7 +444,7 @@ func _MedianContract_LatestTransmissionDetails_Handler(srv interface{}, ctx cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.MedianContract/LatestTransmissionDetails", + FullMethod: MedianContract_LatestTransmissionDetails_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MedianContractServer).LatestTransmissionDetails(ctx, req.(*LatestTransmissionDetailsRequest)) @@ -443,7 +462,7 @@ func _MedianContract_LatestRoundRequested_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.MedianContract/LatestRoundRequested", + FullMethod: MedianContract_LatestRoundRequested_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MedianContractServer).LatestRoundRequested(ctx, req.(*LatestRoundRequestedRequest)) @@ -471,6 +490,11 @@ var MedianContract_ServiceDesc = grpc.ServiceDesc{ Metadata: "median.proto", } +const ( + OnchainConfigCodec_Encode_FullMethodName = "/loop.OnchainConfigCodec/Encode" + OnchainConfigCodec_Decode_FullMethodName = "/loop.OnchainConfigCodec/Decode" +) + // OnchainConfigCodecClient is the client API for OnchainConfigCodec service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -489,7 +513,7 @@ func NewOnchainConfigCodecClient(cc grpc.ClientConnInterface) OnchainConfigCodec func (c *onchainConfigCodecClient) Encode(ctx context.Context, in *EncodeRequest, opts ...grpc.CallOption) (*EncodeReply, error) { out := new(EncodeReply) - err := c.cc.Invoke(ctx, "/loop.OnchainConfigCodec/Encode", in, out, opts...) + err := c.cc.Invoke(ctx, OnchainConfigCodec_Encode_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -498,7 +522,7 @@ func (c *onchainConfigCodecClient) Encode(ctx context.Context, in *EncodeRequest func (c *onchainConfigCodecClient) Decode(ctx context.Context, in *DecodeRequest, opts ...grpc.CallOption) (*DecodeReply, error) { out := new(DecodeReply) - err := c.cc.Invoke(ctx, "/loop.OnchainConfigCodec/Decode", in, out, opts...) + err := c.cc.Invoke(ctx, OnchainConfigCodec_Decode_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -547,7 +571,7 @@ func _OnchainConfigCodec_Encode_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.OnchainConfigCodec/Encode", + FullMethod: OnchainConfigCodec_Encode_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OnchainConfigCodecServer).Encode(ctx, req.(*EncodeRequest)) @@ -565,7 +589,7 @@ func _OnchainConfigCodec_Decode_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.OnchainConfigCodec/Decode", + FullMethod: OnchainConfigCodec_Decode_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OnchainConfigCodecServer).Decode(ctx, req.(*DecodeRequest)) diff --git a/pkg/loop/internal/pb/relayer.pb.go b/pkg/loop/internal/pb/relayer.pb.go index a3480ae5b..1d230b3f9 100644 --- a/pkg/loop/internal/pb/relayer.pb.go +++ b/pkg/loop/internal/pb/relayer.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc v3.21.12 // source: relayer.proto @@ -1352,7 +1352,7 @@ func (x *ObserveReply) GetValue() *BigInt { return nil } -// ContractConfig represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfig] +// ContractConfig represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfig] type ContractConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1456,7 +1456,7 @@ func (x *ContractConfig) GetOffchainConfig() []byte { return nil } -// ConfigDigestRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.OffchainConfigDigester.ConfigDigest]. +// ConfigDigestRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.OffchainConfigDigester.ConfigDigest]. type ConfigDigestRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1504,7 +1504,7 @@ func (x *ConfigDigestRequest) GetContractConfig() *ContractConfig { return nil } -// ConfigDigestReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.OffchainConfigDigester.ConfigDigest]. +// ConfigDigestReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.OffchainConfigDigester.ConfigDigest]. type ConfigDigestReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1590,7 +1590,7 @@ func (*ConfigDigestPrefixRequest) Descriptor() ([]byte, []int) { return file_relayer_proto_rawDescGZIP(), []int{27} } -// ConfigDigestPrefixReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.OffchainConfigDigester.ConfigDigestPrefix]. +// ConfigDigestPrefixReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.OffchainConfigDigester.ConfigDigestPrefix]. type ConfigDigestPrefixReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1676,7 +1676,7 @@ func (*LatestConfigDetailsRequest) Descriptor() ([]byte, []int) { return file_relayer_proto_rawDescGZIP(), []int{29} } -// LatestConfigDetailsReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestConfigDetails]. +// LatestConfigDetailsReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestConfigDetails]. type LatestConfigDetailsReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1732,7 +1732,7 @@ func (x *LatestConfigDetailsReply) GetConfigDigest() []byte { return nil } -// LatestConfigRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestConfig]. +// LatestConfigRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestConfig]. type LatestConfigRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1780,7 +1780,7 @@ func (x *LatestConfigRequest) GetChangedInBlock() uint64 { return 0 } -// LatestConfigReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestConfig]. +// LatestConfigReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestConfig]. type LatestConfigReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1866,7 +1866,7 @@ func (*LatestBlockHeightRequest) Descriptor() ([]byte, []int) { return file_relayer_proto_rawDescGZIP(), []int{33} } -// LatestBlockHeightReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestBlockHeightReply]. +// LatestBlockHeightReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestBlockHeightReply]. type LatestBlockHeightReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1914,7 +1914,7 @@ func (x *LatestBlockHeightReply) GetBlockHeight() uint64 { return 0 } -// ReportTimestamp represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportTimestamp]. +// ReportTimestamp represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportTimestamp]. type ReportTimestamp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1978,7 +1978,7 @@ func (x *ReportTimestamp) GetRound() uint32 { return 0 } -// ReportContext represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportContext]. +// ReportContext represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportContext]. type ReportContext struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2034,7 +2034,7 @@ func (x *ReportContext) GetExtraHash() []byte { return nil } -// AttributedOnchainSignature represents [github.com/smartcontractkit/libocr/offchainreporting2/types.AttributedOnchainSignature]. +// AttributedOnchainSignature represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.AttributedOnchainSignature]. type AttributedOnchainSignature struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2090,7 +2090,7 @@ func (x *AttributedOnchainSignature) GetSigner() uint32 { return 0 } -// TransmitRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractTransmitter.Transmit]. +// TransmitRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractTransmitter.Transmit]. type TransmitRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2230,7 +2230,7 @@ func (*LatestConfigDigestAndEpochRequest) Descriptor() ([]byte, []int) { return file_relayer_proto_rawDescGZIP(), []int{40} } -// LatestConfigDigestAndEpochReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractTransmitter.LatestConfigDigestAndEpoch]. +// LatestConfigDigestAndEpochReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractTransmitter.LatestConfigDigestAndEpoch]. type LatestConfigDigestAndEpochReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/loop/internal/pb/relayer.proto b/pkg/loop/internal/pb/relayer.proto index 2ea5d1ca8..d987d6e1e 100644 --- a/pkg/loop/internal/pb/relayer.proto +++ b/pkg/loop/internal/pb/relayer.proto @@ -177,7 +177,7 @@ service OffchainConfigDigester { rpc ConfigDigestPrefix (ConfigDigestPrefixRequest) returns (ConfigDigestPrefixReply) {} } -// ContractConfig represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfig] +// ContractConfig represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfig] message ContractConfig { bytes configDigest = 1; // [32]byte uint64 configCount = 2; @@ -189,19 +189,19 @@ message ContractConfig { bytes offchainConfig = 8; } -// ConfigDigestRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.OffchainConfigDigester.ConfigDigest]. +// ConfigDigestRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.OffchainConfigDigester.ConfigDigest]. message ConfigDigestRequest { ContractConfig contractConfig = 1; } -// ConfigDigestReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.OffchainConfigDigester.ConfigDigest]. +// ConfigDigestReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.OffchainConfigDigester.ConfigDigest]. message ConfigDigestReply { bytes configDigest = 1; // [32]byte } message ConfigDigestPrefixRequest {} -// ConfigDigestPrefixReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.OffchainConfigDigester.ConfigDigestPrefix]. +// ConfigDigestPrefixReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.OffchainConfigDigester.ConfigDigestPrefix]. message ConfigDigestPrefixReply { uint32 configDigestPrefix = 1; // uint16 } @@ -214,25 +214,25 @@ service ContractConfigTracker { message LatestConfigDetailsRequest {} -// LatestConfigDetailsReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestConfigDetails]. +// LatestConfigDetailsReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestConfigDetails]. message LatestConfigDetailsReply { uint64 changedInBlock = 1; bytes configDigest = 2; // [32]byte } -// LatestConfigRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestConfig]. +// LatestConfigRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestConfig]. message LatestConfigRequest { uint64 changedInBlock = 1; } -// LatestConfigReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestConfig]. +// LatestConfigReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestConfig]. message LatestConfigReply { ContractConfig contractConfig = 1; } message LatestBlockHeightRequest {} -// LatestBlockHeightReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractConfigTracker.LatestBlockHeightReply]. +// LatestBlockHeightReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractConfigTracker.LatestBlockHeightReply]. message LatestBlockHeightReply { uint64 blockHeight = 1; } @@ -243,26 +243,26 @@ service ContractTransmitter { rpc FromAccount (FromAccountRequest) returns (FromAccountReply) {} } -// ReportTimestamp represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportTimestamp]. +// ReportTimestamp represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportTimestamp]. message ReportTimestamp { bytes configDigest = 1; // [32]byte uint32 epoch = 2; uint32 round = 3; // uint8 } -// ReportContext represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportContext]. +// ReportContext represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportContext]. message ReportContext { ReportTimestamp reportTimestamp = 1; bytes extraHash = 2; // [32]byte } -// AttributedOnchainSignature represents [github.com/smartcontractkit/libocr/offchainreporting2/types.AttributedOnchainSignature]. +// AttributedOnchainSignature represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.AttributedOnchainSignature]. message AttributedOnchainSignature { bytes signature = 1; uint32 signer = 2; // uint8 } -// TransmitRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractTransmitter.Transmit]. +// TransmitRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractTransmitter.Transmit]. message TransmitRequest { ReportContext reportContext = 1; bytes report = 2; @@ -272,7 +272,7 @@ message TransmitReply {} message LatestConfigDigestAndEpochRequest {} -// LatestConfigDigestAndEpochReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ContractTransmitter.LatestConfigDigestAndEpoch]. +// LatestConfigDigestAndEpochReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ContractTransmitter.LatestConfigDigestAndEpoch]. message LatestConfigDigestAndEpochReply { bytes configDigest = 1; // [32]byte uint32 epoch = 2; @@ -317,4 +317,4 @@ message StarknetSignature { message StarknetMessageHash { BigInt hash = 1; -} \ No newline at end of file +} diff --git a/pkg/loop/internal/pb/relayer_grpc.pb.go b/pkg/loop/internal/pb/relayer_grpc.pb.go index fe26bed04..2f3096aa2 100644 --- a/pkg/loop/internal/pb/relayer_grpc.pb.go +++ b/pkg/loop/internal/pb/relayer_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.12 // source: relayer.proto @@ -19,6 +19,10 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + PluginRelayer_NewRelayer_FullMethodName = "/loop.PluginRelayer/NewRelayer" +) + // PluginRelayerClient is the client API for PluginRelayer service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -36,7 +40,7 @@ func NewPluginRelayerClient(cc grpc.ClientConnInterface) PluginRelayerClient { func (c *pluginRelayerClient) NewRelayer(ctx context.Context, in *NewRelayerRequest, opts ...grpc.CallOption) (*NewRelayerReply, error) { out := new(NewRelayerReply) - err := c.cc.Invoke(ctx, "/loop.PluginRelayer/NewRelayer", in, out, opts...) + err := c.cc.Invoke(ctx, PluginRelayer_NewRelayer_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -81,7 +85,7 @@ func _PluginRelayer_NewRelayer_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.PluginRelayer/NewRelayer", + FullMethod: PluginRelayer_NewRelayer_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(PluginRelayerServer).NewRelayer(ctx, req.(*NewRelayerRequest)) @@ -105,6 +109,11 @@ var PluginRelayer_ServiceDesc = grpc.ServiceDesc{ Metadata: "relayer.proto", } +const ( + Keystore_Accounts_FullMethodName = "/loop.Keystore/Accounts" + Keystore_Sign_FullMethodName = "/loop.Keystore/Sign" +) + // KeystoreClient is the client API for Keystore service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -123,7 +132,7 @@ func NewKeystoreClient(cc grpc.ClientConnInterface) KeystoreClient { func (c *keystoreClient) Accounts(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*AccountsReply, error) { out := new(AccountsReply) - err := c.cc.Invoke(ctx, "/loop.Keystore/Accounts", in, out, opts...) + err := c.cc.Invoke(ctx, Keystore_Accounts_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -132,7 +141,7 @@ func (c *keystoreClient) Accounts(ctx context.Context, in *emptypb.Empty, opts . func (c *keystoreClient) Sign(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignReply, error) { out := new(SignReply) - err := c.cc.Invoke(ctx, "/loop.Keystore/Sign", in, out, opts...) + err := c.cc.Invoke(ctx, Keystore_Sign_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -181,7 +190,7 @@ func _Keystore_Accounts_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Keystore/Accounts", + FullMethod: Keystore_Accounts_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(KeystoreServer).Accounts(ctx, req.(*emptypb.Empty)) @@ -199,7 +208,7 @@ func _Keystore_Sign_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Keystore/Sign", + FullMethod: Keystore_Sign_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(KeystoreServer).Sign(ctx, req.(*SignRequest)) @@ -227,6 +236,16 @@ var Keystore_ServiceDesc = grpc.ServiceDesc{ Metadata: "relayer.proto", } +const ( + Relayer_NewConfigProvider_FullMethodName = "/loop.Relayer/NewConfigProvider" + Relayer_NewMedianProvider_FullMethodName = "/loop.Relayer/NewMedianProvider" + Relayer_NewMercuryProvider_FullMethodName = "/loop.Relayer/NewMercuryProvider" + Relayer_ChainStatus_FullMethodName = "/loop.Relayer/ChainStatus" + Relayer_ChainStatuses_FullMethodName = "/loop.Relayer/ChainStatuses" + Relayer_NodeStatuses_FullMethodName = "/loop.Relayer/NodeStatuses" + Relayer_SendTx_FullMethodName = "/loop.Relayer/SendTx" +) + // RelayerClient is the client API for Relayer service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -250,7 +269,7 @@ func NewRelayerClient(cc grpc.ClientConnInterface) RelayerClient { func (c *relayerClient) NewConfigProvider(ctx context.Context, in *NewConfigProviderRequest, opts ...grpc.CallOption) (*NewConfigProviderReply, error) { out := new(NewConfigProviderReply) - err := c.cc.Invoke(ctx, "/loop.Relayer/NewConfigProvider", in, out, opts...) + err := c.cc.Invoke(ctx, Relayer_NewConfigProvider_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -259,7 +278,7 @@ func (c *relayerClient) NewConfigProvider(ctx context.Context, in *NewConfigProv func (c *relayerClient) NewMedianProvider(ctx context.Context, in *NewMedianProviderRequest, opts ...grpc.CallOption) (*NewMedianProviderReply, error) { out := new(NewMedianProviderReply) - err := c.cc.Invoke(ctx, "/loop.Relayer/NewMedianProvider", in, out, opts...) + err := c.cc.Invoke(ctx, Relayer_NewMedianProvider_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -268,7 +287,7 @@ func (c *relayerClient) NewMedianProvider(ctx context.Context, in *NewMedianProv func (c *relayerClient) NewMercuryProvider(ctx context.Context, in *NewMercuryProviderRequest, opts ...grpc.CallOption) (*NewMercuryProviderReply, error) { out := new(NewMercuryProviderReply) - err := c.cc.Invoke(ctx, "/loop.Relayer/NewMercuryProvider", in, out, opts...) + err := c.cc.Invoke(ctx, Relayer_NewMercuryProvider_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -277,7 +296,7 @@ func (c *relayerClient) NewMercuryProvider(ctx context.Context, in *NewMercuryPr func (c *relayerClient) ChainStatus(ctx context.Context, in *ChainStatusRequest, opts ...grpc.CallOption) (*ChainStatusReply, error) { out := new(ChainStatusReply) - err := c.cc.Invoke(ctx, "/loop.Relayer/ChainStatus", in, out, opts...) + err := c.cc.Invoke(ctx, Relayer_ChainStatus_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -286,7 +305,7 @@ func (c *relayerClient) ChainStatus(ctx context.Context, in *ChainStatusRequest, func (c *relayerClient) ChainStatuses(ctx context.Context, in *ChainStatusesRequest, opts ...grpc.CallOption) (*ChainStatusesReply, error) { out := new(ChainStatusesReply) - err := c.cc.Invoke(ctx, "/loop.Relayer/ChainStatuses", in, out, opts...) + err := c.cc.Invoke(ctx, Relayer_ChainStatuses_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -295,7 +314,7 @@ func (c *relayerClient) ChainStatuses(ctx context.Context, in *ChainStatusesRequ func (c *relayerClient) NodeStatuses(ctx context.Context, in *NodeStatusesRequest, opts ...grpc.CallOption) (*NodeStatusesReply, error) { out := new(NodeStatusesReply) - err := c.cc.Invoke(ctx, "/loop.Relayer/NodeStatuses", in, out, opts...) + err := c.cc.Invoke(ctx, Relayer_NodeStatuses_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -304,7 +323,7 @@ func (c *relayerClient) NodeStatuses(ctx context.Context, in *NodeStatusesReques func (c *relayerClient) SendTx(ctx context.Context, in *SendTxRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/loop.Relayer/SendTx", in, out, opts...) + err := c.cc.Invoke(ctx, Relayer_SendTx_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -373,7 +392,7 @@ func _Relayer_NewConfigProvider_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Relayer/NewConfigProvider", + FullMethod: Relayer_NewConfigProvider_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayerServer).NewConfigProvider(ctx, req.(*NewConfigProviderRequest)) @@ -391,7 +410,7 @@ func _Relayer_NewMedianProvider_Handler(srv interface{}, ctx context.Context, de } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Relayer/NewMedianProvider", + FullMethod: Relayer_NewMedianProvider_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayerServer).NewMedianProvider(ctx, req.(*NewMedianProviderRequest)) @@ -409,7 +428,7 @@ func _Relayer_NewMercuryProvider_Handler(srv interface{}, ctx context.Context, d } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Relayer/NewMercuryProvider", + FullMethod: Relayer_NewMercuryProvider_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayerServer).NewMercuryProvider(ctx, req.(*NewMercuryProviderRequest)) @@ -427,7 +446,7 @@ func _Relayer_ChainStatus_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Relayer/ChainStatus", + FullMethod: Relayer_ChainStatus_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayerServer).ChainStatus(ctx, req.(*ChainStatusRequest)) @@ -445,7 +464,7 @@ func _Relayer_ChainStatuses_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Relayer/ChainStatuses", + FullMethod: Relayer_ChainStatuses_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayerServer).ChainStatuses(ctx, req.(*ChainStatusesRequest)) @@ -463,7 +482,7 @@ func _Relayer_NodeStatuses_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Relayer/NodeStatuses", + FullMethod: Relayer_NodeStatuses_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayerServer).NodeStatuses(ctx, req.(*NodeStatusesRequest)) @@ -481,7 +500,7 @@ func _Relayer_SendTx_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Relayer/SendTx", + FullMethod: Relayer_SendTx_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayerServer).SendTx(ctx, req.(*SendTxRequest)) @@ -529,6 +548,10 @@ var Relayer_ServiceDesc = grpc.ServiceDesc{ Metadata: "relayer.proto", } +const ( + DataSource_Observe_FullMethodName = "/loop.DataSource/Observe" +) + // DataSourceClient is the client API for DataSource service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -546,7 +569,7 @@ func NewDataSourceClient(cc grpc.ClientConnInterface) DataSourceClient { func (c *dataSourceClient) Observe(ctx context.Context, in *ObserveRequest, opts ...grpc.CallOption) (*ObserveReply, error) { out := new(ObserveReply) - err := c.cc.Invoke(ctx, "/loop.DataSource/Observe", in, out, opts...) + err := c.cc.Invoke(ctx, DataSource_Observe_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -591,7 +614,7 @@ func _DataSource_Observe_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.DataSource/Observe", + FullMethod: DataSource_Observe_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(DataSourceServer).Observe(ctx, req.(*ObserveRequest)) @@ -615,6 +638,11 @@ var DataSource_ServiceDesc = grpc.ServiceDesc{ Metadata: "relayer.proto", } +const ( + OffchainConfigDigester_ConfigDigest_FullMethodName = "/loop.OffchainConfigDigester/ConfigDigest" + OffchainConfigDigester_ConfigDigestPrefix_FullMethodName = "/loop.OffchainConfigDigester/ConfigDigestPrefix" +) + // OffchainConfigDigesterClient is the client API for OffchainConfigDigester service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -633,7 +661,7 @@ func NewOffchainConfigDigesterClient(cc grpc.ClientConnInterface) OffchainConfig func (c *offchainConfigDigesterClient) ConfigDigest(ctx context.Context, in *ConfigDigestRequest, opts ...grpc.CallOption) (*ConfigDigestReply, error) { out := new(ConfigDigestReply) - err := c.cc.Invoke(ctx, "/loop.OffchainConfigDigester/ConfigDigest", in, out, opts...) + err := c.cc.Invoke(ctx, OffchainConfigDigester_ConfigDigest_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -642,7 +670,7 @@ func (c *offchainConfigDigesterClient) ConfigDigest(ctx context.Context, in *Con func (c *offchainConfigDigesterClient) ConfigDigestPrefix(ctx context.Context, in *ConfigDigestPrefixRequest, opts ...grpc.CallOption) (*ConfigDigestPrefixReply, error) { out := new(ConfigDigestPrefixReply) - err := c.cc.Invoke(ctx, "/loop.OffchainConfigDigester/ConfigDigestPrefix", in, out, opts...) + err := c.cc.Invoke(ctx, OffchainConfigDigester_ConfigDigestPrefix_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -692,7 +720,7 @@ func _OffchainConfigDigester_ConfigDigest_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.OffchainConfigDigester/ConfigDigest", + FullMethod: OffchainConfigDigester_ConfigDigest_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OffchainConfigDigesterServer).ConfigDigest(ctx, req.(*ConfigDigestRequest)) @@ -710,7 +738,7 @@ func _OffchainConfigDigester_ConfigDigestPrefix_Handler(srv interface{}, ctx con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.OffchainConfigDigester/ConfigDigestPrefix", + FullMethod: OffchainConfigDigester_ConfigDigestPrefix_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(OffchainConfigDigesterServer).ConfigDigestPrefix(ctx, req.(*ConfigDigestPrefixRequest)) @@ -738,6 +766,12 @@ var OffchainConfigDigester_ServiceDesc = grpc.ServiceDesc{ Metadata: "relayer.proto", } +const ( + ContractConfigTracker_LatestConfigDetails_FullMethodName = "/loop.ContractConfigTracker/LatestConfigDetails" + ContractConfigTracker_LatestConfig_FullMethodName = "/loop.ContractConfigTracker/LatestConfig" + ContractConfigTracker_LatestBlockHeight_FullMethodName = "/loop.ContractConfigTracker/LatestBlockHeight" +) + // ContractConfigTrackerClient is the client API for ContractConfigTracker service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -757,7 +791,7 @@ func NewContractConfigTrackerClient(cc grpc.ClientConnInterface) ContractConfigT func (c *contractConfigTrackerClient) LatestConfigDetails(ctx context.Context, in *LatestConfigDetailsRequest, opts ...grpc.CallOption) (*LatestConfigDetailsReply, error) { out := new(LatestConfigDetailsReply) - err := c.cc.Invoke(ctx, "/loop.ContractConfigTracker/LatestConfigDetails", in, out, opts...) + err := c.cc.Invoke(ctx, ContractConfigTracker_LatestConfigDetails_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -766,7 +800,7 @@ func (c *contractConfigTrackerClient) LatestConfigDetails(ctx context.Context, i func (c *contractConfigTrackerClient) LatestConfig(ctx context.Context, in *LatestConfigRequest, opts ...grpc.CallOption) (*LatestConfigReply, error) { out := new(LatestConfigReply) - err := c.cc.Invoke(ctx, "/loop.ContractConfigTracker/LatestConfig", in, out, opts...) + err := c.cc.Invoke(ctx, ContractConfigTracker_LatestConfig_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -775,7 +809,7 @@ func (c *contractConfigTrackerClient) LatestConfig(ctx context.Context, in *Late func (c *contractConfigTrackerClient) LatestBlockHeight(ctx context.Context, in *LatestBlockHeightRequest, opts ...grpc.CallOption) (*LatestBlockHeightReply, error) { out := new(LatestBlockHeightReply) - err := c.cc.Invoke(ctx, "/loop.ContractConfigTracker/LatestBlockHeight", in, out, opts...) + err := c.cc.Invoke(ctx, ContractConfigTracker_LatestBlockHeight_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -828,7 +862,7 @@ func _ContractConfigTracker_LatestConfigDetails_Handler(srv interface{}, ctx con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ContractConfigTracker/LatestConfigDetails", + FullMethod: ContractConfigTracker_LatestConfigDetails_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContractConfigTrackerServer).LatestConfigDetails(ctx, req.(*LatestConfigDetailsRequest)) @@ -846,7 +880,7 @@ func _ContractConfigTracker_LatestConfig_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ContractConfigTracker/LatestConfig", + FullMethod: ContractConfigTracker_LatestConfig_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContractConfigTrackerServer).LatestConfig(ctx, req.(*LatestConfigRequest)) @@ -864,7 +898,7 @@ func _ContractConfigTracker_LatestBlockHeight_Handler(srv interface{}, ctx conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ContractConfigTracker/LatestBlockHeight", + FullMethod: ContractConfigTracker_LatestBlockHeight_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContractConfigTrackerServer).LatestBlockHeight(ctx, req.(*LatestBlockHeightRequest)) @@ -896,6 +930,12 @@ var ContractConfigTracker_ServiceDesc = grpc.ServiceDesc{ Metadata: "relayer.proto", } +const ( + ContractTransmitter_Transmit_FullMethodName = "/loop.ContractTransmitter/Transmit" + ContractTransmitter_LatestConfigDigestAndEpoch_FullMethodName = "/loop.ContractTransmitter/LatestConfigDigestAndEpoch" + ContractTransmitter_FromAccount_FullMethodName = "/loop.ContractTransmitter/FromAccount" +) + // ContractTransmitterClient is the client API for ContractTransmitter service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -915,7 +955,7 @@ func NewContractTransmitterClient(cc grpc.ClientConnInterface) ContractTransmitt func (c *contractTransmitterClient) Transmit(ctx context.Context, in *TransmitRequest, opts ...grpc.CallOption) (*TransmitReply, error) { out := new(TransmitReply) - err := c.cc.Invoke(ctx, "/loop.ContractTransmitter/Transmit", in, out, opts...) + err := c.cc.Invoke(ctx, ContractTransmitter_Transmit_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -924,7 +964,7 @@ func (c *contractTransmitterClient) Transmit(ctx context.Context, in *TransmitRe func (c *contractTransmitterClient) LatestConfigDigestAndEpoch(ctx context.Context, in *LatestConfigDigestAndEpochRequest, opts ...grpc.CallOption) (*LatestConfigDigestAndEpochReply, error) { out := new(LatestConfigDigestAndEpochReply) - err := c.cc.Invoke(ctx, "/loop.ContractTransmitter/LatestConfigDigestAndEpoch", in, out, opts...) + err := c.cc.Invoke(ctx, ContractTransmitter_LatestConfigDigestAndEpoch_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -933,7 +973,7 @@ func (c *contractTransmitterClient) LatestConfigDigestAndEpoch(ctx context.Conte func (c *contractTransmitterClient) FromAccount(ctx context.Context, in *FromAccountRequest, opts ...grpc.CallOption) (*FromAccountReply, error) { out := new(FromAccountReply) - err := c.cc.Invoke(ctx, "/loop.ContractTransmitter/FromAccount", in, out, opts...) + err := c.cc.Invoke(ctx, ContractTransmitter_FromAccount_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -986,7 +1026,7 @@ func _ContractTransmitter_Transmit_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ContractTransmitter/Transmit", + FullMethod: ContractTransmitter_Transmit_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContractTransmitterServer).Transmit(ctx, req.(*TransmitRequest)) @@ -1004,7 +1044,7 @@ func _ContractTransmitter_LatestConfigDigestAndEpoch_Handler(srv interface{}, ct } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ContractTransmitter/LatestConfigDigestAndEpoch", + FullMethod: ContractTransmitter_LatestConfigDigestAndEpoch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContractTransmitterServer).LatestConfigDigestAndEpoch(ctx, req.(*LatestConfigDigestAndEpochRequest)) @@ -1022,7 +1062,7 @@ func _ContractTransmitter_FromAccount_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ContractTransmitter/FromAccount", + FullMethod: ContractTransmitter_FromAccount_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ContractTransmitterServer).FromAccount(ctx, req.(*FromAccountRequest)) @@ -1054,6 +1094,13 @@ var ContractTransmitter_ServiceDesc = grpc.ServiceDesc{ Metadata: "relayer.proto", } +const ( + Service_Name_FullMethodName = "/loop.Service/Name" + Service_Close_FullMethodName = "/loop.Service/Close" + Service_Ready_FullMethodName = "/loop.Service/Ready" + Service_HealthReport_FullMethodName = "/loop.Service/HealthReport" +) + // ServiceClient is the client API for Service service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -1074,7 +1121,7 @@ func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient { func (c *serviceClient) Name(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NameReply, error) { out := new(NameReply) - err := c.cc.Invoke(ctx, "/loop.Service/Name", in, out, opts...) + err := c.cc.Invoke(ctx, Service_Name_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -1083,7 +1130,7 @@ func (c *serviceClient) Name(ctx context.Context, in *emptypb.Empty, opts ...grp func (c *serviceClient) Close(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/loop.Service/Close", in, out, opts...) + err := c.cc.Invoke(ctx, Service_Close_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -1092,7 +1139,7 @@ func (c *serviceClient) Close(ctx context.Context, in *emptypb.Empty, opts ...gr func (c *serviceClient) Ready(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/loop.Service/Ready", in, out, opts...) + err := c.cc.Invoke(ctx, Service_Ready_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -1101,7 +1148,7 @@ func (c *serviceClient) Ready(ctx context.Context, in *emptypb.Empty, opts ...gr func (c *serviceClient) HealthReport(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*HealthReportReply, error) { out := new(HealthReportReply) - err := c.cc.Invoke(ctx, "/loop.Service/HealthReport", in, out, opts...) + err := c.cc.Invoke(ctx, Service_HealthReport_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -1158,7 +1205,7 @@ func _Service_Name_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Service/Name", + FullMethod: Service_Name_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Name(ctx, req.(*emptypb.Empty)) @@ -1176,7 +1223,7 @@ func _Service_Close_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Service/Close", + FullMethod: Service_Close_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Close(ctx, req.(*emptypb.Empty)) @@ -1194,7 +1241,7 @@ func _Service_Ready_Handler(srv interface{}, ctx context.Context, dec func(inter } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Service/Ready", + FullMethod: Service_Ready_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).Ready(ctx, req.(*emptypb.Empty)) @@ -1212,7 +1259,7 @@ func _Service_HealthReport_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.Service/HealthReport", + FullMethod: Service_HealthReport_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).HealthReport(ctx, req.(*emptypb.Empty)) diff --git a/pkg/loop/internal/pb/reporting.pb.go b/pkg/loop/internal/pb/reporting.pb.go index 504f12a0e..1fb7e4b1f 100644 --- a/pkg/loop/internal/pb/reporting.pb.go +++ b/pkg/loop/internal/pb/reporting.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc v3.21.12 // source: reporting.proto @@ -123,7 +123,7 @@ func (x *NewReportingPluginReply) GetReportingPluginInfo() *ReportingPluginInfo return nil } -// ReportingPluginConfig represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPluginConfig] +// ReportingPluginConfig represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPluginConfig] type ReportingPluginConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -259,7 +259,7 @@ func (x *ReportingPluginConfig) GetMaxDurationShouldTransmitAcceptedReport() int return 0 } -// ReportingPluginLimits represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPluginLimits] +// ReportingPluginLimits represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPluginLimits] type ReportingPluginLimits struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -323,7 +323,7 @@ func (x *ReportingPluginLimits) GetMaxReportLength() uint64 { return 0 } -// ReportingPluginInfo represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPluginInfo] +// ReportingPluginInfo represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPluginInfo] type ReportingPluginInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -387,7 +387,7 @@ func (x *ReportingPluginInfo) GetReportingPluginLimits() *ReportingPluginLimits return nil } -// QueryRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Query]. +// QueryRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Query]. type QueryRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -435,7 +435,7 @@ func (x *QueryRequest) GetReportTimestamp() *ReportTimestamp { return nil } -// QueryReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Query]. +// QueryReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Query]. type QueryReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -483,7 +483,7 @@ func (x *QueryReply) GetQuery() []byte { return nil } -// ObservationRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Observation]. +// ObservationRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Observation]. type ObservationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -539,7 +539,7 @@ func (x *ObservationRequest) GetQuery() []byte { return nil } -// ObservationReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Observation]. +// ObservationReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Observation]. type ObservationReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -587,7 +587,7 @@ func (x *ObservationReply) GetObservation() []byte { return nil } -// AttributedObservation represents [github.com/smartcontractkit/libocr/offchainreporting2/types.AttributedObservation] +// AttributedObservation represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.AttributedObservation] type AttributedObservation struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -643,7 +643,7 @@ func (x *AttributedObservation) GetObserver() uint32 { return 0 } -// ReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Report]. +// ReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Report]. type ReportRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -707,7 +707,7 @@ func (x *ReportRequest) GetObservations() []*AttributedObservation { return nil } -// ReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Report]. +// ReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Report]. type ReportReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -763,7 +763,7 @@ func (x *ReportReply) GetReport() []byte { return nil } -// ShouldAcceptFinalizedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldAcceptFinalizedReport]. +// ShouldAcceptFinalizedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldAcceptFinalizedReport]. type ShouldAcceptFinalizedReportRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -819,7 +819,7 @@ func (x *ShouldAcceptFinalizedReportRequest) GetReport() []byte { return nil } -// ShouldAcceptFinalizedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldAcceptFinalizedReport]. +// ShouldAcceptFinalizedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldAcceptFinalizedReport]. type ShouldAcceptFinalizedReportReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -867,7 +867,7 @@ func (x *ShouldAcceptFinalizedReportReply) GetShouldAccept() bool { return false } -// ShouldTransmitAcceptedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldTransmitAcceptedReport]. +// ShouldTransmitAcceptedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldTransmitAcceptedReport]. type ShouldTransmitAcceptedReportRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -923,7 +923,7 @@ func (x *ShouldTransmitAcceptedReportRequest) GetReport() []byte { return nil } -// ShouldTransmitAcceptedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldTransmitAcceptedReport]. +// ShouldTransmitAcceptedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldTransmitAcceptedReport]. type ShouldTransmitAcceptedReportReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/loop/internal/pb/reporting.proto b/pkg/loop/internal/pb/reporting.proto index e42957a9c..cd341faaf 100644 --- a/pkg/loop/internal/pb/reporting.proto +++ b/pkg/loop/internal/pb/reporting.proto @@ -20,7 +20,7 @@ message NewReportingPluginReply { ReportingPluginInfo reportingPluginInfo = 2; } -// ReportingPluginConfig represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPluginConfig] +// ReportingPluginConfig represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPluginConfig] message ReportingPluginConfig { bytes configDigest = 1; // [32]byte uint32 oracleID = 2; // uint8 @@ -36,14 +36,14 @@ message ReportingPluginConfig { int64 maxDurationShouldTransmitAcceptedReport = 12; } -// ReportingPluginLimits represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPluginLimits] +// ReportingPluginLimits represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPluginLimits] message ReportingPluginLimits { uint64 maxQueryLength = 1; uint64 maxObservationLength = 2; uint64 maxReportLength = 3; } -// ReportingPluginInfo represents [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPluginInfo] +// ReportingPluginInfo represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPluginInfo] message ReportingPluginInfo { string name = 1; bool uniqueReports = 2; @@ -59,64 +59,64 @@ service ReportingPlugin { rpc Close (google.protobuf.Empty) returns (google.protobuf.Empty) {} } -// QueryRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Query]. +// QueryRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Query]. message QueryRequest { ReportTimestamp reportTimestamp = 1; } -// QueryReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Query]. +// QueryReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Query]. message QueryReply { bytes query = 1; } -// ObservationRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Observation]. +// ObservationRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Observation]. message ObservationRequest { ReportTimestamp reportTimestamp = 1; bytes query = 2; } -// ObservationReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Observation]. +// ObservationReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Observation]. message ObservationReply { bytes observation = 1; } -// AttributedObservation represents [github.com/smartcontractkit/libocr/offchainreporting2/types.AttributedObservation] +// AttributedObservation represents [github.com/smartcontractkit/libocr/offchainreporting2plus/types.AttributedObservation] message AttributedObservation { bytes observation = 1; uint32 observer = 2; // uint8 } -// ReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Report]. +// ReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Report]. message ReportRequest { ReportTimestamp reportTimestamp = 1; bytes query = 2; repeated AttributedObservation observations = 3; } -// ReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.Report]. +// ReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.Report]. message ReportReply { bool shouldReport = 1; bytes report = 2; } -// ShouldAcceptFinalizedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldAcceptFinalizedReport]. +// ShouldAcceptFinalizedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldAcceptFinalizedReport]. message ShouldAcceptFinalizedReportRequest { ReportTimestamp reportTimestamp = 1; bytes report = 2; } -// ShouldAcceptFinalizedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldAcceptFinalizedReport]. +// ShouldAcceptFinalizedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldAcceptFinalizedReport]. message ShouldAcceptFinalizedReportReply { bool shouldAccept = 1; } -// ShouldTransmitAcceptedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldTransmitAcceptedReport]. +// ShouldTransmitAcceptedReportRequest has arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldTransmitAcceptedReport]. message ShouldTransmitAcceptedReportRequest { ReportTimestamp reportTimestamp = 1; bytes report = 2; } -// ShouldTransmitAcceptedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2/types.ReportingPlugin.ShouldTransmitAcceptedReport]. +// ShouldTransmitAcceptedReportReply has return arguments for [github.com/smartcontractkit/libocr/offchainreporting2plus/types.ReportingPlugin.ShouldTransmitAcceptedReport]. message ShouldTransmitAcceptedReportReply { bool shouldTransmit = 1; } \ No newline at end of file diff --git a/pkg/loop/internal/pb/reporting_grpc.pb.go b/pkg/loop/internal/pb/reporting_grpc.pb.go index a2441d39c..b7520830c 100644 --- a/pkg/loop/internal/pb/reporting_grpc.pb.go +++ b/pkg/loop/internal/pb/reporting_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc v3.21.12 // source: reporting.proto @@ -19,6 +19,10 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + ReportingPluginFactory_NewReportingPlugin_FullMethodName = "/loop.ReportingPluginFactory/NewReportingPlugin" +) + // ReportingPluginFactoryClient is the client API for ReportingPluginFactory service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -36,7 +40,7 @@ func NewReportingPluginFactoryClient(cc grpc.ClientConnInterface) ReportingPlugi func (c *reportingPluginFactoryClient) NewReportingPlugin(ctx context.Context, in *NewReportingPluginRequest, opts ...grpc.CallOption) (*NewReportingPluginReply, error) { out := new(NewReportingPluginReply) - err := c.cc.Invoke(ctx, "/loop.ReportingPluginFactory/NewReportingPlugin", in, out, opts...) + err := c.cc.Invoke(ctx, ReportingPluginFactory_NewReportingPlugin_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -82,7 +86,7 @@ func _ReportingPluginFactory_NewReportingPlugin_Handler(srv interface{}, ctx con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportingPluginFactory/NewReportingPlugin", + FullMethod: ReportingPluginFactory_NewReportingPlugin_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportingPluginFactoryServer).NewReportingPlugin(ctx, req.(*NewReportingPluginRequest)) @@ -106,6 +110,15 @@ var ReportingPluginFactory_ServiceDesc = grpc.ServiceDesc{ Metadata: "reporting.proto", } +const ( + ReportingPlugin_Query_FullMethodName = "/loop.ReportingPlugin/Query" + ReportingPlugin_Observation_FullMethodName = "/loop.ReportingPlugin/Observation" + ReportingPlugin_Report_FullMethodName = "/loop.ReportingPlugin/Report" + ReportingPlugin_ShouldAcceptFinalizedReport_FullMethodName = "/loop.ReportingPlugin/ShouldAcceptFinalizedReport" + ReportingPlugin_ShouldTransmitAcceptedReport_FullMethodName = "/loop.ReportingPlugin/ShouldTransmitAcceptedReport" + ReportingPlugin_Close_FullMethodName = "/loop.ReportingPlugin/Close" +) + // ReportingPluginClient is the client API for ReportingPlugin service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -128,7 +141,7 @@ func NewReportingPluginClient(cc grpc.ClientConnInterface) ReportingPluginClient func (c *reportingPluginClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryReply, error) { out := new(QueryReply) - err := c.cc.Invoke(ctx, "/loop.ReportingPlugin/Query", in, out, opts...) + err := c.cc.Invoke(ctx, ReportingPlugin_Query_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -137,7 +150,7 @@ func (c *reportingPluginClient) Query(ctx context.Context, in *QueryRequest, opt func (c *reportingPluginClient) Observation(ctx context.Context, in *ObservationRequest, opts ...grpc.CallOption) (*ObservationReply, error) { out := new(ObservationReply) - err := c.cc.Invoke(ctx, "/loop.ReportingPlugin/Observation", in, out, opts...) + err := c.cc.Invoke(ctx, ReportingPlugin_Observation_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -146,7 +159,7 @@ func (c *reportingPluginClient) Observation(ctx context.Context, in *Observation func (c *reportingPluginClient) Report(ctx context.Context, in *ReportRequest, opts ...grpc.CallOption) (*ReportReply, error) { out := new(ReportReply) - err := c.cc.Invoke(ctx, "/loop.ReportingPlugin/Report", in, out, opts...) + err := c.cc.Invoke(ctx, ReportingPlugin_Report_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -155,7 +168,7 @@ func (c *reportingPluginClient) Report(ctx context.Context, in *ReportRequest, o func (c *reportingPluginClient) ShouldAcceptFinalizedReport(ctx context.Context, in *ShouldAcceptFinalizedReportRequest, opts ...grpc.CallOption) (*ShouldAcceptFinalizedReportReply, error) { out := new(ShouldAcceptFinalizedReportReply) - err := c.cc.Invoke(ctx, "/loop.ReportingPlugin/ShouldAcceptFinalizedReport", in, out, opts...) + err := c.cc.Invoke(ctx, ReportingPlugin_ShouldAcceptFinalizedReport_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -164,7 +177,7 @@ func (c *reportingPluginClient) ShouldAcceptFinalizedReport(ctx context.Context, func (c *reportingPluginClient) ShouldTransmitAcceptedReport(ctx context.Context, in *ShouldTransmitAcceptedReportRequest, opts ...grpc.CallOption) (*ShouldTransmitAcceptedReportReply, error) { out := new(ShouldTransmitAcceptedReportReply) - err := c.cc.Invoke(ctx, "/loop.ReportingPlugin/ShouldTransmitAcceptedReport", in, out, opts...) + err := c.cc.Invoke(ctx, ReportingPlugin_ShouldTransmitAcceptedReport_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -173,7 +186,7 @@ func (c *reportingPluginClient) ShouldTransmitAcceptedReport(ctx context.Context func (c *reportingPluginClient) Close(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/loop.ReportingPlugin/Close", in, out, opts...) + err := c.cc.Invoke(ctx, ReportingPlugin_Close_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -238,7 +251,7 @@ func _ReportingPlugin_Query_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportingPlugin/Query", + FullMethod: ReportingPlugin_Query_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportingPluginServer).Query(ctx, req.(*QueryRequest)) @@ -256,7 +269,7 @@ func _ReportingPlugin_Observation_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportingPlugin/Observation", + FullMethod: ReportingPlugin_Observation_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportingPluginServer).Observation(ctx, req.(*ObservationRequest)) @@ -274,7 +287,7 @@ func _ReportingPlugin_Report_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportingPlugin/Report", + FullMethod: ReportingPlugin_Report_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportingPluginServer).Report(ctx, req.(*ReportRequest)) @@ -292,7 +305,7 @@ func _ReportingPlugin_ShouldAcceptFinalizedReport_Handler(srv interface{}, ctx c } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportingPlugin/ShouldAcceptFinalizedReport", + FullMethod: ReportingPlugin_ShouldAcceptFinalizedReport_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportingPluginServer).ShouldAcceptFinalizedReport(ctx, req.(*ShouldAcceptFinalizedReportRequest)) @@ -310,7 +323,7 @@ func _ReportingPlugin_ShouldTransmitAcceptedReport_Handler(srv interface{}, ctx } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportingPlugin/ShouldTransmitAcceptedReport", + FullMethod: ReportingPlugin_ShouldTransmitAcceptedReport_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportingPluginServer).ShouldTransmitAcceptedReport(ctx, req.(*ShouldTransmitAcceptedReportRequest)) @@ -328,7 +341,7 @@ func _ReportingPlugin_Close_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/loop.ReportingPlugin/Close", + FullMethod: ReportingPlugin_Close_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ReportingPluginServer).Close(ctx, req.(*emptypb.Empty)) diff --git a/pkg/loop/internal/provider.go b/pkg/loop/internal/provider.go index 3183b0d34..1c06ef2e5 100644 --- a/pkg/loop/internal/provider.go +++ b/pkg/loop/internal/provider.go @@ -6,7 +6,7 @@ import ( "math" "github.com/smartcontractkit/libocr/commontypes" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal/pb" ) diff --git a/pkg/loop/internal/reporting.go b/pkg/loop/internal/reporting.go index 28d52f4a7..c75725e19 100644 --- a/pkg/loop/internal/reporting.go +++ b/pkg/loop/internal/reporting.go @@ -9,7 +9,7 @@ import ( "google.golang.org/protobuf/types/known/emptypb" "github.com/smartcontractkit/libocr/commontypes" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/loop/internal/pb" "github.com/smartcontractkit/chainlink-relay/pkg/types" diff --git a/pkg/loop/internal/test/config.go b/pkg/loop/internal/test/config.go index ba53f368a..fa01e8446 100644 --- a/pkg/loop/internal/test/config.go +++ b/pkg/loop/internal/test/config.go @@ -5,9 +5,9 @@ import ( "context" "fmt" - "github.com/stretchr/testify/assert" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/stretchr/testify/assert" ) type staticConfigProvider struct{} diff --git a/pkg/loop/internal/test/datasource.go b/pkg/loop/internal/test/datasource.go index c44fbc743..e62a989be 100644 --- a/pkg/loop/internal/test/datasource.go +++ b/pkg/loop/internal/test/datasource.go @@ -6,7 +6,7 @@ import ( "math/big" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) var _ median.DataSource = (*staticDataSource)(nil) diff --git a/pkg/loop/internal/test/median.go b/pkg/loop/internal/test/median.go index 6cca70303..5f1d94919 100644 --- a/pkg/loop/internal/test/median.go +++ b/pkg/loop/internal/test/median.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/types" "github.com/smartcontractkit/chainlink-relay/pkg/utils" diff --git a/pkg/loop/internal/test/reporting.go b/pkg/loop/internal/test/reporting.go index 2d93de979..742bcfc90 100644 --- a/pkg/loop/internal/test/reporting.go +++ b/pkg/loop/internal/test/reporting.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) type staticReportingPlugin struct{} diff --git a/pkg/loop/internal/test/test.go b/pkg/loop/internal/test/test.go index 700e98a2b..167bca455 100644 --- a/pkg/loop/internal/test/test.go +++ b/pkg/loop/internal/test/test.go @@ -8,7 +8,7 @@ import ( "github.com/smartcontractkit/libocr/commontypes" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - libocr "github.com/smartcontractkit/libocr/offchainreporting2/types" + libocr "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/types" ) diff --git a/pkg/loop/median_service.go b/pkg/loop/median_service.go index 593c82b5c..897b52efd 100644 --- a/pkg/loop/median_service.go +++ b/pkg/loop/median_service.go @@ -6,7 +6,7 @@ import ( "os/exec" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2/types" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/logger" "github.com/smartcontractkit/chainlink-relay/pkg/types" diff --git a/pkg/monitoring/config_node.go b/pkg/monitoring/config_node.go index 9bd202c03..91159c56b 100644 --- a/pkg/monitoring/config_node.go +++ b/pkg/monitoring/config_node.go @@ -3,7 +3,7 @@ package monitoring import ( "io" - "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) // NodesParser extracts multiple nodes' configurations from the configuration server, eg. weiwatchers.com diff --git a/pkg/monitoring/exporter_prometheus.go b/pkg/monitoring/exporter_prometheus.go index 68b7f1d52..da1ed0795 100644 --- a/pkg/monitoring/exporter_prometheus.go +++ b/pkg/monitoring/exporter_prometheus.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) func NewPrometheusExporterFactory( diff --git a/pkg/monitoring/mapping.go b/pkg/monitoring/mapping.go index b19585d33..80009dec1 100644 --- a/pkg/monitoring/mapping.go +++ b/pkg/monitoring/mapping.go @@ -7,9 +7,10 @@ import ( "fmt" "math/big" - "github.com/smartcontractkit/libocr/offchainreporting2/types" "google.golang.org/protobuf/proto" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "github.com/smartcontractkit/chainlink-relay/pkg/monitoring/pb" ) diff --git a/pkg/monitoring/pb/offchainreporting2_monitoring_median_config.pb.go b/pkg/monitoring/pb/offchainreporting2_monitoring_median_config.pb.go index ddcd215f2..5187b9530 100644 --- a/pkg/monitoring/pb/offchainreporting2_monitoring_median_config.pb.go +++ b/pkg/monitoring/pb/offchainreporting2_monitoring_median_config.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.13.0 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: offchainreporting2_monitoring_median_config.proto package pb import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type NumericalMedianConfigProto struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/monitoring/pb/offchainreporting2_monitoring_offchain_config.pb.go b/pkg/monitoring/pb/offchainreporting2_monitoring_offchain_config.pb.go index f2d6a4e8e..06173e82d 100644 --- a/pkg/monitoring/pb/offchainreporting2_monitoring_offchain_config.pb.go +++ b/pkg/monitoring/pb/offchainreporting2_monitoring_offchain_config.pb.go @@ -1,13 +1,12 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0 -// protoc v3.13.0 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: offchainreporting2_monitoring_offchain_config.proto package pb import ( - proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -21,10 +20,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - type OffchainConfigProto struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/pkg/monitoring/source_outputs.go b/pkg/monitoring/source_outputs.go index ddcbd347c..0f664485b 100644 --- a/pkg/monitoring/source_outputs.go +++ b/pkg/monitoring/source_outputs.go @@ -4,7 +4,7 @@ import ( "math/big" "time" - "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) // Envelope contains data that is required from all the chain integrations. diff --git a/pkg/monitoring/testutils.go b/pkg/monitoring/testutils.go index 4c684b70e..81e6117c1 100644 --- a/pkg/monitoring/testutils.go +++ b/pkg/monitoring/testutils.go @@ -18,7 +18,7 @@ import ( "github.com/linkedin/goavro/v2" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "google.golang.org/protobuf/proto" "github.com/smartcontractkit/chainlink-relay/pkg/logger" diff --git a/pkg/reportingplugins/mercury/aggregate_functions.go b/pkg/reportingplugins/mercury/aggregate_functions.go index aa93ca5f1..0cf2afaf9 100644 --- a/pkg/reportingplugins/mercury/aggregate_functions.go +++ b/pkg/reportingplugins/mercury/aggregate_functions.go @@ -1,6 +1,7 @@ package mercury import ( + "fmt" "math/big" "sort" @@ -19,64 +20,110 @@ func GetConsensusTimestamp(paos []ParsedAttributedObservation) uint32 { } // GetConsensusBenchmarkPrice gets the median benchmark price -func GetConsensusBenchmarkPrice(paos []ParsedAttributedObservation) *big.Int { - sort.Slice(paos, func(i, j int) bool { - return paos[i].BenchmarkPrice.Cmp(paos[j].BenchmarkPrice) < 0 +func GetConsensusBenchmarkPrice(paos []ParsedAttributedObservation, f int) (*big.Int, error) { + var validBenchmarkPrices []*big.Int + for _, pao := range paos { + if pao.PricesValid { + validBenchmarkPrices = append(validBenchmarkPrices, pao.BenchmarkPrice) + } + } + if len(validBenchmarkPrices) < f+1 { + return nil, errors.New("fewer than f+1 observations have a valid price") + } + sort.Slice(validBenchmarkPrices, func(i, j int) bool { + return validBenchmarkPrices[i].Cmp(validBenchmarkPrices[j]) < 0 }) - return paos[len(paos)/2].BenchmarkPrice + return validBenchmarkPrices[len(validBenchmarkPrices)/2], nil } // GetConsensusBid gets the median bid -func GetConsensusBid(paos []ParsedAttributedObservation) *big.Int { - sort.Slice(paos, func(i, j int) bool { - return paos[i].Bid.Cmp(paos[j].Bid) < 0 +func GetConsensusBid(paos []ParsedAttributedObservation, f int) (*big.Int, error) { + var validBids []*big.Int + for _, pao := range paos { + if pao.PricesValid { + validBids = append(validBids, pao.Bid) + } + } + if len(validBids) < f+1 { + return nil, errors.New("fewer than f+1 observations have a valid price") + } + sort.Slice(validBids, func(i, j int) bool { + return validBids[i].Cmp(validBids[j]) < 0 }) - return paos[len(paos)/2].Bid + return validBids[len(validBids)/2], nil } // GetConsensusAsk gets the median ask -func GetConsensusAsk(paos []ParsedAttributedObservation) *big.Int { - sort.Slice(paos, func(i, j int) bool { - return paos[i].Ask.Cmp(paos[j].Ask) < 0 +func GetConsensusAsk(paos []ParsedAttributedObservation, f int) (*big.Int, error) { + var validAsks []*big.Int + for _, pao := range paos { + if pao.PricesValid { + validAsks = append(validAsks, pao.Ask) + } + } + if len(validAsks) < f+1 { + return nil, errors.New("fewer than f+1 observations have a valid price") + } + sort.Slice(validAsks, func(i, j int) bool { + return validAsks[i].Cmp(validAsks[j]) < 0 }) - return paos[len(paos)/2].Ask + return validAsks[len(validAsks)/2], nil } // GetConsensusCurrentBlock gets the most common (mode) block hash/number/timestamps. // In the event of a tie, use the lowest numerical value func GetConsensusCurrentBlock(paos []ParsedAttributedObservation, f int) (hash []byte, num int64, ts uint64, err error) { + var validPaos []ParsedAttributedObservation + for _, pao := range paos { + if pao.CurrentBlockValid { + validPaos = append(validPaos, pao) + } + } + if len(validPaos) < f+1 { + return nil, 0, 0, fmt.Errorf("fewer than f+1 observations have a valid current block (got: %d/%d)", len(validPaos), len(paos)) + } // pick the most common blockhash with at least f+1 votes - hash, err = getConsensusCurrentBlockHash(paos, f+1) + hash, err = getConsensusCurrentBlockHash(validPaos, f+1) if err != nil { return hash, 0, 0, errors.Wrap(err, "couldn't get consensus current block") } // pick the most common block number with at least f+1 votes - num, err = getConsensusCurrentBlockNum(paos, string(hash), f+1) + num, err = getConsensusCurrentBlockNum(validPaos, string(hash), f+1) if err != nil { - return hash, num, 0, errors.Wrap(err, "coulnd't get consensus current block") + return hash, num, 0, errors.Wrap(err, "couldn't get consensus current block") } // pick the most common block timestamp with at least f+1 votes - ts, err = getConsensusCurrentBlockTimestamp(paos, string(hash), num, f+1) + ts, err = getConsensusCurrentBlockTimestamp(validPaos, string(hash), num, f+1) if err != nil { - return hash, num, ts, errors.Wrap(err, "coulnd't get consensus current block") + return hash, num, ts, errors.Wrap(err, "couldn't get consensus current block") } return hash, num, ts, nil } -// GetConsensusValidFromBlock gets the most common (mode) ValidFromBlockNum -// In the event of a tie, the lower number is chosen -func GetConsensusValidFromBlock(paos []ParsedAttributedObservation, f int) (int64, error) { +// GetConsensusMaxFinalizedBlockNum gets the most common (mode) +// ConsensusMaxFinalizedBlockNum In the event of a tie, the lower number is +// chosen +func GetConsensusMaxFinalizedBlockNum(paos []ParsedAttributedObservation, f int) (int64, error) { + var validPaos []ParsedAttributedObservation + for _, pao := range paos { + if pao.MaxFinalizedBlockNumberValid { + validPaos = append(validPaos, pao) + } + } + if len(validPaos) < f+1 { + return 0, fmt.Errorf("fewer than f+1 observations have a valid maxFinalizedBlockNumber (got: %d/%d)", len(validPaos), len(paos)) + } // pick the most common block number with at least f+1 votes m := map[int64]int{} maxCnt := 0 - for _, pao := range paos { - n := pao.ValidFromBlockNum + for _, pao := range validPaos { + n := pao.MaxFinalizedBlockNumber m[n]++ if cnt := m[n]; cnt > maxCnt { maxCnt = cnt @@ -91,7 +138,7 @@ func GetConsensusValidFromBlock(paos []ParsedAttributedObservation, f int) (int6 } if maxCnt < f+1 { - return 0, errors.New("no valid from block number with at least f+1 votes") + return 0, fmt.Errorf("no valid maxFinalizedBlockNumber with at least f+1 votes (got counts: %v)", m) } // guaranteed to be at least one num after this diff --git a/pkg/reportingplugins/mercury/aggregate_functions_test.go b/pkg/reportingplugins/mercury/aggregate_functions_test.go index f1d9c609d..9e777d357 100644 --- a/pkg/reportingplugins/mercury/aggregate_functions_test.go +++ b/pkg/reportingplugins/mercury/aggregate_functions_test.go @@ -18,73 +18,109 @@ func mustDecodeHex(s string) []byte { func Test_AggregateFunctions(t *testing.T) { f := 1 - paos := NewParsedAttributedObservations() + validPaos := NewValidParsedAttributedObservations() + invalidPaos := NewInvalidParsedAttributedObservations() t.Run("GetConsensusTimestamp", func(t *testing.T) { - ts := GetConsensusTimestamp(paos) + ts := GetConsensusTimestamp(validPaos) assert.Equal(t, 1676484828, int(ts)) }) t.Run("GetConsensusBenchmarkPrice", func(t *testing.T) { - bp := GetConsensusBenchmarkPrice(paos) + t.Run("when prices valid, gets median price", func(t *testing.T) { + bp, err := GetConsensusBenchmarkPrice(validPaos, f) + require.NoError(t, err) + assert.Equal(t, "346", bp.String()) + }) - assert.Equal(t, "346", bp.String()) + t.Run("if more than f+1 are invalid, fails", func(t *testing.T) { + _, err := GetConsensusBenchmarkPrice(invalidPaos, f) + assert.EqualError(t, err, "fewer than f+1 observations have a valid price") + }) }) t.Run("GetConsensusBid", func(t *testing.T) { - bid := GetConsensusBid(paos) + t.Run("when prices valid, gets median bid", func(t *testing.T) { + bid, err := GetConsensusBid(validPaos, f) + require.NoError(t, err) + assert.Equal(t, "345", bid.String()) + }) - assert.Equal(t, "345", bid.String()) + t.Run("if more than f+1 are invalid, fails", func(t *testing.T) { + _, err := GetConsensusBid(invalidPaos, f) + assert.EqualError(t, err, "fewer than f+1 observations have a valid price") + }) }) t.Run("GetConsensusAsk", func(t *testing.T) { - ask := GetConsensusAsk(paos) + t.Run("when prices valid, gets median bid", func(t *testing.T) { + ask, err := GetConsensusAsk(validPaos, f) + require.NoError(t, err) - assert.Equal(t, "350", ask.String()) + assert.Equal(t, "350", ask.String()) + }) + + t.Run("if invalid, fails", func(t *testing.T) { + _, err := GetConsensusAsk(invalidPaos, f) + assert.EqualError(t, err, "fewer than f+1 observations have a valid price") + }) }) t.Run("GetConsensusCurrentBlock", func(t *testing.T) { - hash, num, ts, err := GetConsensusCurrentBlock(paos, f) + t.Run("succeeds in the valid case", func(t *testing.T) { + hash, num, ts, err := GetConsensusCurrentBlock(validPaos, f) - require.NoError(t, err) - assert.Equal(t, mustDecodeHex("40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e"), hash) - assert.Equal(t, 16634365, int(num)) - assert.Equal(t, uint64(1682591344), ts) + require.NoError(t, err) + assert.Equal(t, mustDecodeHex("40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e"), hash) + assert.Equal(t, 16634365, int(num)) + assert.Equal(t, uint64(1682591344), ts) + }) + t.Run("if invalid, fails", func(t *testing.T) { + _, _, _, err := GetConsensusCurrentBlock(invalidPaos, f) + assert.EqualError(t, err, "fewer than f+1 observations have a valid current block (got: 0/4)") + }) t.Run("if there are not at least f+1 in consensus about hash", func(t *testing.T) { - _, _, _, err := GetConsensusCurrentBlock(paos, 3) + _, _, _, err := GetConsensusCurrentBlock(validPaos, 3) assert.EqualError(t, err, "couldn't get consensus current block: no block hash with at least f+1 votes") }) t.Run("if there are not at least f+1 in consensus about number", func(t *testing.T) { - badPaos := NewParsedAttributedObservations() + badPaos := NewValidParsedAttributedObservations() for i := range badPaos { badPaos[i].CurrentBlockNum = int64(i) } _, _, _, err := GetConsensusCurrentBlock(badPaos, f) - assert.EqualError(t, err, "coulnd't get consensus current block: no block number matching hash 0x40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e with at least f+1 votes") + assert.EqualError(t, err, "couldn't get consensus current block: no block number matching hash 0x40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e with at least f+1 votes") }) t.Run("if there are not at least f+1 in consensus about timestamp", func(t *testing.T) { - badPaos := NewParsedAttributedObservations() + badPaos := NewValidParsedAttributedObservations() for i := range badPaos { badPaos[i].CurrentBlockTimestamp = uint64(i * 100) } _, _, _, err := GetConsensusCurrentBlock(badPaos, f) - assert.EqualError(t, err, "coulnd't get consensus current block: no block timestamp matching block hash 0x40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e and block number 16634365 with at least f+1 votes") + assert.EqualError(t, err, "couldn't get consensus current block: no block timestamp matching block hash 0x40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e and block number 16634365 with at least f+1 votes") }) }) - t.Run("GetConsensusValidFromBlock", func(t *testing.T) { - num, err := GetConsensusValidFromBlock(paos, f) + t.Run("GetConsensusMaxFinalizedBlockNum", func(t *testing.T) { + t.Run("in the valid case", func(t *testing.T) { + num, err := GetConsensusMaxFinalizedBlockNum(validPaos, f) + + require.NoError(t, err) + assert.Equal(t, 16634355, int(num)) + }) - require.NoError(t, err) - assert.Equal(t, 16634355, int(num)) + t.Run("errors if there are not at least f+1 valid", func(t *testing.T) { + _, err := GetConsensusMaxFinalizedBlockNum(invalidPaos, f) + assert.EqualError(t, err, "fewer than f+1 observations have a valid maxFinalizedBlockNumber (got: 0/4)") + }) - t.Run("if there are not at least f+1 in consensus about number", func(t *testing.T) { - badPaos := NewParsedAttributedObservations() + t.Run("errors if there are not at least f+1 in consensus about number", func(t *testing.T) { + badPaos := NewValidParsedAttributedObservations() for i := range badPaos { - badPaos[i].ValidFromBlockNum = int64(i) + badPaos[i].MaxFinalizedBlockNumber = int64(i) } - _, err := GetConsensusValidFromBlock(badPaos, f) - assert.EqualError(t, err, "no valid from block number with at least f+1 votes") + _, err := GetConsensusMaxFinalizedBlockNum(badPaos, f) + assert.EqualError(t, err, "no valid maxFinalizedBlockNumber with at least f+1 votes (got counts: map[0:1 1:1 2:1 3:1])") }) }) } diff --git a/pkg/reportingplugins/mercury/factories_test.go b/pkg/reportingplugins/mercury/factories_test.go index c97cb82ff..a8dc8cb67 100644 --- a/pkg/reportingplugins/mercury/factories_test.go +++ b/pkg/reportingplugins/mercury/factories_test.go @@ -6,51 +6,85 @@ import ( "github.com/smartcontractkit/libocr/commontypes" ) -func NewParsedAttributedObservations() []ParsedAttributedObservation { +func NewValidParsedAttributedObservations() []ParsedAttributedObservation { return []ParsedAttributedObservation{ ParsedAttributedObservation{ - Timestamp: 1676484822, - BenchmarkPrice: big.NewInt(345), - Bid: big.NewInt(343), - Ask: big.NewInt(347), + Timestamp: 1676484822, + Observer: commontypes.OracleID(1), + + BenchmarkPrice: big.NewInt(345), + Bid: big.NewInt(343), + Ask: big.NewInt(347), + PricesValid: true, + CurrentBlockNum: 16634364, CurrentBlockHash: mustDecodeHex("8f30cda279821c5bb6f72f7ab900aa5118215ce59fcf8835b12d0cdbadc9d7b0"), CurrentBlockTimestamp: 1682908180, - ValidFromBlockNum: 16634355, - Observer: commontypes.OracleID(1), + CurrentBlockValid: true, + + MaxFinalizedBlockNumber: 16634355, + MaxFinalizedBlockNumberValid: true, }, ParsedAttributedObservation{ - Timestamp: 1676484826, - BenchmarkPrice: big.NewInt(335), - Bid: big.NewInt(332), - Ask: big.NewInt(336), + Timestamp: 1676484826, + Observer: commontypes.OracleID(2), + + BenchmarkPrice: big.NewInt(335), + Bid: big.NewInt(332), + Ask: big.NewInt(336), + PricesValid: true, + CurrentBlockNum: 16634364, CurrentBlockHash: mustDecodeHex("8f30cda279821c5bb6f72f7ab900aa5118215ce59fcf8835b12d0cdbadc9d7b0"), CurrentBlockTimestamp: 1682908180, - ValidFromBlockNum: 16634355, - Observer: commontypes.OracleID(2), + CurrentBlockValid: true, + + MaxFinalizedBlockNumber: 16634355, + MaxFinalizedBlockNumberValid: true, }, ParsedAttributedObservation{ - Timestamp: 1676484828, - BenchmarkPrice: big.NewInt(347), - Bid: big.NewInt(345), - Ask: big.NewInt(350), + Timestamp: 1676484828, + Observer: commontypes.OracleID(3), + + BenchmarkPrice: big.NewInt(347), + Bid: big.NewInt(345), + Ask: big.NewInt(350), + PricesValid: true, + CurrentBlockNum: 16634365, CurrentBlockHash: mustDecodeHex("40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e"), CurrentBlockTimestamp: 1682591344, - ValidFromBlockNum: 16634355, - Observer: commontypes.OracleID(3), + CurrentBlockValid: true, + + MaxFinalizedBlockNumber: 16634355, + MaxFinalizedBlockNumberValid: true, }, ParsedAttributedObservation{ - Timestamp: 1676484830, - BenchmarkPrice: big.NewInt(346), - Bid: big.NewInt(347), - Ask: big.NewInt(350), + Timestamp: 1676484830, + Observer: commontypes.OracleID(4), + + BenchmarkPrice: big.NewInt(346), + Bid: big.NewInt(347), + Ask: big.NewInt(350), + PricesValid: true, + CurrentBlockNum: 16634365, CurrentBlockHash: mustDecodeHex("40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e"), CurrentBlockTimestamp: 1682591344, - ValidFromBlockNum: 16634355, - Observer: commontypes.OracleID(4), + CurrentBlockValid: true, + + MaxFinalizedBlockNumber: 16634355, + MaxFinalizedBlockNumberValid: true, }, } } + +func NewInvalidParsedAttributedObservations() []ParsedAttributedObservation { + invalidPaos := NewValidParsedAttributedObservations() + for i := range invalidPaos { + invalidPaos[i].PricesValid = false + invalidPaos[i].CurrentBlockValid = false + invalidPaos[i].MaxFinalizedBlockNumberValid = false + } + return invalidPaos +} diff --git a/pkg/reportingplugins/mercury/mercury.go b/pkg/reportingplugins/mercury/mercury.go index 04ba22569..6630d5db7 100644 --- a/pkg/reportingplugins/mercury/mercury.go +++ b/pkg/reportingplugins/mercury/mercury.go @@ -5,18 +5,16 @@ import ( "errors" "fmt" "math/big" - "sync" - "sync/atomic" "time" - "github.com/jpillora/backoff" pkgerrors "github.com/pkg/errors" "google.golang.org/protobuf/proto" "github.com/smartcontractkit/libocr/bigbigendian" "github.com/smartcontractkit/libocr/commontypes" - "github.com/smartcontractkit/libocr/offchainreporting2/types" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/logger" ) @@ -28,7 +26,7 @@ const onchainConfigVersion = 1 var onchainConfigVersionBig = big.NewInt(onchainConfigVersion) -const onchainConfigEncodedLength = 96 //TODO 1 + byteWidthInt192 + byteWidthInt192 +const onchainConfigEncodedLength = 96 // 3x 32bit evm words, version + min + max type OnchainConfig struct { // applies to all values: price, bid and ask @@ -123,6 +121,9 @@ type Observation struct { CurrentBlockNum ObsResult[int64] CurrentBlockHash ObsResult[[]byte] CurrentBlockTimestamp ObsResult[uint64] + // MaxFinalizedBlockNumber comes from previous report when present and is + // only observed from mercury server when previous report is nil + MaxFinalizedBlockNumber ObsResult[int64] } // DataSource implementations must be thread-safe. Observe may be called by many @@ -144,10 +145,10 @@ type DataSource interface { // // Important: Observe should not perform any potentially time-consuming // actions like database access, once the context passed has expired. - Observe(context.Context, ocrtypes.ReportTimestamp) (Observation, error) + Observe(ctx context.Context, repts ocrtypes.ReportTimestamp, fetchMaxFinalizedBlockNum bool) (Observation, error) } -var _ ocrtypes.ReportingPluginFactory = Factory{} +var _ ocr3types.MercuryPluginFactory = Factory{} const maxObservationLength = 32 + // feedID 4 + // timestamp @@ -160,16 +161,16 @@ const maxObservationLength = 32 + // feedID 8 + // validFromBlockNum 16 /* overapprox. of protobuf overhead */ -// All functions on ReportCodec should be pure and thread-safe. +// ReportCodec All functions on ReportCodec should be pure and thread-safe. // Be careful validating and parsing any data passed. type ReportCodec interface { - // Implementers may assume that there is at most one + // BuildReport Implementers may assume that there is at most one // ParsedAttributedObservation per observer, and that all observers are // valid. However, observation values, timestamps, etc... should all be // treated as untrusted. - BuildReport(paos []ParsedAttributedObservation, f int) (ocrtypes.Report, error) + BuildReport(paos []ParsedAttributedObservation, f int, validFromBlockNum int64) (ocrtypes.Report, error) - // Returns the maximum length of a report based on n, the number of oracles. + // MaxReportLength Returns the maximum length of a report based on n, the number of oracles. // The output of BuildReport must respect this maximum length. MaxReportLength(n int) (int, error) @@ -177,14 +178,6 @@ type ReportCodec interface { CurrentBlockNumFromReport(types.Report) (int64, error) } -const unfetchedInitialMaxFinalizedBlockNumber int64 = -1 - -func newInitialMaxFinalizedBlockNumber() (a *atomic.Int64) { - a = new(atomic.Int64) - a.Store(unfetchedInitialMaxFinalizedBlockNumber) - return -} - type Fetcher interface { // FetchInitialMaxFinalizedBlockNumber should fetch the initial max // finalized block number from the mercury server. @@ -196,7 +189,7 @@ type Transmitter interface { // NOTE: Mercury doesn't actually transmit on-chain, so there is no // "contract" involved with the transmitter. // - Transmit should be implemented and send to Mercury server - // - LatestConfigDigestAndEpoch should be implemented and fetch from Mercury server + // - LatestConfigDigestAndEpoch is a stub method, does not need to do anything // - FromAccount() should return CSA public key ocrtypes.ContractTransmitter } @@ -206,33 +199,28 @@ type Factory struct { logger logger.Logger onchainConfigCodec OnchainConfigCodec reportCodec ReportCodec - fetcher Fetcher } -func NewFactory(ds DataSource, lggr logger.Logger, occ OnchainConfigCodec, rc ReportCodec, f Fetcher) Factory { - return Factory{ds, lggr, occ, rc, f} +func NewFactory(ds DataSource, lggr logger.Logger, occ OnchainConfigCodec, rc ReportCodec) Factory { + return Factory{ds, lggr, occ, rc} } -func (fac Factory) NewReportingPlugin(configuration ocrtypes.ReportingPluginConfig) (ocrtypes.ReportingPlugin, ocrtypes.ReportingPluginInfo, error) { +func (fac Factory) NewMercuryPlugin(configuration ocr3types.MercuryPluginConfig) (ocr3types.MercuryPlugin, ocr3types.MercuryPluginInfo, error) { offchainConfig, err := DecodeOffchainConfig(configuration.OffchainConfig) if err != nil { - return nil, ocrtypes.ReportingPluginInfo{}, err + return nil, ocr3types.MercuryPluginInfo{}, err } onchainConfig, err := fac.onchainConfigCodec.Decode(configuration.OnchainConfig) if err != nil { - return nil, ocrtypes.ReportingPluginInfo{}, err + return nil, ocr3types.MercuryPluginInfo{}, err } maxReportLength, err := fac.reportCodec.MaxReportLength(configuration.N) if err != nil { - return nil, ocrtypes.ReportingPluginInfo{}, err + return nil, ocr3types.MercuryPluginInfo{}, err } - wg := sync.WaitGroup{} - wg.Add(1) - ctx, cancel := context.WithCancel(context.Background()) - r := &reportingPlugin{ offchainConfig, onchainConfig, @@ -244,47 +232,18 @@ func (fac Factory) NewReportingPlugin(configuration ocrtypes.ReportingPluginConf epochRound{}, new(big.Int), maxReportLength, - newInitialMaxFinalizedBlockNumber(), - sync.WaitGroup{}, - cancel, - sync.Once{}, } - go func() { - defer wg.Done() - - b := backoff.Backoff{ - Min: 1 * time.Second, - Max: 10 * time.Second, - } - for { - select { - case <-ctx.Done(): - return - case <-time.After(b.Duration()): - initial, err := fac.fetcher.FetchInitialMaxFinalizedBlockNumber(ctx) - if err != nil { - fac.logger.Warnw("FetchInitialMaxFinalizedBlockNumber failed", "err", err) - continue - } - r.maxFinalizedBlockNumber.CompareAndSwap(unfetchedInitialMaxFinalizedBlockNumber, initial) - return - } - } - }() - - return r, ocrtypes.ReportingPluginInfo{ - Name: "Mercury", - UniqueReports: false, - Limits: ocrtypes.ReportingPluginLimits{ - MaxQueryLength: 0, + return r, ocr3types.MercuryPluginInfo{ + Name: "Mercury", + Limits: ocr3types.MercuryPluginLimits{ MaxObservationLength: maxObservationLength, MaxReportLength: maxReportLength, }, }, nil } -var _ ocrtypes.ReportingPlugin = (*reportingPlugin)(nil) +var _ ocr3types.MercuryPlugin = (*reportingPlugin)(nil) type reportingPlugin struct { offchainConfig OffchainConfig @@ -298,24 +257,14 @@ type reportingPlugin struct { latestAcceptedEpochRound epochRound latestAcceptedMedian *big.Int maxReportLength int - maxFinalizedBlockNumber *atomic.Int64 - - // fetch initial finalized block number state management - wg sync.WaitGroup - cancel context.CancelFunc - cancelOnce sync.Once } func (rp *reportingPlugin) Query(ctx context.Context, repts ocrtypes.ReportTimestamp) (ocrtypes.Query, error) { return nil, nil } -func (rp *reportingPlugin) Observation(ctx context.Context, repts ocrtypes.ReportTimestamp, query ocrtypes.Query) (ocrtypes.Observation, error) { - if len(query) != 0 { - return nil, errors.New("expected empty query") - } - - obs, err := rp.dataSource.Observe(ctx, repts) +func (rp *reportingPlugin) Observation(ctx context.Context, repts ocrtypes.ReportTimestamp, previousReport types.Report) (ocrtypes.Observation, error) { + obs, err := rp.dataSource.Observe(ctx, repts, previousReport == nil) if err != nil { return nil, pkgerrors.Errorf("DataSource.Observe returned an error: %s", err) } @@ -323,16 +272,16 @@ func (rp *reportingPlugin) Observation(ctx context.Context, repts ocrtypes.Repor p := MercuryObservationProto{Timestamp: uint32(time.Now().Unix())} var obsErrors []error - if maxFinalizedBlockNumber := rp.maxFinalizedBlockNumber.Load(); maxFinalizedBlockNumber == unfetchedInitialMaxFinalizedBlockNumber { - obsErrors = append(obsErrors, errors.New("failed to observe ValidFromBlockNum; initial maxFinalizedBlockNumber has not yet been fetched from the mercury server")) - } else if obs.CurrentBlockNum.Err == nil && obs.CurrentBlockNum.Val < maxFinalizedBlockNumber { - obsErrors = append(obsErrors, pkgerrors.Errorf("failed to observe ValidFromBlockNum; current block number %d (hash: 0x%x) < max finalized block number %d; ignoring observation for out-of-date RPC", obs.CurrentBlockNum, obs.CurrentBlockHash, maxFinalizedBlockNumber)) - } else { - // NOTE: obs.CurrentBlockNum == maxFinalizedBlockNumber is ok here - // (multiple observations for the same block number) since it will be - // de-duplicated in the Report stage - p.ValidFromBlockNum = maxFinalizedBlockNumber + 1 - p.ValidFromBlockNumValid = true + if previousReport == nil { + // if previousReport we fall back to the observed MaxFinalizedBlockNumber + if obs.MaxFinalizedBlockNumber.Err != nil { + obsErrors = append(obsErrors, err) + } else if obs.CurrentBlockNum.Err == nil && obs.CurrentBlockNum.Val < obs.MaxFinalizedBlockNumber.Val { + obsErrors = append(obsErrors, pkgerrors.Errorf("failed to observe ValidFromBlockNum; current block number %d (hash: 0x%x) < max finalized block number %d; ignoring observation for out-of-date RPC", obs.CurrentBlockNum.Val, obs.CurrentBlockHash.Val, obs.MaxFinalizedBlockNumber.Val)) + } else { + p.MaxFinalizedBlockNumber = obs.MaxFinalizedBlockNumber.Val // MaxFinalizedBlockNumber comes as -1 if unset + p.MaxFinalizedBlockNumberValid = true + } } if obs.BenchmarkPrice.Err != nil { @@ -341,7 +290,6 @@ func (rp *reportingPlugin) Observation(ctx context.Context, repts ocrtypes.Repor obsErrors = append(obsErrors, pkgerrors.Wrap(err, "failed to observe BenchmarkPrice; encoding failed")) } else { p.BenchmarkPrice = benchmarkPrice - p.BenchmarkPriceValid = true } if obs.Bid.Err != nil { @@ -350,7 +298,6 @@ func (rp *reportingPlugin) Observation(ctx context.Context, repts ocrtypes.Repor obsErrors = append(obsErrors, pkgerrors.Wrap(err, "failed to observe Bid; encoding failed")) } else { p.Bid = bid - p.BidValid = true } if obs.Ask.Err != nil { @@ -359,28 +306,32 @@ func (rp *reportingPlugin) Observation(ctx context.Context, repts ocrtypes.Repor obsErrors = append(obsErrors, pkgerrors.Wrap(err, "failed to observe Ask; encoding failed")) } else { p.Ask = bid - p.AskValid = true + } + + if obs.BenchmarkPrice.Err == nil && obs.Bid.Err == nil && obs.Ask.Err == nil { + p.PricesValid = true } if obs.CurrentBlockNum.Err != nil { obsErrors = append(obsErrors, pkgerrors.Wrap(obs.CurrentBlockNum.Err, "failed to observe CurrentBlockNum")) } else { p.CurrentBlockNum = obs.CurrentBlockNum.Val - p.CurrentBlockNumValid = true } if obs.CurrentBlockHash.Err != nil { obsErrors = append(obsErrors, pkgerrors.Wrap(obs.CurrentBlockHash.Err, "failed to observe CurrentBlockHash")) } else { p.CurrentBlockHash = obs.CurrentBlockHash.Val - p.CurrentBlockHashValid = true } if obs.CurrentBlockTimestamp.Err != nil { obsErrors = append(obsErrors, pkgerrors.Wrap(obs.CurrentBlockTimestamp.Err, "failed to observe CurrentBlockTimestamp")) } else { p.CurrentBlockTimestamp = obs.CurrentBlockTimestamp.Val - p.CurrentBlockTimestampValid = true + } + + if obs.CurrentBlockNum.Err == nil && obs.CurrentBlockHash.Err == nil && obs.CurrentBlockTimestamp.Err == nil { + p.CurrentBlockValid = true } if len(obsErrors) > 0 { @@ -391,49 +342,73 @@ func (rp *reportingPlugin) Observation(ctx context.Context, repts ocrtypes.Repor } type ParsedAttributedObservation struct { - Timestamp uint32 - BenchmarkPrice *big.Int - Bid *big.Int - Ask *big.Int + Timestamp uint32 + Observer commontypes.OracleID + + BenchmarkPrice *big.Int + Bid *big.Int + Ask *big.Int + // All three prices must be valid, or none are (they all should come from one API query and hold invariant bid <= bm <= ask) + PricesValid bool + CurrentBlockNum int64 // inclusive; current block CurrentBlockHash []byte CurrentBlockTimestamp uint64 - ValidFromBlockNum int64 // exclusive; one above previous upper block - Observer commontypes.OracleID + // All three block observations must be valid, or none are (they all come from the same block) + CurrentBlockValid bool + + // MaxFinalizedBlockNumber comes from previous report when present and is + // only observed from mercury server when previous report is nil + // + // MaxFinalizedBlockNumber will be -1 if there is none + MaxFinalizedBlockNumber int64 + MaxFinalizedBlockNumberValid bool } -func parseAttributedObservation(ao ocrtypes.AttributedObservation) (ParsedAttributedObservation, error) { +func parseAttributedObservation(ao ocrtypes.AttributedObservation) (pao ParsedAttributedObservation, err error) { var obs MercuryObservationProto - if err := proto.Unmarshal(ao.Observation, &obs); err != nil { + if err = proto.Unmarshal(ao.Observation, &obs); err != nil { return ParsedAttributedObservation{}, pkgerrors.Errorf("attributed observation cannot be unmarshaled: %s", err) } - benchmarkPrice, err := DecodeValueInt192(obs.BenchmarkPrice) - if err != nil { - return ParsedAttributedObservation{}, pkgerrors.Errorf("benchmarkPrice cannot be converted to big.Int: %s", err) + + pao.Timestamp = obs.Timestamp + pao.Observer = ao.Observer + + if obs.PricesValid { + pao.BenchmarkPrice, err = DecodeValueInt192(obs.BenchmarkPrice) + if err != nil { + return ParsedAttributedObservation{}, pkgerrors.Errorf("benchmarkPrice cannot be converted to big.Int: %s", err) + } + pao.Bid, err = DecodeValueInt192(obs.Bid) + if err != nil { + return ParsedAttributedObservation{}, pkgerrors.Errorf("bid cannot be converted to big.Int: %s", err) + } + pao.Ask, err = DecodeValueInt192(obs.Ask) + if err != nil { + return ParsedAttributedObservation{}, pkgerrors.Errorf("ask cannot be converted to big.Int: %s", err) + } + pao.PricesValid = true } - bid, err := DecodeValueInt192(obs.Bid) - if err != nil { - return ParsedAttributedObservation{}, pkgerrors.Errorf("bid cannot be converted to big.Int: %s", err) + + if obs.CurrentBlockValid { + if len(obs.CurrentBlockHash) != evmHashLen { + return ParsedAttributedObservation{}, pkgerrors.Errorf("wrong len for hash: %d (expected: %d)", len(obs.CurrentBlockHash), evmHashLen) + } + pao.CurrentBlockHash = obs.CurrentBlockHash + if obs.CurrentBlockNum < 0 { + return ParsedAttributedObservation{}, pkgerrors.Errorf("negative block number: %d", obs.CurrentBlockNum) + } + pao.CurrentBlockNum = obs.CurrentBlockNum + pao.CurrentBlockTimestamp = obs.CurrentBlockTimestamp + pao.CurrentBlockValid = true } - ask, err := DecodeValueInt192(obs.Ask) - if err != nil { - return ParsedAttributedObservation{}, pkgerrors.Errorf("ask cannot be converted to big.Int: %s", err) - } - if len(obs.CurrentBlockHash) == 0 { - return ParsedAttributedObservation{}, pkgerrors.Errorf("wrong len for hash: %d", len(obs.CurrentBlockHash)) - } - - return ParsedAttributedObservation{ - obs.Timestamp, - benchmarkPrice, - bid, - ask, - obs.CurrentBlockNum, - obs.CurrentBlockHash, - obs.CurrentBlockTimestamp, - obs.ValidFromBlockNum, - ao.Observer, - }, nil + + if obs.MaxFinalizedBlockNumberValid { + pao.MaxFinalizedBlockNumber = obs.MaxFinalizedBlockNumber + pao.MaxFinalizedBlockNumberValid = true + } + + return pao, nil } func parseAttributedObservations(lggr logger.Logger, aos []ocrtypes.AttributedObservation) []ParsedAttributedObservation { @@ -453,11 +428,7 @@ func parseAttributedObservations(lggr logger.Logger, aos []ocrtypes.AttributedOb return paos } -func (rp *reportingPlugin) Report(ctx context.Context, repts types.ReportTimestamp, query types.Query, aos []types.AttributedObservation) (bool, types.Report, error) { - if len(query) != 0 { - return false, nil, pkgerrors.Errorf("expected empty query") - } - +func (rp *reportingPlugin) Report(repts types.ReportTimestamp, previousReport types.Report, aos []types.AttributedObservation) (shouldReport bool, report types.Report, err error) { paos := parseAttributedObservations(rp.logger, aos) // By assumption, we have at most f malicious oracles, so there should be at least f+1 valid paos @@ -465,25 +436,43 @@ func (rp *reportingPlugin) Report(ctx context.Context, repts types.ReportTimesta return false, nil, pkgerrors.Errorf("only received %v valid attributed observations, but need at least f+1 (%v)", len(paos), rp.f+1) } - should, err := rp.shouldReport(ctx, repts, paos) + var validFromBlockNum int64 + if previousReport != nil { + var currentBlockNum int64 + currentBlockNum, err = rp.reportCodec.CurrentBlockNumFromReport(previousReport) + if err != nil { + return false, nil, err + } + validFromBlockNum = currentBlockNum + 1 + } else { + var maxFinalizedBlockNumber int64 + maxFinalizedBlockNumber, err = GetConsensusMaxFinalizedBlockNum(paos, rp.f) + if err != nil { + return false, nil, err + } + validFromBlockNum = maxFinalizedBlockNumber + 1 + } + should, err := rp.shouldReport(validFromBlockNum, repts, paos) if err != nil { return false, nil, err } if !should { return false, nil, nil } - report, err := rp.reportCodec.BuildReport(paos, rp.f) + report, err = rp.reportCodec.BuildReport(paos, rp.f, validFromBlockNum) if err != nil { return false, nil, err } if !(len(report) <= rp.maxReportLength) { - return false, nil, pkgerrors.Errorf("report violates MaxReportLength limit set by ReportCodec (%v vs %v)", len(report), rp.maxReportLength) + return false, nil, pkgerrors.Errorf("report with len %d violates MaxReportLength limit set by ReportCodec (%d)", len(report), rp.maxReportLength) + } else if len(report) == 0 { + return false, nil, errors.New("report may not have zero length (invariant violation)") } return true, report, nil } -func (rp *reportingPlugin) shouldReport(ctx context.Context, repts types.ReportTimestamp, paos []ParsedAttributedObservation) (bool, error) { +func (rp *reportingPlugin) shouldReport(validFromBlockNum int64, repts types.ReportTimestamp, paos []ParsedAttributedObservation) (bool, error) { if !(rp.f+1 <= len(paos)) { return false, pkgerrors.Errorf("only received %v valid attributed observations, but need at least f+1 (%v)", len(paos), rp.f+1) } @@ -492,7 +481,7 @@ func (rp *reportingPlugin) shouldReport(ctx context.Context, repts types.ReportT rp.checkBenchmarkPrice(paos), rp.checkBid(paos), rp.checkAsk(paos), - rp.checkBlockValues(paos), + rp.checkCurrentBlock(paos, validFromBlockNum), ); err != nil { rp.logger.Debugw("shouldReport: no", "err", err) return false, nil @@ -505,19 +494,19 @@ func (rp *reportingPlugin) shouldReport(ctx context.Context, repts types.ReportT } func (rp *reportingPlugin) checkBenchmarkPrice(paos []ParsedAttributedObservation) error { - return ValidateBenchmarkPrice(paos, rp.onchainConfig.Min, rp.onchainConfig.Max) + return ValidateBenchmarkPrice(paos, rp.f, rp.onchainConfig.Min, rp.onchainConfig.Max) } func (rp *reportingPlugin) checkBid(paos []ParsedAttributedObservation) error { - return ValidateBid(paos, rp.onchainConfig.Min, rp.onchainConfig.Max) + return ValidateBid(paos, rp.f, rp.onchainConfig.Min, rp.onchainConfig.Max) } func (rp *reportingPlugin) checkAsk(paos []ParsedAttributedObservation) error { - return ValidateAsk(paos, rp.onchainConfig.Min, rp.onchainConfig.Max) + return ValidateAsk(paos, rp.f, rp.onchainConfig.Min, rp.onchainConfig.Max) } -func (rp *reportingPlugin) checkBlockValues(paos []ParsedAttributedObservation) error { - return ValidateBlockValues(paos, rp.f, rp.maxFinalizedBlockNumber.Load()) +func (rp *reportingPlugin) checkCurrentBlock(paos []ParsedAttributedObservation, validFromBlockNum int64) error { + return ValidateCurrentBlock(paos, rp.f, validFromBlockNum) } func (rp *reportingPlugin) ShouldAcceptFinalizedReport(ctx context.Context, repts types.ReportTimestamp, report types.Report) (bool, error) { @@ -539,20 +528,11 @@ func (rp *reportingPlugin) ShouldAcceptFinalizedReport(ctx context.Context, rept return false, nil } - currentBlockNum, err := rp.reportCodec.CurrentBlockNumFromReport(report) - if err != nil { - return false, pkgerrors.Wrap(err, "error during CurrentBlockNumFromReport") - } - rp.logger.Debugw("ShouldAcceptFinalizedReport() = true", "reportEpochRound", reportEpochRound, "latestAcceptedEpochRound", rp.latestAcceptedEpochRound, ) - if currentBlockNum > rp.maxFinalizedBlockNumber.Load() { - rp.cancelOnce.Do(rp.cancel) // abort fetch because we will store the value from the protocol instead - rp.maxFinalizedBlockNumber.Store(currentBlockNum) - } rp.latestAcceptedEpochRound = reportEpochRound return true, nil @@ -563,7 +543,5 @@ func (rp *reportingPlugin) ShouldTransmitAcceptedReport(ctx context.Context, rep } func (rp *reportingPlugin) Close() error { - rp.cancelOnce.Do(rp.cancel) - rp.wg.Wait() return nil } diff --git a/pkg/reportingplugins/mercury/mercury_observation.pb.go b/pkg/reportingplugins/mercury/mercury_observation.pb.go index 123e88231..203214c8c 100644 --- a/pkg/reportingplugins/mercury/mercury_observation.pb.go +++ b/pkg/reportingplugins/mercury/mercury_observation.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.30.0 +// protoc-gen-go v1.28.1 // protoc v3.21.12 // source: mercury_observation.proto @@ -26,21 +26,23 @@ type MercuryObservationProto struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Timestamp uint32 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - BenchmarkPrice []byte `protobuf:"bytes,2,opt,name=benchmarkPrice,proto3" json:"benchmarkPrice,omitempty"` - Bid []byte `protobuf:"bytes,3,opt,name=bid,proto3" json:"bid,omitempty"` - Ask []byte `protobuf:"bytes,4,opt,name=ask,proto3" json:"ask,omitempty"` - CurrentBlockNum int64 `protobuf:"varint,5,opt,name=currentBlockNum,proto3" json:"currentBlockNum,omitempty"` - CurrentBlockHash []byte `protobuf:"bytes,6,opt,name=currentBlockHash,proto3" json:"currentBlockHash,omitempty"` - CurrentBlockTimestamp uint64 `protobuf:"varint,7,opt,name=currentBlockTimestamp,proto3" json:"currentBlockTimestamp,omitempty"` - ValidFromBlockNum int64 `protobuf:"varint,8,opt,name=validFromBlockNum,proto3" json:"validFromBlockNum,omitempty"` - BenchmarkPriceValid bool `protobuf:"varint,9,opt,name=benchmarkPriceValid,proto3" json:"benchmarkPriceValid,omitempty"` - BidValid bool `protobuf:"varint,10,opt,name=bidValid,proto3" json:"bidValid,omitempty"` - AskValid bool `protobuf:"varint,11,opt,name=askValid,proto3" json:"askValid,omitempty"` - CurrentBlockNumValid bool `protobuf:"varint,12,opt,name=currentBlockNumValid,proto3" json:"currentBlockNumValid,omitempty"` - CurrentBlockHashValid bool `protobuf:"varint,13,opt,name=currentBlockHashValid,proto3" json:"currentBlockHashValid,omitempty"` - CurrentBlockTimestampValid bool `protobuf:"varint,14,opt,name=currentBlockTimestampValid,proto3" json:"currentBlockTimestampValid,omitempty"` - ValidFromBlockNumValid bool `protobuf:"varint,15,opt,name=validFromBlockNumValid,proto3" json:"validFromBlockNumValid,omitempty"` + Timestamp uint32 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Prices + BenchmarkPrice []byte `protobuf:"bytes,2,opt,name=benchmarkPrice,proto3" json:"benchmarkPrice,omitempty"` + Bid []byte `protobuf:"bytes,3,opt,name=bid,proto3" json:"bid,omitempty"` + Ask []byte `protobuf:"bytes,4,opt,name=ask,proto3" json:"ask,omitempty"` + // All three prices must be valid, or none are (they all should come from one API query and hold invariant bid <= bm <= ask) + PricesValid bool `protobuf:"varint,5,opt,name=pricesValid,proto3" json:"pricesValid,omitempty"` + // Current block + CurrentBlockNum int64 `protobuf:"varint,6,opt,name=currentBlockNum,proto3" json:"currentBlockNum,omitempty"` + CurrentBlockHash []byte `protobuf:"bytes,7,opt,name=currentBlockHash,proto3" json:"currentBlockHash,omitempty"` + CurrentBlockTimestamp uint64 `protobuf:"varint,8,opt,name=currentBlockTimestamp,proto3" json:"currentBlockTimestamp,omitempty"` + // All three block observations must be valid, or none are (they all come from the same block) + CurrentBlockValid bool `protobuf:"varint,9,opt,name=currentBlockValid,proto3" json:"currentBlockValid,omitempty"` + // MaxFinalizedBlockNumber comes from previous report when present and is + // only observed from mercury server when previous report is nil + MaxFinalizedBlockNumber int64 `protobuf:"varint,10,opt,name=maxFinalizedBlockNumber,proto3" json:"maxFinalizedBlockNumber,omitempty"` + MaxFinalizedBlockNumberValid bool `protobuf:"varint,11,opt,name=maxFinalizedBlockNumberValid,proto3" json:"maxFinalizedBlockNumberValid,omitempty"` } func (x *MercuryObservationProto) Reset() { @@ -103,6 +105,13 @@ func (x *MercuryObservationProto) GetAsk() []byte { return nil } +func (x *MercuryObservationProto) GetPricesValid() bool { + if x != nil { + return x.PricesValid + } + return false +} + func (x *MercuryObservationProto) GetCurrentBlockNum() int64 { if x != nil { return x.CurrentBlockNum @@ -124,58 +133,23 @@ func (x *MercuryObservationProto) GetCurrentBlockTimestamp() uint64 { return 0 } -func (x *MercuryObservationProto) GetValidFromBlockNum() int64 { - if x != nil { - return x.ValidFromBlockNum - } - return 0 -} - -func (x *MercuryObservationProto) GetBenchmarkPriceValid() bool { - if x != nil { - return x.BenchmarkPriceValid - } - return false -} - -func (x *MercuryObservationProto) GetBidValid() bool { - if x != nil { - return x.BidValid - } - return false -} - -func (x *MercuryObservationProto) GetAskValid() bool { - if x != nil { - return x.AskValid - } - return false -} - -func (x *MercuryObservationProto) GetCurrentBlockNumValid() bool { - if x != nil { - return x.CurrentBlockNumValid - } - return false -} - -func (x *MercuryObservationProto) GetCurrentBlockHashValid() bool { +func (x *MercuryObservationProto) GetCurrentBlockValid() bool { if x != nil { - return x.CurrentBlockHashValid + return x.CurrentBlockValid } return false } -func (x *MercuryObservationProto) GetCurrentBlockTimestampValid() bool { +func (x *MercuryObservationProto) GetMaxFinalizedBlockNumber() int64 { if x != nil { - return x.CurrentBlockTimestampValid + return x.MaxFinalizedBlockNumber } - return false + return 0 } -func (x *MercuryObservationProto) GetValidFromBlockNumValid() bool { +func (x *MercuryObservationProto) GetMaxFinalizedBlockNumberValid() bool { if x != nil { - return x.ValidFromBlockNumValid + return x.MaxFinalizedBlockNumberValid } return false } @@ -185,7 +159,7 @@ var File_mercury_observation_proto protoreflect.FileDescriptor var file_mercury_observation_proto_rawDesc = []byte{ 0x0a, 0x19, 0x6d, 0x65, 0x72, 0x63, 0x75, 0x72, 0x79, 0x5f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x65, 0x72, - 0x63, 0x75, 0x72, 0x79, 0x22, 0x89, 0x05, 0x0a, 0x17, 0x4d, 0x65, 0x72, 0x63, 0x75, 0x72, 0x79, + 0x63, 0x75, 0x72, 0x79, 0x22, 0xdd, 0x03, 0x0a, 0x17, 0x4d, 0x65, 0x72, 0x63, 0x75, 0x72, 0x79, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x26, @@ -193,41 +167,30 @@ var file_mercury_observation_proto_rawDesc = []byte{ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x62, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6b, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x61, 0x73, 0x6b, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x4e, 0x75, 0x6d, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, - 0x12, 0x34, 0x0a, 0x15, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x15, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2c, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, - 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x4e, 0x75, 0x6d, 0x12, 0x30, 0x0a, 0x13, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, - 0x6b, 0x50, 0x72, 0x69, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x13, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x50, 0x72, 0x69, 0x63, - 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x69, 0x64, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x62, 0x69, 0x64, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x73, 0x6b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x73, 0x6b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x32, - 0x0a, 0x14, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, - 0x6d, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x12, 0x34, 0x0a, 0x15, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x15, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, - 0x61, 0x73, 0x68, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x3e, 0x0a, 0x1a, 0x63, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1a, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x16, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x46, - 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x3b, 0x6d, 0x65, 0x72, 0x63, 0x75, 0x72, 0x79, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x61, 0x73, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, + 0x69, 0x63, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0b, 0x70, 0x72, 0x69, 0x63, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x34, 0x0a, 0x15, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x15, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2c, 0x0a, 0x11, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x11, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x38, 0x0a, 0x17, 0x6d, 0x61, 0x78, 0x46, 0x69, 0x6e, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x6d, 0x61, 0x78, 0x46, 0x69, 0x6e, 0x61, + 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x42, 0x0a, 0x1c, 0x6d, 0x61, 0x78, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1c, 0x6d, 0x61, 0x78, 0x46, 0x69, 0x6e, 0x61, 0x6c, + 0x69, 0x7a, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x56, + 0x61, 0x6c, 0x69, 0x64, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x3b, 0x6d, 0x65, 0x72, 0x63, 0x75, 0x72, + 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/reportingplugins/mercury/mercury_observation.proto b/pkg/reportingplugins/mercury/mercury_observation.proto index 2cced5e0a..c1a1c2456 100644 --- a/pkg/reportingplugins/mercury/mercury_observation.proto +++ b/pkg/reportingplugins/mercury/mercury_observation.proto @@ -6,18 +6,23 @@ option go_package = ".;mercury"; // TODO: what about different report formats for different clients? message MercuryObservationProto { uint32 timestamp = 1; + + // Prices bytes benchmarkPrice = 2; bytes bid = 3; bytes ask = 4; - int64 currentBlockNum = 5; - bytes currentBlockHash = 6; - uint64 currentBlockTimestamp = 7; - int64 validFromBlockNum = 8; - bool benchmarkPriceValid = 9; - bool bidValid = 10; - bool askValid = 11; - bool currentBlockNumValid = 12; - bool currentBlockHashValid = 13; - bool currentBlockTimestampValid = 14; - bool validFromBlockNumValid = 15; + // All three prices must be valid, or none are (they all should come from one API query and hold invariant bid <= bm <= ask) + bool pricesValid = 5; + + // Current block + int64 currentBlockNum = 6; + bytes currentBlockHash = 7; + uint64 currentBlockTimestamp = 8; + // All three block observations must be valid, or none are (they all come from the same block) + bool currentBlockValid = 9; + + // MaxFinalizedBlockNumber comes from previous report when present and is + // only observed from mercury server when previous report is nil + int64 maxFinalizedBlockNumber = 10; + bool maxFinalizedBlockNumberValid = 11; } diff --git a/pkg/reportingplugins/mercury/mercury_test.go b/pkg/reportingplugins/mercury/mercury_test.go index 3946298fd..34d8527ab 100644 --- a/pkg/reportingplugins/mercury/mercury_test.go +++ b/pkg/reportingplugins/mercury/mercury_test.go @@ -8,78 +8,113 @@ import ( "time" "github.com/pkg/errors" - "github.com/smartcontractkit/libocr/offchainreporting2/types" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2/types" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" + "github.com/smartcontractkit/libocr/commontypes" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" + "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-relay/pkg/logger" ) -func newReportingPlugin(t *testing.T) *reportingPlugin { +type testReportCodec struct { + currentBlock int64 + currentBlockErr error + builtReport ocrtypes.Report + buildReportShouldFail bool + + lastBuildReportPaos []ParsedAttributedObservation + lastBuildReportF int + lastBuildReportValidFromBlockNum int64 +} + +func (trc *testReportCodec) reset() { + trc.currentBlockErr = nil + trc.buildReportShouldFail = false + trc.lastBuildReportPaos = nil + trc.lastBuildReportF = 0 + trc.lastBuildReportValidFromBlockNum = 0 +} + +func (trc *testReportCodec) BuildReport(paos []ParsedAttributedObservation, f int, validFromBlockNum int64) (ocrtypes.Report, error) { + if trc.buildReportShouldFail { + return nil, errors.New("buildReportShouldFail=true") + } + trc.lastBuildReportPaos = paos + trc.lastBuildReportF = f + trc.lastBuildReportValidFromBlockNum = validFromBlockNum + return trc.builtReport, nil +} + +func (trc *testReportCodec) MaxReportLength(n int) (int, error) { + return 8*32 + // feed ID + 32 + // timestamp + 192 + // benchmarkPrice + 192 + // bid + 192 + // ask + 64 + //currentBlockNum + 8*32 + // currentBlockHash + 64, // validFromBlockNum + nil +} + +func (trc *testReportCodec) CurrentBlockNumFromReport(types.Report) (int64, error) { + return trc.currentBlock, trc.currentBlockErr +} + +func newReportingPlugin(t *testing.T, codec *testReportCodec) *reportingPlugin { + maxReportLength, err := codec.MaxReportLength(4) + require.NoError(t, err) return &reportingPlugin{ - f: 1, - onchainConfig: OnchainConfig{Min: big.NewInt(0), Max: big.NewInt(1000)}, - maxFinalizedBlockNumber: newInitialMaxFinalizedBlockNumber(), - logger: logger.Test(t), + f: 1, + onchainConfig: OnchainConfig{Min: big.NewInt(0), Max: big.NewInt(1000)}, + logger: logger.Test(t), + reportCodec: codec, + maxReportLength: maxReportLength, } } func Test_ReportingPlugin_shouldReport(t *testing.T) { - rp := newReportingPlugin(t) + rp := newReportingPlugin(t, &testReportCodec{}) repts := types.ReportTimestamp{} - paos := NewParsedAttributedObservations() + paos := NewValidParsedAttributedObservations() t.Run("reports if all reports have currentBlockNum > validFromBlockNum", func(t *testing.T) { for i := range paos { paos[i].CurrentBlockNum = 500 - paos[i].ValidFromBlockNum = 499 } - shouldReport, err := rp.shouldReport(context.Background(), repts, paos) + shouldReport, err := rp.shouldReport(499, repts, paos) require.NoError(t, err) assert.True(t, shouldReport) }) - t.Run("does not report if all reports have currentBlockNum == validFromBlockNum", func(t *testing.T) { + t.Run("reporta if all reports have currentBlockNum == validFromBlockNum", func(t *testing.T) { for i := range paos { paos[i].CurrentBlockNum = 500 - paos[i].ValidFromBlockNum = 500 } - shouldReport, err := rp.shouldReport(context.Background(), repts, paos) + shouldReport, err := rp.shouldReport(500, repts, paos) require.NoError(t, err) - assert.False(t, shouldReport) + assert.True(t, shouldReport) }) t.Run("does not report if all reports have currentBlockNum < validFromBlockNum", func(t *testing.T) { - paos := NewParsedAttributedObservations() + paos := NewValidParsedAttributedObservations() for i := range paos { paos[i].CurrentBlockNum = 499 - paos[i].ValidFromBlockNum = 500 } - shouldReport, err := rp.shouldReport(context.Background(), repts, paos) + shouldReport, err := rp.shouldReport(500, repts, paos) require.NoError(t, err) assert.False(t, shouldReport) }) t.Run("returns error if it cannot come to consensus about currentBlockNum", func(t *testing.T) { - paos := NewParsedAttributedObservations() + paos := NewValidParsedAttributedObservations() for i := range paos { paos[i].CurrentBlockNum = 500 + int64(i) - paos[i].ValidFromBlockNum = 499 - } - shouldReport, err := rp.shouldReport(context.Background(), repts, paos) - require.NoError(t, err) - - assert.False(t, shouldReport) - }) - t.Run("returns error if it cannot come to consensus about validFromBlockNum", func(t *testing.T) { - paos := NewParsedAttributedObservations() - for i := range paos { - paos[i].CurrentBlockNum = 500 - paos[i].ValidFromBlockNum = 499 - int64(i) } - shouldReport, err := rp.shouldReport(context.Background(), repts, paos) + shouldReport, err := rp.shouldReport(499, repts, paos) require.NoError(t, err) assert.False(t, shouldReport) @@ -90,7 +125,7 @@ var _ DataSource = &mockDataSource{} type mockDataSource struct{ obs Observation } -func (m mockDataSource) Observe(context.Context, ocrtypes.ReportTimestamp) (Observation, error) { +func (m mockDataSource) Observe(context.Context, ocrtypes.ReportTimestamp, bool) (Observation, error) { return m.obs, nil } @@ -118,13 +153,164 @@ func mustDecodeBigInt(b []byte) *big.Int { func Test_Plugin_Observation(t *testing.T) { ctx := context.Background() repts := ocrtypes.ReportTimestamp{} - query := ocrtypes.Query{} + codec := &testReportCodec{ + currentBlock: int64(rand.Int31()), + builtReport: []byte{}, + } - rp := newReportingPlugin(t) + rp := newReportingPlugin(t, codec) + + t.Run("with previous report", func(t *testing.T) { + // content of previousReport is irrelevant, the only thing that matters + // for this test is that it's not nil + previousReport := ocrtypes.Report{} + + t.Run("when all observations are successful", func(t *testing.T) { + obs := Observation{ + BenchmarkPrice: ObsResult[*big.Int]{ + Val: randBigInt(), + }, + Bid: ObsResult[*big.Int]{ + Val: randBigInt(), + }, + Ask: ObsResult[*big.Int]{ + Val: randBigInt(), + }, + CurrentBlockNum: ObsResult[int64]{ + Val: rand.Int63(), + }, + CurrentBlockHash: ObsResult[[]byte]{ + Val: randBytes(32), + }, + CurrentBlockTimestamp: ObsResult[uint64]{ + Val: rand.Uint64(), + }, + } + + rp.dataSource = mockDataSource{obs} + + pbObs, err := rp.Observation(ctx, repts, previousReport) + require.NoError(t, err) + + var p MercuryObservationProto + require.NoError(t, proto.Unmarshal(pbObs, &p)) + + assert.LessOrEqual(t, p.Timestamp, uint32(time.Now().Unix())) + assert.Equal(t, obs.BenchmarkPrice.Val, mustDecodeBigInt(p.BenchmarkPrice)) + assert.Equal(t, obs.Bid.Val, mustDecodeBigInt(p.Bid)) + assert.Equal(t, obs.Ask.Val, mustDecodeBigInt(p.Ask)) + assert.Equal(t, obs.CurrentBlockNum.Val, p.CurrentBlockNum) + assert.Equal(t, obs.CurrentBlockHash.Val, p.CurrentBlockHash) + assert.Equal(t, obs.CurrentBlockTimestamp.Val, p.CurrentBlockTimestamp) + // since previousReport is not nil, maxFinalizedBlockNumber is skipped + assert.Zero(t, p.MaxFinalizedBlockNumber) + + assert.True(t, p.PricesValid) + assert.True(t, p.CurrentBlockValid) + // since previousReport is not nil, maxFinalizedBlockNumber is skipped + assert.False(t, p.MaxFinalizedBlockNumberValid) + }) + + t.Run("when all observations have failed", func(t *testing.T) { + obs := Observation{ + // Vals should be ignored, this is asserted with .Zero below + BenchmarkPrice: ObsResult[*big.Int]{ + Val: randBigInt(), + Err: errors.New("benchmarkPrice exploded"), + }, + Bid: ObsResult[*big.Int]{ + Val: randBigInt(), + Err: errors.New("bid exploded"), + }, + Ask: ObsResult[*big.Int]{ + Val: randBigInt(), + Err: errors.New("ask exploded"), + }, + CurrentBlockNum: ObsResult[int64]{ + Err: errors.New("currentBlockNum exploded"), + Val: rand.Int63(), + }, + CurrentBlockHash: ObsResult[[]byte]{ + Err: errors.New("currentBlockHash exploded"), + Val: randBytes(32), + }, + CurrentBlockTimestamp: ObsResult[uint64]{ + Err: errors.New("currentBlockTimestamp exploded"), + Val: rand.Uint64(), + }, + } + rp.dataSource = mockDataSource{obs} + + pbObs, err := rp.Observation(ctx, repts, previousReport) + require.NoError(t, err) + + var p MercuryObservationProto + require.NoError(t, proto.Unmarshal(pbObs, &p)) + + assert.LessOrEqual(t, p.Timestamp, uint32(time.Now().Unix())) + assert.Zero(t, p.BenchmarkPrice) + assert.Zero(t, p.Bid) + assert.Zero(t, p.Ask) + assert.Zero(t, p.CurrentBlockNum) + assert.Zero(t, p.CurrentBlockHash) + assert.Zero(t, p.CurrentBlockTimestamp) + // since previousReport is not nil, maxFinalizedBlockNumber is skipped + assert.Zero(t, p.MaxFinalizedBlockNumber) + + assert.False(t, p.PricesValid) + assert.False(t, p.CurrentBlockValid) + // since previousReport is not nil, maxFinalizedBlockNumber is skipped + assert.False(t, p.MaxFinalizedBlockNumberValid) + }) + + t.Run("when some observations have failed", func(t *testing.T) { + obs := Observation{ + BenchmarkPrice: ObsResult[*big.Int]{ + Val: randBigInt(), + }, + Bid: ObsResult[*big.Int]{ + Val: randBigInt(), + }, + Ask: ObsResult[*big.Int]{ + Err: errors.New("ask exploded"), + }, + CurrentBlockNum: ObsResult[int64]{ + Err: errors.New("currentBlockNum exploded"), + }, + CurrentBlockHash: ObsResult[[]byte]{ + Val: randBytes(32), + }, + CurrentBlockTimestamp: ObsResult[uint64]{ + Val: rand.Uint64(), + }, + } + rp.dataSource = mockDataSource{obs} + + pbObs, err := rp.Observation(ctx, repts, previousReport) + require.NoError(t, err) + + var p MercuryObservationProto + require.NoError(t, proto.Unmarshal(pbObs, &p)) + + assert.LessOrEqual(t, p.Timestamp, uint32(time.Now().Unix())) + assert.Equal(t, obs.BenchmarkPrice.Val, mustDecodeBigInt(p.BenchmarkPrice)) + assert.Equal(t, obs.Bid.Val, mustDecodeBigInt(p.Bid)) + assert.Zero(t, p.Ask) + assert.Zero(t, p.CurrentBlockNum) + assert.Equal(t, obs.CurrentBlockHash.Val, p.CurrentBlockHash) + assert.Equal(t, obs.CurrentBlockTimestamp.Val, p.CurrentBlockTimestamp) + // since previousReport is not nil, maxFinalizedBlockNumber is skipped + assert.Zero(t, p.MaxFinalizedBlockNumber) + + assert.False(t, p.PricesValid) + assert.False(t, p.CurrentBlockValid) + // since previousReport is not nil, maxFinalizedBlockNumber is skipped + assert.False(t, p.MaxFinalizedBlockNumberValid) + }) + }) - t.Run("when all observations are successful", func(t *testing.T) { - maxFinalizedBlockNumber := int64(rand.Int31()) - rp.maxFinalizedBlockNumber.Store(maxFinalizedBlockNumber) + t.Run("without previous report, includes maxFinalizedBlockNumber observation", func(t *testing.T) { + currentBlockNum := int64(rand.Int31()) obs := Observation{ BenchmarkPrice: ObsResult[*big.Int]{ Val: randBigInt(), @@ -136,7 +322,7 @@ func Test_Plugin_Observation(t *testing.T) { Val: randBigInt(), }, CurrentBlockNum: ObsResult[int64]{ - Val: maxFinalizedBlockNumber + 2, + Val: currentBlockNum, }, CurrentBlockHash: ObsResult[[]byte]{ Val: randBytes(32), @@ -144,10 +330,13 @@ func Test_Plugin_Observation(t *testing.T) { CurrentBlockTimestamp: ObsResult[uint64]{ Val: rand.Uint64(), }, + MaxFinalizedBlockNumber: ObsResult[int64]{ + Val: currentBlockNum - 42, + }, } rp.dataSource = mockDataSource{obs} - pbObs, err := rp.Observation(ctx, repts, query) + pbObs, err := rp.Observation(ctx, repts, nil) require.NoError(t, err) var p MercuryObservationProto @@ -160,162 +349,324 @@ func Test_Plugin_Observation(t *testing.T) { assert.Equal(t, obs.CurrentBlockNum.Val, p.CurrentBlockNum) assert.Equal(t, obs.CurrentBlockHash.Val, p.CurrentBlockHash) assert.Equal(t, obs.CurrentBlockTimestamp.Val, p.CurrentBlockTimestamp) - assert.Equal(t, maxFinalizedBlockNumber+1, p.ValidFromBlockNum) - assert.True(t, p.BenchmarkPriceValid) - assert.True(t, p.BidValid) - assert.True(t, p.AskValid) - assert.True(t, p.CurrentBlockNumValid) - assert.True(t, p.CurrentBlockHashValid) - assert.True(t, p.CurrentBlockTimestampValid) - assert.True(t, p.ValidFromBlockNumValid) + assert.Equal(t, obs.MaxFinalizedBlockNumber.Val, p.MaxFinalizedBlockNumber) + + assert.True(t, p.PricesValid) + assert.True(t, p.CurrentBlockValid) + assert.True(t, p.MaxFinalizedBlockNumberValid) }) - t.Run("when all observations have failed", func(t *testing.T) { - obs := Observation{ - // Vals should be ignored, this is asserted with .Zero below - BenchmarkPrice: ObsResult[*big.Int]{ - Val: randBigInt(), - Err: errors.New("benchmarkPrice exploded"), - }, - Bid: ObsResult[*big.Int]{ - Val: randBigInt(), - Err: errors.New("bid exploded"), - }, - Ask: ObsResult[*big.Int]{ - Val: randBigInt(), - Err: errors.New("ask exploded"), - }, - CurrentBlockNum: ObsResult[int64]{ - Err: errors.New("currentBlockNum exploded"), - Val: rand.Int63(), - }, - CurrentBlockHash: ObsResult[[]byte]{ - Err: errors.New("currentBlockHash exploded"), - Val: randBytes(32), - }, - CurrentBlockTimestamp: ObsResult[uint64]{ - Err: errors.New("currentBlockTimestamp exploded"), - Val: rand.Uint64(), - }, - } - maxFinalizedBlockNumber := int64(rand.Int31()) - rp.maxFinalizedBlockNumber.Store(maxFinalizedBlockNumber) - rp.dataSource = mockDataSource{obs} +} - pbObs, err := rp.Observation(ctx, repts, query) - require.NoError(t, err) +func newAttributedObservation(t *testing.T, p *MercuryObservationProto) ocrtypes.AttributedObservation { + marshalledObs, err := proto.Marshal(p) + require.NoError(t, err) + return ocrtypes.AttributedObservation{ + Observation: ocrtypes.Observation(marshalledObs), + Observer: commontypes.OracleID(42), + } +} - var p MercuryObservationProto - require.NoError(t, proto.Unmarshal(pbObs, &p)) +func newUnparseableAttributedObservation() ocrtypes.AttributedObservation { + return ocrtypes.AttributedObservation{ + Observation: []byte{1, 2}, + Observer: commontypes.OracleID(42), + } +} - assert.LessOrEqual(t, p.Timestamp, uint32(time.Now().Unix())) - assert.Zero(t, p.BenchmarkPrice) - assert.Zero(t, p.Bid) - assert.Zero(t, p.Ask) - assert.Zero(t, p.CurrentBlockNum) - assert.Zero(t, p.CurrentBlockHash) - assert.Zero(t, p.CurrentBlockTimestamp) - assert.Equal(t, maxFinalizedBlockNumber+1, p.ValidFromBlockNum) - assert.False(t, p.BenchmarkPriceValid) - assert.False(t, p.BidValid) - assert.False(t, p.AskValid) - assert.False(t, p.CurrentBlockNumValid) - assert.False(t, p.CurrentBlockHashValid) - assert.False(t, p.CurrentBlockTimestampValid) - assert.True(t, p.ValidFromBlockNumValid) - }) +var blockHash = randBytes(32) + +func newValidMercuryObservationProto() *MercuryObservationProto { + return &MercuryObservationProto{ + Timestamp: 42, + BenchmarkPrice: MustEncodeValueInt192(big.NewInt(43)), + Bid: MustEncodeValueInt192(big.NewInt(44)), + Ask: MustEncodeValueInt192(big.NewInt(45)), + PricesValid: true, + CurrentBlockNum: 49, + CurrentBlockHash: blockHash, + CurrentBlockTimestamp: 46, + CurrentBlockValid: true, + MaxFinalizedBlockNumber: 47, + MaxFinalizedBlockNumberValid: true, + } +} - t.Run("if maxFinalizedBlockNumber has not been set", func(t *testing.T) { - rp.maxFinalizedBlockNumber.Store(unfetchedInitialMaxFinalizedBlockNumber) - obs := Observation{ - BenchmarkPrice: ObsResult[*big.Int]{ - Val: randBigInt(), - }, - Bid: ObsResult[*big.Int]{ - Val: randBigInt(), - }, - Ask: ObsResult[*big.Int]{ - Val: randBigInt(), - }, - CurrentBlockNum: ObsResult[int64]{ - Val: int64(rand.Int31()), - }, - CurrentBlockHash: ObsResult[[]byte]{ - Val: randBytes(32), - }, - CurrentBlockTimestamp: ObsResult[uint64]{ - Val: rand.Uint64(), - }, - } - rp.dataSource = mockDataSource{obs} +func newInvalidMercuryObservationProto() *MercuryObservationProto { + return &MercuryObservationProto{ + PricesValid: false, + CurrentBlockValid: false, + MaxFinalizedBlockNumberValid: false, + } +} - pbObs, err := rp.Observation(ctx, repts, query) - require.NoError(t, err) +func Test_Plugin_parseAttributedObservation(t *testing.T) { + t.Run("with all valid values", func(t *testing.T) { + obs := newValidMercuryObservationProto() + ao := newAttributedObservation(t, obs) + + pao, err := parseAttributedObservation(ao) + assert.NoError(t, err) + + assert.Equal(t, + ParsedAttributedObservation{ + Timestamp: 0x2a, + Observer: 0x2a, + BenchmarkPrice: big.NewInt(43), + Bid: big.NewInt(44), + Ask: big.NewInt(45), + PricesValid: true, + CurrentBlockNum: 49, + CurrentBlockHash: obs.CurrentBlockHash, + CurrentBlockTimestamp: 46, + CurrentBlockValid: true, + MaxFinalizedBlockNumber: 47, + MaxFinalizedBlockNumberValid: true, + }, + pao, + ) + }) - var p MercuryObservationProto - require.NoError(t, proto.Unmarshal(pbObs, &p)) + t.Run("with all invalid values", func(t *testing.T) { + obs := newInvalidMercuryObservationProto() + ao := newAttributedObservation(t, obs) - assert.LessOrEqual(t, p.Timestamp, uint32(time.Now().Unix())) - assert.Equal(t, obs.BenchmarkPrice.Val, mustDecodeBigInt(p.BenchmarkPrice)) - assert.Equal(t, obs.Bid.Val, mustDecodeBigInt(p.Bid)) - assert.Equal(t, obs.Ask.Val, mustDecodeBigInt(p.Ask)) - assert.Equal(t, obs.CurrentBlockNum.Val, p.CurrentBlockNum) - assert.Equal(t, obs.CurrentBlockHash.Val, p.CurrentBlockHash) - assert.Equal(t, obs.CurrentBlockTimestamp.Val, p.CurrentBlockTimestamp) - assert.Zero(t, p.ValidFromBlockNum) - assert.True(t, p.BenchmarkPriceValid) - assert.True(t, p.BidValid) - assert.True(t, p.AskValid) - assert.True(t, p.CurrentBlockNumValid) - assert.True(t, p.CurrentBlockHashValid) - assert.True(t, p.CurrentBlockTimestampValid) - assert.False(t, p.ValidFromBlockNumValid) - }) + pao, err := parseAttributedObservation(ao) + assert.NoError(t, err) - t.Run("when some observations have failed", func(t *testing.T) { - maxFinalizedBlockNumber := int64(rand.Int31()) - rp.maxFinalizedBlockNumber.Store(maxFinalizedBlockNumber) - obs := Observation{ - BenchmarkPrice: ObsResult[*big.Int]{ - Val: randBigInt(), - }, - Bid: ObsResult[*big.Int]{ - Val: randBigInt(), - }, - Ask: ObsResult[*big.Int]{ - Err: errors.New("ask exploded"), - }, - CurrentBlockNum: ObsResult[int64]{ - Err: errors.New("currentBlockNum exploded"), - }, - CurrentBlockHash: ObsResult[[]byte]{ - Val: randBytes(32), + assert.Equal(t, + ParsedAttributedObservation{ + Observer: 0x2a, + PricesValid: false, + CurrentBlockValid: false, + MaxFinalizedBlockNumberValid: false, }, - CurrentBlockTimestamp: ObsResult[uint64]{ - Val: rand.Uint64(), - }, - } - rp.dataSource = mockDataSource{obs} + pao, + ) + }) - pbObs, err := rp.Observation(ctx, repts, query) - require.NoError(t, err) + t.Run("with unparseable values", func(t *testing.T) { + t.Run("ao cannot be unmarshalled", func(t *testing.T) { + ao := newUnparseableAttributedObservation() + + _, err := parseAttributedObservation(ao) + require.Error(t, err) + assert.Contains(t, err.Error(), "attributed observation cannot be unmarshaled") + }) + t.Run("bad benchmark price", func(t *testing.T) { + obs := newValidMercuryObservationProto() + obs.BenchmarkPrice = randBytes(16) + ao := newAttributedObservation(t, obs) + + _, err := parseAttributedObservation(ao) + assert.EqualError(t, err, "benchmarkPrice cannot be converted to big.Int: expected b to have length 24, but got length 16") + }) + t.Run("bad bid", func(t *testing.T) { + obs := newValidMercuryObservationProto() + obs.Bid = []byte{1} + ao := newAttributedObservation(t, obs) + + _, err := parseAttributedObservation(ao) + assert.EqualError(t, err, "bid cannot be converted to big.Int: expected b to have length 24, but got length 1") + }) + t.Run("bad ask", func(t *testing.T) { + obs := newValidMercuryObservationProto() + obs.Ask = []byte{1} + ao := newAttributedObservation(t, obs) + + _, err := parseAttributedObservation(ao) + assert.EqualError(t, err, "ask cannot be converted to big.Int: expected b to have length 24, but got length 1") + }) + t.Run("bad block hash", func(t *testing.T) { + obs := newValidMercuryObservationProto() + obs.CurrentBlockHash = []byte{1} + ao := newAttributedObservation(t, obs) + + _, err := parseAttributedObservation(ao) + assert.EqualError(t, err, "wrong len for hash: 1 (expected: 32)") + }) + t.Run("negative block number", func(t *testing.T) { + obs := newValidMercuryObservationProto() + obs.CurrentBlockNum = -1 + ao := newAttributedObservation(t, obs) + + _, err := parseAttributedObservation(ao) + assert.EqualError(t, err, "negative block number: -1") + }) + }) +} - var p MercuryObservationProto - require.NoError(t, proto.Unmarshal(pbObs, &p)) +func Test_Plugin_Report(t *testing.T) { + repts := types.ReportTimestamp{} - assert.LessOrEqual(t, p.Timestamp, uint32(time.Now().Unix())) - assert.Equal(t, obs.BenchmarkPrice.Val, mustDecodeBigInt(p.BenchmarkPrice)) - assert.Equal(t, obs.Bid.Val, mustDecodeBigInt(p.Bid)) - assert.Zero(t, p.Ask) - assert.Zero(t, p.CurrentBlockNum) - assert.Equal(t, obs.CurrentBlockHash.Val, p.CurrentBlockHash) - assert.Equal(t, obs.CurrentBlockTimestamp.Val, p.CurrentBlockTimestamp) - assert.Equal(t, maxFinalizedBlockNumber+1, p.ValidFromBlockNum) - assert.True(t, p.BenchmarkPriceValid) - assert.True(t, p.BidValid) - assert.False(t, p.AskValid) - assert.False(t, p.CurrentBlockNumValid) - assert.True(t, p.CurrentBlockHashValid) - assert.True(t, p.ValidFromBlockNumValid) + t.Run("when previous report is nil", func(t *testing.T) { + codec := &testReportCodec{ + currentBlock: int64(rand.Int31()), + builtReport: []byte{1, 2, 3, 4}, + } + rp := newReportingPlugin(t, codec) + + t.Run("errors if not enough attributed observations", func(t *testing.T) { + _, _, err := rp.Report(repts, nil, []types.AttributedObservation{}) + assert.EqualError(t, err, "only received 0 valid attributed observations, but need at least f+1 (2)") + }) + t.Run("succeeds, ignoring unparseable attributed observations", func(t *testing.T) { + aos := []types.AttributedObservation{ + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newUnparseableAttributedObservation(), + } + should, report, err := rp.Report(repts, nil, aos) + + assert.True(t, should) + assert.Equal(t, codec.builtReport, report) + assert.NoError(t, err) + }) + t.Run("succeeds and generates validFromBlockNum from maxFinalizedBlockNumber", func(t *testing.T) { + codec.reset() + + aos := []types.AttributedObservation{ + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + } + should, report, err := rp.Report(repts, nil, aos) + + assert.True(t, should) + assert.Equal(t, codec.builtReport, report) + assert.NoError(t, err) + + assert.Equal(t, 48, int(codec.lastBuildReportValidFromBlockNum)) + assert.Len(t, codec.lastBuildReportPaos, 4) + assert.Equal(t, 1, codec.lastBuildReportF) + }) + t.Run("errors if cannot get consensus maxFinalizedBlockNumber", func(t *testing.T) { + obs := []*MercuryObservationProto{ + newValidMercuryObservationProto(), + newValidMercuryObservationProto(), + newValidMercuryObservationProto(), + newValidMercuryObservationProto(), + } + for i := range obs { + obs[i].MaxFinalizedBlockNumber = int64(i) + } + aos := []types.AttributedObservation{ + newAttributedObservation(t, obs[0]), + newAttributedObservation(t, obs[1]), + newAttributedObservation(t, obs[2]), + newAttributedObservation(t, obs[3]), + } + _, _, err := rp.Report(repts, nil, aos) + + assert.EqualError(t, err, "no valid maxFinalizedBlockNumber with at least f+1 votes (got counts: map[0:1 1:1 2:1 3:1])") + }) + t.Run("returns false if shouldReport returns false", func(t *testing.T) { + obs := []*MercuryObservationProto{ + newValidMercuryObservationProto(), + newValidMercuryObservationProto(), + newValidMercuryObservationProto(), + newValidMercuryObservationProto(), + } + for i := range obs { + obs[i].BenchmarkPrice = MustEncodeValueInt192(big.NewInt(-1)) // benchmark price below min of 0, cannot report + } + aos := []types.AttributedObservation{ + newAttributedObservation(t, obs[0]), + newAttributedObservation(t, obs[1]), + newAttributedObservation(t, obs[2]), + newAttributedObservation(t, obs[3]), + } + should, report, err := rp.Report(repts, nil, aos) + + assert.False(t, should) + assert.Nil(t, report) + assert.NoError(t, err) + }) + t.Run("BuildReport failures", func(t *testing.T) { + t.Run("errors if BuildReport returns error", func(t *testing.T) { + codec.buildReportShouldFail = true + defer codec.reset() + + aos := []types.AttributedObservation{ + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newUnparseableAttributedObservation(), + } + _, _, err := rp.Report(repts, nil, aos) + + assert.EqualError(t, err, "buildReportShouldFail=true") + }) + t.Run("errors if BuildReport returns a report that is too long", func(t *testing.T) { + codec.builtReport = randBytes(9999) + aos := []types.AttributedObservation{ + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newUnparseableAttributedObservation(), + } + _, _, err := rp.Report(repts, nil, aos) + + assert.EqualError(t, err, "report with len 9999 violates MaxReportLength limit set by ReportCodec (1248)") + }) + t.Run("errors if BuildReport returns a report that is too short", func(t *testing.T) { + codec.builtReport = []byte{} + aos := []types.AttributedObservation{ + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newUnparseableAttributedObservation(), + } + _, _, err := rp.Report(repts, nil, aos) + + assert.EqualError(t, err, "report may not have zero length (invariant violation)") + }) + }) + }) + t.Run("when previous report is present", func(t *testing.T) { + codec := &testReportCodec{ + currentBlock: int64(rand.Int31()), + builtReport: []byte{1, 2, 3, 4}, + } + rp := newReportingPlugin(t, codec) + previousReport := types.Report{} + + t.Run("succeeds and uses block number in previous report if valid", func(t *testing.T) { + currentBlock := int64(32) + codec.currentBlock = currentBlock + + aos := []types.AttributedObservation{ + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + } + should, report, err := rp.Report(repts, previousReport, aos) + + assert.True(t, should) + assert.Equal(t, codec.builtReport, report) + assert.NoError(t, err) + + // current block of previous report + 1 is the validFromBlockNum of current report + assert.Equal(t, 33, int(codec.lastBuildReportValidFromBlockNum)) + assert.Len(t, codec.lastBuildReportPaos, 4) + assert.Equal(t, 1, codec.lastBuildReportF) + }) + t.Run("errors if cannot extract block number from previous report", func(t *testing.T) { + codec.currentBlockErr = errors.New("test error current block fail") + + aos := []types.AttributedObservation{ + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + newAttributedObservation(t, newValidMercuryObservationProto()), + } + should, _, err := rp.Report(repts, previousReport, aos) + + assert.False(t, should) + assert.EqualError(t, err, "test error current block fail") + }) }) } diff --git a/pkg/reportingplugins/mercury/validation.go b/pkg/reportingplugins/mercury/validation.go index 8225ad523..03f61ed64 100644 --- a/pkg/reportingplugins/mercury/validation.go +++ b/pkg/reportingplugins/mercury/validation.go @@ -1,15 +1,20 @@ package mercury import ( - "errors" "fmt" "math/big" pkgerrors "github.com/pkg/errors" ) -func ValidateBenchmarkPrice(paos []ParsedAttributedObservation, min, max *big.Int) error { - answer := GetConsensusBenchmarkPrice(paos) +// NOTE: hardcoded for now, this may need to change if we support block range on chains other than eth +const evmHashLen = 32 + +func ValidateBenchmarkPrice(paos []ParsedAttributedObservation, f int, min, max *big.Int) error { + answer, err := GetConsensusBenchmarkPrice(paos, f) + if err != nil { + return err + } if !(min.Cmp(answer) <= 0 && answer.Cmp(max) <= 0) { return pkgerrors.Errorf("median benchmark price %s is outside of allowable range (Min: %s, Max: %s)", answer, min, max) @@ -18,8 +23,11 @@ func ValidateBenchmarkPrice(paos []ParsedAttributedObservation, min, max *big.In return nil } -func ValidateBid(paos []ParsedAttributedObservation, min, max *big.Int) error { - answer := GetConsensusBid(paos) +func ValidateBid(paos []ParsedAttributedObservation, f int, min, max *big.Int) error { + answer, err := GetConsensusBid(paos, f) + if err != nil { + return err + } if !(min.Cmp(answer) <= 0 && answer.Cmp(max) <= 0) { return pkgerrors.Errorf("median bid price %s is outside of allowable range (Min: %s, Max: %s)", answer, min, max) @@ -28,8 +36,11 @@ func ValidateBid(paos []ParsedAttributedObservation, min, max *big.Int) error { return nil } -func ValidateAsk(paos []ParsedAttributedObservation, min, max *big.Int) error { - answer := GetConsensusAsk(paos) +func ValidateAsk(paos []ParsedAttributedObservation, f int, min, max *big.Int) error { + answer, err := GetConsensusAsk(paos, f) + if err != nil { + return err + } if !(min.Cmp(answer) <= 0 && answer.Cmp(max) <= 0) { return pkgerrors.Errorf("median ask price %s is outside of allowable range (Min: %s, Max: %s)", answer, min, max) @@ -38,50 +49,42 @@ func ValidateAsk(paos []ParsedAttributedObservation, min, max *big.Int) error { return nil } -func ValidateBlockValues(paos []ParsedAttributedObservation, f int, maxFinalizedBlockNumber int64) error { +func ValidateCurrentBlock(paos []ParsedAttributedObservation, f int, validFromBlockNum int64) error { + if validFromBlockNum < 0 { + return fmt.Errorf("validFromBlockNum must be >= 0 (got: %d)", validFromBlockNum) + } var newBlockRangePaos []ParsedAttributedObservation for _, pao := range paos { - if pao.CurrentBlockNum > pao.ValidFromBlockNum { + if pao.CurrentBlockValid && pao.CurrentBlockNum >= validFromBlockNum { newBlockRangePaos = append(newBlockRangePaos, pao) } } - if !(f+1 <= len(newBlockRangePaos)) { - s := fmt.Sprintf("only %v/%v attributed observations have currentBlockNum > validFromBlockNum, need at least f+1 (%v/%v) to make a new report; this is most likely a duplicate report for the block range", len(newBlockRangePaos), len(paos), f+1, len(paos)) - _, currentBlockNum, _, err := GetConsensusCurrentBlock(paos, f) - validFromBlockNum, err2 := GetConsensusValidFromBlock(paos, f) - err = errors.Join(err, err2) + if len(newBlockRangePaos) < f+1 { + s := fmt.Sprintf("only %v/%v attributed observations have currentBlockNum >= validFromBlockNum, need at least f+1 (%v/%v) to make a new report", len(newBlockRangePaos), len(paos), f+1, len(paos)) + _, num, _, err := GetConsensusCurrentBlock(paos, f) if err == nil { - err = pkgerrors.Errorf("%s; consensusCurrentBlock=%d, consensusValidFromBlock=%d", s, currentBlockNum, validFromBlockNum) - } else { - err = pkgerrors.Errorf("%s; could not come to consensus about block numbers: %v", s, err) + return fmt.Errorf("%s; consensusCurrentBlock=%d, validFromBlockNum=%d", s, num, validFromBlockNum) } - return err + return fmt.Errorf("%s; GetConsensusCurrentBlock failed: %w", s, err) } - - _, num, _, err := GetConsensusCurrentBlock(paos, f) + hash, num, _, err := GetConsensusCurrentBlock(newBlockRangePaos, f) if err != nil { - return pkgerrors.Wrap(err, "GetConsensusCurrentBlock failed") + return fmt.Errorf("GetConsensusCurrentBlock failed: %w", err) } + if num < 0 { return pkgerrors.Errorf("block number must be >= 0 (got: %d)", num) } - if maxFinalizedBlockNumber >= num { - return pkgerrors.Errorf("maxFinalizedBlockNumber (%d) must be less than current block number (%d)", maxFinalizedBlockNumber, num) + // NOTE: hardcoded ethereum hash + if len(hash) != evmHashLen { + return pkgerrors.Errorf("invalid length for hash; expected %d (got: %d)", evmHashLen, len(hash)) } - validFrom, err := GetConsensusValidFromBlock(paos, f) - if err != nil { - return pkgerrors.Wrap(err, "GetConsensusValidFromBlock failed") - } - - // Shouldn't be possible but leave here as a sanity check - if validFrom > num { - return pkgerrors.Errorf("validFromBlockNum (%d) must be less than or equal to current block number (%d)", validFrom, num) - } - if validFrom < 0 { - return pkgerrors.Errorf("validFromBlockNum must be >= 0 (got: %d)", validFrom) + if validFromBlockNum > num { + // should be impossible actually due to filtering above, but here for sanity check + return pkgerrors.Errorf("validFromBlockNum (%d) must be less than current block number (%d)", validFromBlockNum, num) } return nil diff --git a/pkg/reportingplugins/mercury/validation_test.go b/pkg/reportingplugins/mercury/validation_test.go index b0b314884..228257e5a 100644 --- a/pkg/reportingplugins/mercury/validation_test.go +++ b/pkg/reportingplugins/mercury/validation_test.go @@ -9,7 +9,7 @@ import ( func TestValidation(t *testing.T) { f := 1 - paos := NewParsedAttributedObservations() + paos := NewValidParsedAttributedObservations() min := big.NewInt(0) max := big.NewInt(10_000) @@ -17,88 +17,71 @@ func TestValidation(t *testing.T) { badMax := big.NewInt(10) t.Run("ValidateBenchmarkPrice", func(t *testing.T) { - err := ValidateBenchmarkPrice(paos, min, max) + err := ValidateBenchmarkPrice(paos, f, min, max) assert.NoError(t, err) - err = ValidateBenchmarkPrice(paos, min, badMax) + err = ValidateBenchmarkPrice(paos, f, min, badMax) assert.EqualError(t, err, "median benchmark price 346 is outside of allowable range (Min: 0, Max: 10)") - err = ValidateBenchmarkPrice(paos, badMin, max) + err = ValidateBenchmarkPrice(paos, f, badMin, max) assert.EqualError(t, err, "median benchmark price 346 is outside of allowable range (Min: 9000, Max: 10000)") }) t.Run("ValidateBid", func(t *testing.T) { - err := ValidateBid(paos, min, max) + err := ValidateBid(paos, f, min, max) assert.NoError(t, err) - err = ValidateBid(paos, min, badMax) + err = ValidateBid(paos, f, min, badMax) assert.EqualError(t, err, "median bid price 345 is outside of allowable range (Min: 0, Max: 10)") - err = ValidateBid(paos, badMin, max) + err = ValidateBid(paos, f, badMin, max) assert.EqualError(t, err, "median bid price 345 is outside of allowable range (Min: 9000, Max: 10000)") }) t.Run("ValidateAsk", func(t *testing.T) { - err := ValidateAsk(paos, min, max) + err := ValidateAsk(paos, f, min, max) assert.NoError(t, err) - err = ValidateAsk(paos, min, badMax) + err = ValidateAsk(paos, f, min, badMax) assert.EqualError(t, err, "median ask price 350 is outside of allowable range (Min: 0, Max: 10)") - err = ValidateAsk(paos, badMin, max) + err = ValidateAsk(paos, f, badMin, max) assert.EqualError(t, err, "median ask price 350 is outside of allowable range (Min: 9000, Max: 10000)") }) - t.Run("ValidateBlockValues", func(t *testing.T) { - err := ValidateBlockValues(paos, f, 0) - assert.NoError(t, err) - - t.Run("errors when maxFinalizedBlockNumber is equal to or larger than current block number", func(t *testing.T) { - err := ValidateBlockValues(paos, f, 16634365) - assert.EqualError(t, err, "maxFinalizedBlockNumber (16634365) must be less than current block number (16634365)") + t.Run("ValidateCurrentBlock", func(t *testing.T) { + t.Run("succeeds when validFromBlockNum < current block num and currentBlockNum has consensus", func(t *testing.T) { + err := ValidateCurrentBlock(paos, f, 16634364) + assert.NoError(t, err) }) - t.Run("errors when validFrom == block number", func(t *testing.T) { - for i := range paos { - paos[i].CurrentBlockNum = paos[i].ValidFromBlockNum - } - err = ValidateBlockValues(paos, f, 0) - assert.EqualError(t, err, "only 0/4 attributed observations have currentBlockNum > validFromBlockNum, need at least f+1 (2/4) to make a new report; this is most likely a duplicate report for the block range; consensusCurrentBlock=16634355, consensusValidFromBlock=16634355") + t.Run("succeeds when validFromBlockNum is equal to current block number", func(t *testing.T) { + err := ValidateCurrentBlock(paos, f, 16634365) + assert.NoError(t, err) }) + t.Run("errors when block number < 0", func(t *testing.T) { for i := range paos { paos[i].CurrentBlockNum = -1 } - err = ValidateBlockValues(paos, f, 0) - assert.EqualError(t, err, "only 0/4 attributed observations have currentBlockNum > validFromBlockNum, need at least f+1 (2/4) to make a new report; this is most likely a duplicate report for the block range; consensusCurrentBlock=-1, consensusValidFromBlock=16634355") + err := ValidateCurrentBlock(paos, f, 2) + assert.EqualError(t, err, "only 0/4 attributed observations have currentBlockNum >= validFromBlockNum, need at least f+1 (2/4) to make a new report; consensusCurrentBlock=-1, validFromBlockNum=2") }) - t.Run("when validFrom > block number", func(t *testing.T) { + t.Run("errors when validFrom > block number", func(t *testing.T) { for i := range paos { paos[i].CurrentBlockNum = 1 - paos[i].ValidFromBlockNum = 2 } - err = ValidateBlockValues(paos, f, 0) - assert.EqualError(t, err, "only 0/4 attributed observations have currentBlockNum > validFromBlockNum, need at least f+1 (2/4) to make a new report; this is most likely a duplicate report for the block range; consensusCurrentBlock=1, consensusValidFromBlock=2") + err := ValidateCurrentBlock(paos, f, 16634366) + assert.EqualError(t, err, "only 0/4 attributed observations have currentBlockNum >= validFromBlockNum, need at least f+1 (2/4) to make a new report; consensusCurrentBlock=1, validFromBlockNum=16634366") }) - t.Run("when validFrom < 0", func(t *testing.T) { + t.Run("errors when validFrom < 0", func(t *testing.T) { for i := range paos { paos[i].CurrentBlockNum = 1 - paos[i].ValidFromBlockNum = -1 } - err = ValidateBlockValues(paos, f, 0) + err := ValidateCurrentBlock(paos, f, -1) assert.EqualError(t, err, "validFromBlockNum must be >= 0 (got: -1)") }) t.Run("returns error if it cannot come to consensus about currentBlockNum", func(t *testing.T) { - paos := NewParsedAttributedObservations() + paos := NewValidParsedAttributedObservations() for i := range paos { paos[i].CurrentBlockNum = 500 + int64(i) - paos[i].ValidFromBlockNum = 499 - } - err := ValidateBlockValues(paos, f, 0) - assert.EqualError(t, err, "GetConsensusCurrentBlock failed: coulnd't get consensus current block: no block number matching hash 0x40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e with at least f+1 votes") - }) - t.Run("returns error if it cannot come to consensus about validFromBlockNum", func(t *testing.T) { - paos := NewParsedAttributedObservations() - for i := range paos { - paos[i].CurrentBlockNum = 500 - paos[i].ValidFromBlockNum = 499 - int64(i) } - err := ValidateBlockValues(paos, f, 0) - assert.EqualError(t, err, "GetConsensusValidFromBlock failed: no valid from block number with at least f+1 votes") + err := ValidateCurrentBlock(paos, f, 0) + assert.EqualError(t, err, "GetConsensusCurrentBlock failed: couldn't get consensus current block: no block number matching hash 0x40044147503a81e9f2a225f4717bf5faf5dc574f69943bdcd305d5ed97504a7e with at least f+1 votes") }) }) } diff --git a/pkg/reportingplugins/mercury/value.go b/pkg/reportingplugins/mercury/value.go index ed523d37f..a58640e2f 100644 --- a/pkg/reportingplugins/mercury/value.go +++ b/pkg/reportingplugins/mercury/value.go @@ -18,3 +18,11 @@ func EncodeValueInt192(i *big.Int) ([]byte, error) { func DecodeValueInt192(s []byte) (*big.Int, error) { return bigbigendian.DeserializeSigned(byteWidthInt192, s) } + +func MustEncodeValueInt192(i *big.Int) []byte { + val, err := EncodeValueInt192(i) + if err != nil { + panic(err) + } + return val +} diff --git a/pkg/types/types.go b/pkg/types/types.go index c1a70fd7b..101a93146 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -6,7 +6,7 @@ import ( "github.com/google/uuid" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" - ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2/types" + ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury" ) diff --git a/pkg/utils/report.go b/pkg/utils/report.go index 1ed4865ff..591af9e13 100644 --- a/pkg/utils/report.go +++ b/pkg/utils/report.go @@ -4,11 +4,11 @@ import ( "crypto/sha256" "encoding/binary" - "github.com/smartcontractkit/libocr/offchainreporting2/types" + "github.com/smartcontractkit/libocr/offchainreporting2plus/types" ) // RawReportContext is a copy of evmutil.RawReportContext to avoid importing go-ethereum. -// github.com/smartcontractkit/libocr/offchainreporting2/chains/evmutil#RawReportContext +// github.com/smartcontractkit/libocr/offchainreporting2plus/chains/evmutil#RawReportContext func RawReportContext(repctx types.ReportContext) [3][32]byte { rawRepctx := [3][32]byte{} copy(rawRepctx[0][:], repctx.ConfigDigest[:])