From ad783de7b5aa7354ebb0bd384e7d99b949c851e6 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 11:12:24 +0200 Subject: [PATCH 01/11] go: Bump go to 1.21.0 --- .changelog/5356.internal.md | 1 + .github/workflows/ci-lint.yml | 6 ++-- .github/workflows/ci-reproducibility.yml | 3 +- .github/workflows/release-dev.yml | 3 +- .github/workflows/release.yml | 5 ++- docker/oasis-core-dev/Dockerfile | 8 ++--- docs/development-setup/prerequisites.md | 16 +++++----- go/.golangci.yml | 36 +++++++++++++++++++++ go/go.mod | 6 ++-- go/go.sum | 40 +++++++++++++++++++++--- 10 files changed, 95 insertions(+), 29 deletions(-) create mode 100644 .changelog/5356.internal.md diff --git a/.changelog/5356.internal.md b/.changelog/5356.internal.md new file mode 100644 index 00000000000..0a3b8a6c6c1 --- /dev/null +++ b/.changelog/5356.internal.md @@ -0,0 +1 @@ +go: Bump go to 1.21.0 diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index 825ffeca7c6..dee0737ca0e 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -34,11 +34,11 @@ jobs: # e.g. "Merge 3e621938d65caaa67f8e35d145335d889d470fc8 into 19a39b2f66cd7a165082d1486b2f1eb36ec2354a". ref: ${{ github.event.pull_request.head.sha }} # Fetch all history so gitlint can check the relevant commits. - fetch-depth: '0' + fetch-depth: "0" - name: Set up Python 3 uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: "3.x" - name: Set up Node.js 12 uses: actions/setup-node@v3 with: @@ -46,7 +46,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.x" + go-version: "1.21.x" - name: Set up Rust run: rustup show - name: Install dependencies diff --git a/.github/workflows/ci-reproducibility.yml b/.github/workflows/ci-reproducibility.yml index 91c3681eb6f..f75c4e94463 100644 --- a/.github/workflows/ci-reproducibility.yml +++ b/.github/workflows/ci-reproducibility.yml @@ -22,7 +22,6 @@ env: JEMALLOC_CHECKSUM: 34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6 jobs: - build-code: # NOTE: This name appears in GitHub's Checks API. name: build @@ -40,7 +39,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.x" + go-version: "1.21.x" - name: Set up Rust working-directory: build${{ matrix.build_number }} run: rustup show diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 78a26a9fec8..4fcad9272f7 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -19,7 +19,6 @@ env: JEMALLOC_CHECKSUM: 34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6 jobs: - prepare-dev-release: runs-on: ubuntu-22.04 steps: @@ -36,7 +35,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.x" + go-version: "1.21.x" - name: Set up Rust run: rustup show - name: Install Oasis Node prerequisites diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eed8a285a5f..d042cc460f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: # Pattern that roughly matches Oasis Core's version tags. # For more details on GitHub Actions' pattern match syntax, see: # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#patterns-to-match-branches-and-tags. - - 'v[0-9]+.[0-9]+*' + - "v[0-9]+.[0-9]+*" # Global environment variables. env: @@ -21,7 +21,6 @@ env: JEMALLOC_CHECKSUM: 34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6 jobs: - prepare-release: runs-on: ubuntu-22.04 steps: @@ -39,7 +38,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.20.x" + go-version: "1.21.x" - name: Set up Rust run: rustup show diff --git a/docker/oasis-core-dev/Dockerfile b/docker/oasis-core-dev/Dockerfile index 3098f9107ed..89d0ecd1281 100644 --- a/docker/oasis-core-dev/Dockerfile +++ b/docker/oasis-core-dev/Dockerfile @@ -1,15 +1,15 @@ FROM ubuntu:22.04 # Package versions. -ARG GO_VERSION=1.20.2 +ARG GO_VERSION=1.21.0 ARG GO_NANCY_VERSION=1.0.33 ARG GO_NANCY_CHECKSUM=a4bf5290d41b095c04f941ed5380674770c79d59735e33b1bd07a5cd5fbb135d ARG GO_PROTOC_VERSION=3.6.1 ARG GO_PROTOC_GEN_GO_VERSION=1.21.0 -ARG GOLANGCILINT_VERSION=1.51.2 +ARG GOLANGCILINT_VERSION=1.54.2 ARG GOCOVMERGE_VERSION=b5bfa59ec0adc420475f97f89b58045c721d761c -ARG GOFUMPT_VERSION=v0.4.0 -ARG GOIMPORTS_VERSION=v0.7.0 +ARG GOFUMPT_VERSION=v0.5.0 +ARG GOIMPORTS_VERSION=v0.12.0 ARG RUST_NIGHTLY_VERSION=2023-01-16 ARG JEMALLOC_VERSION=5.2.1 ARG JEMALLOC_CHECKSUM=34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6 diff --git a/docs/development-setup/prerequisites.md b/docs/development-setup/prerequisites.md index cb2bad607fb..323bf75ddf5 100644 --- a/docs/development-setup/prerequisites.md +++ b/docs/development-setup/prerequisites.md @@ -40,7 +40,7 @@ Core: ``` -* [Go] (at least version 1.20.2). +* [Go] (at least version 1.21.0). If your distribution provides a new-enough version of Go, just use that. @@ -52,18 +52,18 @@ Core: * [ensure `$GOPATH/bin` is in your `PATH`]( https://tip.golang.org/doc/code.html#GOPATH), * [install the desired version of Go]( - https://golang.org/doc/install#extra_versions), e.g. 1.20.2, with: + https://golang.org/doc/install#extra_versions), e.g. 1.21.0, with: ``` - go install golang.org/dl/go1.20.2@latest - go1.20.2 download + go install golang.org/dl/go1.21.0@latest + go1.21.0 download ``` * instruct the build system to use this particular version of Go by setting the `OASIS_GO` environment variable in your `~/.bashrc`: ``` - export OASIS_GO=go1.20.2 + export OASIS_GO=go1.21.0 ``` * [Rust]. @@ -137,8 +137,8 @@ Core: Download and install it with: ``` - ${OASIS_GO:-go} install mvdan.cc/gofumpt@v0.4.0 - ${OASIS_GO:-go} install golang.org/x/tools/cmd/goimports@v0.7.0 + ${OASIS_GO:-go} install mvdan.cc/gofumpt@v0.5.0 + ${OASIS_GO:-go} install golang.org/x/tools/cmd/goimports@v0.12.0 ``` * (**OPTIONAL**) [golangci-lint]. @@ -151,7 +151,7 @@ Core: ``` curl -sSfL \ https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ - | sh -s -- -b $(${OASIS_GO:-go} env GOPATH)/bin v1.51.2 + | sh -s -- -b $(${OASIS_GO:-go} env GOPATH)/bin v1.54.2 ``` * (**OPTIONAL**) [protoc-gen-go]. diff --git a/go/.golangci.yml b/go/.golangci.yml index 1b58640185d..13c3ddaaf2e 100644 --- a/go/.golangci.yml +++ b/go/.golangci.yml @@ -12,6 +12,42 @@ linters-settings: # Enable once suggested fixes are shown: https://github.com/golangci/golangci-lint/issues/2134 #enable: # - fieldalignment + depguard: + rules: + main: + files: + - $all + allow: + - $gostd + - github.com/a8m/envsubst + - github.com/btcsuite/btcutil + - github.com/cenkalti/backoff/v4 + - github.com/cometbft/cometbft + - github.com/cosmos/gogoproto/proto + - github.com/dgraph-io/badger/v3 + - github.com/eapache/channels + - github.com/fxamacker/cbor/v2 + - github.com/gammazero/deque + - github.com/go-kit/log + - github.com/goki/go-difflib + - github.com/golang/protobu + - github.com/golang/snappy + - github.com/google/btree + - github.com/hashicorp/go-hclog + - github.com/hashicorp/go-plugin + - github.com/hpcloud/tail + - github.com/ipfs/go-log/v2 + - github.com/libp2p/go-libp2p + - github.com/multiformats/go-multiaddr + - github.com/oasisprotocol + - github.com/olekukonko/tablewriter + - github.com/powerman/rpc-codec + - github.com/prometheus + - github.com/seccomp/libseccomp-golang + - github.com/spf13 + - github.com/stretchr + - github.com/tidwall/btree + - github.com/tyler-smith/go-bip39 linters: disable-all: true diff --git a/go/go.mod b/go/go.mod index fd239a580e9..8f90a92188d 100644 --- a/go/go.mod +++ b/go/go.mod @@ -66,8 +66,8 @@ require ( require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/btcsuite/btcd v0.20.1-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect - github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/containerd/cgroups v1.1.0 // indirect @@ -141,7 +141,7 @@ require ( github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/minio/sha256-simd v1.0.1 // indirect - github.com/mitchellh/go-testing-interface v1.0.0 // indirect + github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -195,4 +195,4 @@ require ( lukechampine.com/blake3 v1.2.1 // indirect ) -go 1.19 +go 1.21 diff --git a/go/go.sum b/go/go.sum index 327c3525277..f6be6f2a427 100644 --- a/go/go.sum +++ b/go/go.sum @@ -45,17 +45,23 @@ dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1 dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/a8m/envsubst v1.4.2 h1:4yWIHXOLEJHQEFd4UjrWDrYeYlV7ncFWJOCBRLOZHQg= github.com/a8m/envsubst v1.4.2/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= +github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= @@ -72,8 +78,7 @@ github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13P github.com/btcsuite/btcd/btcec/v2 v2.2.1 h1:xP60mv8fvp+0khmrN0zTdPC3cNm24rfeE6lh2R/Yv3E= github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8= github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/btcutil v1.1.2/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= @@ -85,6 +90,7 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= @@ -108,6 +114,7 @@ github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTF github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -116,6 +123,7 @@ github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/gogoproto v1.4.1 h1:WoyH+0/jbCTzpKNvyav5FL1ZTWsp1im1MxEpJEzKUB8= github.com/cosmos/gogoproto v1.4.1/go.mod h1:Ac9lzL4vFpBMcptJROQ6dQ4M3pOEK5Z/l0Q9p+LoCr4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -132,6 +140,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= @@ -144,6 +153,7 @@ github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkz github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -164,14 +174,18 @@ 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/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= @@ -197,6 +211,7 @@ github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= 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-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -266,6 +281,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= @@ -306,6 +322,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpg github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -352,9 +369,11 @@ github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZl github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b h1:izTof8BKh/nE1wrKOrloNA5q4odOarjf+Xpe+4qow98= +github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= 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/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -397,6 +416,7 @@ github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNz github.com/libp2p/go-libp2p-pubsub v0.9.3 h1:ihcz9oIBMaCK9kcx+yHWm3mLAFBMAUsM4ux42aikDxo= github.com/libp2p/go-libp2p-pubsub v0.9.3/go.mod h1:RYA7aM9jIic5VV47WXu4GkcRxRhrdElWf8xtyli+Dzc= github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk= @@ -448,8 +468,8 @@ github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1 github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +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/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -487,6 +507,7 @@ github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXS github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= @@ -510,20 +531,26 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= +github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= +github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -602,6 +629,7 @@ github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYED github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -676,12 +704,14 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -800,6 +830,7 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= +golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= 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= @@ -1087,6 +1118,7 @@ gopkg.in/yaml.v2 v2.2.4/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 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From 32d6200c7bfae5b8c921f358df7c5898f0dfb4fa Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 11:15:24 +0200 Subject: [PATCH 02/11] go: Use package slices introduced in go 1.21.0 --- go/consensus/cometbft/apps/keymanager/transactions.go | 3 +-- go/go.mod | 2 +- .../scenario/e2e/runtime/keymanager_replicate.go | 3 +-- go/worker/keymanager/worker.go | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go/consensus/cometbft/apps/keymanager/transactions.go b/go/consensus/cometbft/apps/keymanager/transactions.go index 4d636836a53..ec45f09cf93 100644 --- a/go/consensus/cometbft/apps/keymanager/transactions.go +++ b/go/consensus/cometbft/apps/keymanager/transactions.go @@ -2,8 +2,7 @@ package keymanager import ( "fmt" - - "golang.org/x/exp/slices" + "slices" "github.com/oasisprotocol/curve25519-voi/primitives/x25519" diff --git a/go/go.mod b/go/go.mod index 8f90a92188d..d0c6bd59feb 100644 --- a/go/go.mod +++ b/go/go.mod @@ -54,7 +54,6 @@ require ( go.uber.org/multierr v1.11.0 go.uber.org/zap v1.25.0 golang.org/x/crypto v0.12.0 - golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 golang.org/x/net v0.14.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 google.golang.org/grpc v1.57.0 @@ -184,6 +183,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.20.0 // indirect + golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.11.0 // indirect diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go index 6bdefd9398c..158b71eef22 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go @@ -4,8 +4,7 @@ import ( "bytes" "context" "fmt" - - "golang.org/x/exp/slices" + "slices" beacon "github.com/oasisprotocol/oasis-core/go/beacon/api" keymanager "github.com/oasisprotocol/oasis-core/go/keymanager/api" diff --git a/go/worker/keymanager/worker.go b/go/worker/keymanager/worker.go index f7a0a1c55a8..663debfbbde 100644 --- a/go/worker/keymanager/worker.go +++ b/go/worker/keymanager/worker.go @@ -7,12 +7,12 @@ import ( "fmt" "math" "math/rand" + "slices" "sync" "time" "github.com/cenkalti/backoff/v4" "github.com/libp2p/go-libp2p/core" - "golang.org/x/exp/slices" "github.com/oasisprotocol/curve25519-voi/primitives/x25519" From 1408f66e805ce837b62303a533b78dbca56e849f Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 12:40:56 +0200 Subject: [PATCH 03/11] go: Use function errors.Join introduced in go 1.20.0 --- go/common/logging/zap_test.go | 4 ++-- go/consensus/cometbft/abci/messages.go | 5 ++--- go/consensus/cometbft/governance/governance.go | 12 ++++++------ go/consensus/cometbft/registry/registry.go | 12 ++++++------ go/consensus/cometbft/roothash/roothash.go | 18 +++++++++--------- go/consensus/cometbft/staking/staking.go | 18 +++++++++--------- go/go.mod | 4 +--- go/go.sum | 5 ----- .../scenario/e2e/runtime/helpers_runtime.go | 10 +++------- .../scenario/e2e/runtime/trust_root.go | 6 ++---- .../scenario/e2e/runtime/trust_root_change.go | 9 +++------ go/runtime/host/multi/multi.go | 11 ++++------- 12 files changed, 47 insertions(+), 67 deletions(-) diff --git a/go/common/logging/zap_test.go b/go/common/logging/zap_test.go index f3e282c71a3..3842d12cc78 100644 --- a/go/common/logging/zap_test.go +++ b/go/common/logging/zap_test.go @@ -1,11 +1,11 @@ package logging import ( + "errors" "testing" "time" "github.com/stretchr/testify/assert" - "go.uber.org/multierr" "go.uber.org/zap/zapcore" ) @@ -46,7 +46,7 @@ func (t turduckens) MarshalLogArray(enc zapcore.ArrayEncoder) error { var err error tur := turducken{} for i := 0; i < int(t); i++ { - err = multierr.Append(err, enc.AppendObject(tur)) + err = errors.Join(err, enc.AppendObject(tur)) } return err } diff --git a/go/consensus/cometbft/abci/messages.go b/go/consensus/cometbft/abci/messages.go index 158862ffbd1..72e19a4670c 100644 --- a/go/consensus/cometbft/abci/messages.go +++ b/go/consensus/cometbft/abci/messages.go @@ -1,10 +1,9 @@ package abci import ( + "errors" "fmt" - "github.com/hashicorp/go-multierror" - "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/api" ) @@ -33,7 +32,7 @@ func (md *messageDispatcher) Publish(ctx *api.Context, kind, msg interface{}) (i var errs error for _, ms := range md.subscriptions[kind] { if resp, err := ms.ExecuteMessage(ctx, kind, msg); err != nil { - errs = multierror.Append(errs, err) + errs = errors.Join(errs, err) } else { switch { case resp != nil && result == nil: diff --git a/go/consensus/cometbft/governance/governance.go b/go/consensus/cometbft/governance/governance.go index f54ea0f15c4..f5e0b05ffb2 100644 --- a/go/consensus/cometbft/governance/governance.go +++ b/go/consensus/cometbft/governance/governance.go @@ -3,13 +3,13 @@ package governance import ( "context" + "errors" "fmt" cmtabcitypes "github.com/cometbft/cometbft/abci/types" cmtpubsub "github.com/cometbft/cometbft/libs/pubsub" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" cmttypes "github.com/cometbft/cometbft/types" - "github.com/hashicorp/go-multierror" "github.com/oasisprotocol/oasis-core/go/common/crypto/hash" "github.com/oasisprotocol/oasis-core/go/common/logging" @@ -215,7 +215,7 @@ func EventsFromCometBFT( // Proposal submitted event. var e api.ProposalSubmittedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("governance: corrupt ProposalSubmitted event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("governance: corrupt ProposalSubmitted event: %w", err)) continue } @@ -225,7 +225,7 @@ func EventsFromCometBFT( // Proposal executed event. var e api.ProposalExecutedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("governance: corrupt ProposalExecuted event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("governance: corrupt ProposalExecuted event: %w", err)) continue } @@ -235,7 +235,7 @@ func EventsFromCometBFT( // Proposal finalized event. var e api.ProposalFinalizedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("governance: corrupt ProposalFinalized event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("governance: corrupt ProposalFinalized event: %w", err)) continue } @@ -245,14 +245,14 @@ func EventsFromCometBFT( // Vote event. var e api.VoteEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("governance: corrupt Vote event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("governance: corrupt Vote event: %w", err)) continue } evt := &api.Event{Height: height, TxHash: txHash, Vote: &e} events = append(events, evt) default: - errs = multierror.Append(errs, fmt.Errorf("governance: unknown event type: key: %s, val: %s", key, val)) + errs = errors.Join(errs, fmt.Errorf("governance: unknown event type: key: %s, val: %s", key, val)) } } } diff --git a/go/consensus/cometbft/registry/registry.go b/go/consensus/cometbft/registry/registry.go index 9cd65db6f7d..780680a02bc 100644 --- a/go/consensus/cometbft/registry/registry.go +++ b/go/consensus/cometbft/registry/registry.go @@ -3,6 +3,7 @@ package registry import ( "context" + "errors" "fmt" cmtabcitypes "github.com/cometbft/cometbft/abci/types" @@ -10,7 +11,6 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" cmttypes "github.com/cometbft/cometbft/types" "github.com/eapache/channels" - "github.com/hashicorp/go-multierror" "github.com/oasisprotocol/oasis-core/go/common/crypto/hash" "github.com/oasisprotocol/oasis-core/go/common/entity" @@ -314,7 +314,7 @@ func EventsFromCometBFT( // Runtime started event. var e api.RuntimeStartedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("registry: corrupt RuntimeStarted event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("registry: corrupt RuntimeStarted event: %w", err)) continue } @@ -323,7 +323,7 @@ func EventsFromCometBFT( // Runtime suspended event. var e api.RuntimeSuspendedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("registry: corrupt RuntimeSuspended event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("registry: corrupt RuntimeSuspended event: %w", err)) continue } @@ -332,7 +332,7 @@ func EventsFromCometBFT( // Entity event. var e api.EntityEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("registry: corrupt Entity event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("registry: corrupt Entity event: %w", err)) continue } @@ -341,7 +341,7 @@ func EventsFromCometBFT( // Node event. var e api.NodeEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("registry: corrupt Node event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("registry: corrupt Node event: %w", err)) continue } @@ -350,7 +350,7 @@ func EventsFromCometBFT( // Node unfrozen event. var e api.NodeUnfrozenEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("registry: corrupt NodeUnfrozen event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("registry: corrupt NodeUnfrozen event: %w", err)) continue } events = append(events, &api.Event{Height: height, TxHash: txHash, NodeUnfrozenEvent: &e}) diff --git a/go/consensus/cometbft/roothash/roothash.go b/go/consensus/cometbft/roothash/roothash.go index 5184e3a2f89..bce0bad4254 100644 --- a/go/consensus/cometbft/roothash/roothash.go +++ b/go/consensus/cometbft/roothash/roothash.go @@ -3,6 +3,7 @@ package roothash import ( "context" + "errors" "fmt" "math" "sync" @@ -12,7 +13,6 @@ import ( cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" cmttypes "github.com/cometbft/cometbft/types" "github.com/eapache/channels" - "github.com/hashicorp/go-multierror" "github.com/oasisprotocol/oasis-core/go/common" "github.com/oasisprotocol/oasis-core/go/common/crash" @@ -757,7 +757,7 @@ EventLoop: // Finalized event. var e api.FinalizedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("roothash: corrupt Finalized event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("roothash: corrupt Finalized event: %w", err)) continue EventLoop } @@ -766,7 +766,7 @@ EventLoop: // An execution discrepancy has been detected. var e api.ExecutionDiscrepancyDetectedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("roothash: corrupt ExecutionDiscrepancyDetected event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("roothash: corrupt ExecutionDiscrepancyDetected event: %w", err)) continue EventLoop } @@ -775,7 +775,7 @@ EventLoop: // An executor commit has been processed. var e api.ExecutorCommittedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("roothash: corrupt ExecutorComitted event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("roothash: corrupt ExecutorComitted event: %w", err)) continue EventLoop } @@ -784,29 +784,29 @@ EventLoop: // Incoming message processed event. var e api.InMsgProcessedEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("roothash: corrupt InMsgProcessed event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("roothash: corrupt InMsgProcessed event: %w", err)) continue EventLoop } ev = &api.Event{InMsgProcessed: &e} case eventsAPI.IsAttributeKind(key, &api.RuntimeIDAttribute{}): if runtimeID != nil { - errs = multierror.Append(errs, fmt.Errorf("roothash: duplicate runtime ID attribute")) + errs = errors.Join(errs, fmt.Errorf("roothash: duplicate runtime ID attribute")) continue EventLoop } rtAttribute := api.RuntimeIDAttribute{} if err := eventsAPI.DecodeValue(val, &rtAttribute); err != nil { - errs = multierror.Append(errs, fmt.Errorf("roothash: corrupt runtime ID: %w", err)) + errs = errors.Join(errs, fmt.Errorf("roothash: corrupt runtime ID: %w", err)) continue EventLoop } runtimeID = &rtAttribute.ID default: - errs = multierror.Append(errs, fmt.Errorf("roothash: unknown event type: key: %s, val: %s", key, val)) + errs = errors.Join(errs, fmt.Errorf("roothash: unknown event type: key: %s, val: %s", key, val)) } } if runtimeID == nil { - errs = multierror.Append(errs, fmt.Errorf("roothash: missing runtime ID attribute")) + errs = errors.Join(errs, fmt.Errorf("roothash: missing runtime ID attribute")) continue } if ev != nil { diff --git a/go/consensus/cometbft/staking/staking.go b/go/consensus/cometbft/staking/staking.go index fea9718eca5..f90469ee03b 100644 --- a/go/consensus/cometbft/staking/staking.go +++ b/go/consensus/cometbft/staking/staking.go @@ -3,13 +3,13 @@ package staking import ( "context" + "errors" "fmt" cmtabcitypes "github.com/cometbft/cometbft/abci/types" cmtpubsub "github.com/cometbft/cometbft/libs/pubsub" cmtrpctypes "github.com/cometbft/cometbft/rpc/core/types" cmttypes "github.com/cometbft/cometbft/types" - "github.com/hashicorp/go-multierror" "github.com/oasisprotocol/oasis-core/go/common/crypto/hash" "github.com/oasisprotocol/oasis-core/go/common/logging" @@ -342,7 +342,7 @@ func EventsFromCometBFT( // Take escrow event. var e api.TakeEscrowEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("staking: corrupt TakeEscrow event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("staking: corrupt TakeEscrow event: %w", err)) continue } @@ -352,7 +352,7 @@ func EventsFromCometBFT( // Transfer event. var e api.TransferEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("staking: corrupt Transfer event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("staking: corrupt Transfer event: %w", err)) continue } @@ -362,7 +362,7 @@ func EventsFromCometBFT( // Reclaim escrow event. var e api.ReclaimEscrowEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("staking: corrupt ReclaimEscrow event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("staking: corrupt ReclaimEscrow event: %w", err)) continue } @@ -372,7 +372,7 @@ func EventsFromCometBFT( // Add escrow event. var e api.AddEscrowEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("staking: corrupt AddEscrow event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("staking: corrupt AddEscrow event: %w", err)) continue } @@ -382,7 +382,7 @@ func EventsFromCometBFT( // Debonding start escrow event. var e api.DebondingStartEscrowEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("staking: corrupt DebondingStart escrow event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("staking: corrupt DebondingStart escrow event: %w", err)) continue } @@ -392,7 +392,7 @@ func EventsFromCometBFT( // Burn event. var e api.BurnEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("staking: corrupt Burn event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("staking: corrupt Burn event: %w", err)) continue } @@ -402,14 +402,14 @@ func EventsFromCometBFT( // Allowance change event. var e api.AllowanceChangeEvent if err := eventsAPI.DecodeValue(val, &e); err != nil { - errs = multierror.Append(errs, fmt.Errorf("staking: corrupt AllowanceChange event: %w", err)) + errs = errors.Join(errs, fmt.Errorf("staking: corrupt AllowanceChange event: %w", err)) continue } evt := &api.Event{Height: height, TxHash: txHash, AllowanceChange: &e} events = append(events, evt) default: - errs = multierror.Append(errs, fmt.Errorf("staking: unknown event type: key: %s, val: %s", key, val)) + errs = errors.Join(errs, fmt.Errorf("staking: unknown event type: key: %s, val: %s", key, val)) } } } diff --git a/go/go.mod b/go/go.mod index d0c6bd59feb..97a22767d27 100644 --- a/go/go.mod +++ b/go/go.mod @@ -28,7 +28,6 @@ require ( github.com/golang/snappy v0.0.4 github.com/google/btree v1.1.2 github.com/hashicorp/go-hclog v1.4.0 - github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-plugin v1.4.6 github.com/hpcloud/tail v1.0.0 github.com/ipfs/go-log/v2 v2.5.1 @@ -51,7 +50,6 @@ require ( github.com/thepudds/fzgo v0.2.2 github.com/tidwall/btree v1.6.0 github.com/tyler-smith/go-bip39 v1.1.0 - go.uber.org/multierr v1.11.0 go.uber.org/zap v1.25.0 golang.org/x/crypto v0.12.0 golang.org/x/net v0.14.0 @@ -102,7 +100,6 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/gtank/merlin v0.1.1 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect @@ -183,6 +180,7 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/dig v1.17.0 // indirect go.uber.org/fx v1.20.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect diff --git a/go/go.sum b/go/go.sum index f6be6f2a427..439903ec59a 100644 --- a/go/go.sum +++ b/go/go.sum @@ -323,13 +323,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I= github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.4.6 h1:MDV3UrKQBM3du3G7MApDGvOsMYy3JQJ4exhSoKBAeVA= github.com/hashicorp/go-plugin v1.4.6/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= diff --git a/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go b/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go index bbe6b4a7452..dd15c8bdbdf 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go @@ -3,12 +3,11 @@ package runtime import ( "bytes" "context" + "errors" "fmt" "path/filepath" "time" - "github.com/hashicorp/go-multierror" - "github.com/oasisprotocol/oasis-core/go/common" "github.com/oasisprotocol/oasis-core/go/common/cbor" "github.com/oasisprotocol/oasis-core/go/common/node" @@ -89,7 +88,6 @@ func (sc *Scenario) BuildRuntimes(ctx context.Context, childEnv *env.Env, runtim builder := rust.NewBuilder(childEnv, buildDir, targetDir, teeHardware) // Build runtimes one by one. - var errs *multierror.Error for runtimeID, runtimeBinary := range runtimes { switch trustRoot { case nil: @@ -114,11 +112,9 @@ func (sc *Scenario) BuildRuntimes(ctx context.Context, childEnv *env.Env, runtim } // Build a new runtime with the given trust root embedded. - if err = builder.Build(runtimeBinary); err != nil { - errs = multierror.Append(errs, err) - } + err = errors.Join(err, builder.Build(runtimeBinary)) } - if err = errs.ErrorOrNil(); err != nil { + if err != nil { return fmt.Errorf("failed to build runtimes: %w", err) } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go b/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go index 63c57cab915..f68f3657667 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go @@ -2,10 +2,9 @@ package runtime import ( "context" + "errors" "fmt" - "github.com/hashicorp/go-multierror" - consensus "github.com/oasisprotocol/oasis-core/go/consensus/api" "github.com/oasisprotocol/oasis-core/go/oasis-test-runner/env" "github.com/oasisprotocol/oasis-core/go/oasis-test-runner/oasis" @@ -152,8 +151,7 @@ func (sc *TrustRootImpl) Run(ctx context.Context, childEnv *env.Env) (err error) return err } defer func() { - err2 := sc.PostRun(ctx, childEnv) - err = multierror.Append(err, err2).ErrorOrNil() + err = errors.Join(err, sc.PostRun(ctx, childEnv)) }() sc.Logger.Info("testing query latest block") diff --git a/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go b/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go index 4078b12bdcf..591a635c679 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go @@ -2,11 +2,10 @@ package runtime import ( "context" + "errors" "fmt" "time" - "github.com/hashicorp/go-multierror" - "github.com/oasisprotocol/oasis-core/go/common/node" genesis "github.com/oasisprotocol/oasis-core/go/genesis/api" "github.com/oasisprotocol/oasis-core/go/oasis-test-runner/env" @@ -113,8 +112,7 @@ func (sc *trustRootChangeImpl) happyRun(ctx context.Context, childEnv *env.Env) return err } defer func() { - err2 := sc.PostRun(ctx, childEnv) - err = multierror.Append(err, err2).ErrorOrNil() + err = errors.Join(err, sc.PostRun(ctx, childEnv)) }() // All chain contexts should be unique. @@ -189,8 +187,7 @@ func (sc *trustRootChangeImpl) unhappyRun(ctx context.Context, childEnv *env.Env return err } defer func() { - err2 := sc.PostRun(ctx, childEnv) - err = multierror.Append(err, err2).ErrorOrNil() + err = errors.Join(err, sc.PostRun(ctx, childEnv)) }() chainContext, err := sc.ChainContext(ctx) diff --git a/go/runtime/host/multi/multi.go b/go/runtime/host/multi/multi.go index cb14e243563..ba48b1989b8 100644 --- a/go/runtime/host/multi/multi.go +++ b/go/runtime/host/multi/multi.go @@ -10,7 +10,6 @@ import ( "sync" "github.com/cenkalti/backoff/v4" - "github.com/hashicorp/go-multierror" "github.com/oasisprotocol/oasis-core/go/common" cmnBackoff "github.com/oasisprotocol/oasis-core/go/common/backoff" @@ -177,16 +176,14 @@ func (agg *Aggregate) UpdateCapabilityTEE(ctx context.Context) error { agg.l.RLock() defer agg.l.RUnlock() - var errs *multierror.Error + var err error if agg.active != nil { - err := agg.active.host.UpdateCapabilityTEE(ctx) - errs = multierror.Append(errs, err) + err = errors.Join(err, agg.active.host.UpdateCapabilityTEE(ctx)) } if agg.next != nil { - err := agg.next.host.UpdateCapabilityTEE(ctx) - errs = multierror.Append(errs, err) + err = errors.Join(err, agg.next.host.UpdateCapabilityTEE(ctx)) } - return errs.ErrorOrNil() + return err } // WatchEvents implements host.Runtime. From 4264b9f5124736cb1b2bd51f6b9fd0b94b1e1e3d Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 15:19:46 +0200 Subject: [PATCH 04/11] go-lint: Remove or replace unused variables with underscore --- go/beacon/api/grpc.go | 8 +- go/common/crypto/mathrand/rand.go | 2 +- go/common/crypto/signature/signature.go | 4 +- .../signature/signers/memory/memory_signer.go | 4 +- .../crypto/signature/signers/plugin/plugin.go | 6 +- .../crypto/signature/signers/plugin/rpc.go | 4 +- .../crypto/signature/signers/remote/grpc.go | 30 ++--- go/common/grpc/auth/auth.go | 14 +- go/common/grpc/auth/auth_test.go | 4 +- go/common/grpc/auth/auth_tls.go | 2 +- go/common/grpc/auth/auth_tls_pubkeys.go | 2 +- go/common/grpc/errors.go | 4 +- go/common/grpc/errors_test.go | 6 +- go/common/grpc/service.go | 8 +- go/common/grpc/testing/ping.go | 24 ++-- go/common/grpc/wrapper_test.go | 2 +- go/common/version/version.go | 2 +- go/consensus/api/grpc.go | 10 +- go/consensus/api/light.go | 2 +- go/consensus/api/submission.go | 10 +- go/consensus/cometbft/abci/messages_test.go | 2 +- go/consensus/cometbft/abci/mux.go | 2 +- go/consensus/cometbft/abci/prune.go | 4 +- go/consensus/cometbft/abci/prune_test.go | 2 +- go/consensus/cometbft/abci/snapshots.go | 4 +- go/consensus/cometbft/abci/state.go | 8 +- go/consensus/cometbft/abci/transaction.go | 2 +- go/consensus/cometbft/api/api.go | 6 +- go/consensus/cometbft/api/gas.go | 2 +- go/consensus/cometbft/api/state.go | 8 +- .../cometbft/apps/beacon/backend_insecure.go | 4 +- .../cometbft/apps/beacon/backend_vrf.go | 2 +- go/consensus/cometbft/apps/beacon/beacon.go | 6 +- go/consensus/cometbft/apps/beacon/genesis.go | 2 +- .../cometbft/apps/governance/genesis.go | 2 +- .../cometbft/apps/governance/governance.go | 6 +- .../cometbft/apps/governance/messages.go | 2 +- .../cometbft/apps/keymanager/genesis.go | 2 +- .../cometbft/apps/keymanager/keymanager.go | 6 +- .../cometbft/apps/registry/genesis.go | 2 +- .../cometbft/apps/registry/registry.go | 4 +- .../cometbft/apps/registry/transactions.go | 1 - .../apps/registry/transactions_test.go | 8 +- .../cometbft/apps/roothash/genesis.go | 2 +- .../cometbft/apps/roothash/roothash.go | 6 +- .../cometbft/apps/roothash/transactions.go | 25 ++-- .../cometbft/apps/scheduler/scheduler.go | 5 +- .../cometbft/apps/scheduler/scheduler_test.go | 1 - .../cometbft/apps/scheduler/shuffle.go | 3 +- go/consensus/cometbft/apps/staking/genesis.go | 2 +- .../cometbft/apps/staking/slashing.go | 4 - .../cometbft/apps/staking/slashing_test.go | 16 +-- go/consensus/cometbft/apps/staking/staking.go | 2 +- .../apps/supplementarysanity/checks.go | 8 +- .../supplementarysanity.go | 4 +- go/consensus/cometbft/beacon/beacon.go | 10 +- go/consensus/cometbft/full/archive.go | 4 +- go/consensus/cometbft/full/common.go | 30 ++--- go/consensus/cometbft/full/full.go | 4 +- .../cometbft/governance/governance.go | 6 +- .../cometbft/keymanager/keymanager.go | 2 +- go/consensus/cometbft/light/service.go | 2 +- go/consensus/cometbft/registry/registry.go | 10 +- go/consensus/cometbft/roothash/roothash.go | 9 +- go/consensus/cometbft/scheduler/scheduler.go | 6 +- go/consensus/cometbft/staking/staking.go | 6 +- go/control/api/grpc.go | 10 +- go/extra/extract-metrics/main.go | 2 +- go/governance/api/api.go | 6 +- go/governance/tests/tester.go | 4 +- go/ias/api/grpc.go | 2 +- go/ias/http/http.go | 8 +- go/ias/proxy/proxy.go | 10 +- go/oasis-net-runner/cmd/root.go | 4 +- go/oasis-net-runner/fixtures/default.go | 3 +- go/oasis-node/cmd/common/signer/signer.go | 2 +- go/oasis-node/cmd/consensus/consensus.go | 8 +- go/oasis-node/cmd/control/control.go | 10 +- go/oasis-node/cmd/debug/beacon/beacon.go | 2 +- go/oasis-node/cmd/debug/bundle/bundle.go | 4 +- .../cmd/debug/byzantine/beacon_vrf.go | 2 +- .../cmd/debug/byzantine/byzantine.go | 4 +- go/oasis-node/cmd/debug/byzantine/node.go | 2 - go/oasis-node/cmd/debug/byzantine/p2p.go | 8 +- go/oasis-node/cmd/debug/byzantine/registry.go | 5 +- go/oasis-node/cmd/debug/control/control.go | 6 +- go/oasis-node/cmd/debug/dumpdb/dumpdb.go | 5 +- .../cmd/debug/fixgenesis/fixgenesis.go | 7 +- go/oasis-node/cmd/debug/storage/benchmark.go | 17 +-- go/oasis-node/cmd/debug/storage/export.go | 2 +- go/oasis-node/cmd/debug/txsource/txsource.go | 2 +- .../cmd/debug/txsource/workload/commission.go | 2 +- .../cmd/debug/txsource/workload/delegation.go | 2 +- .../cmd/debug/txsource/workload/governance.go | 2 +- .../cmd/debug/txsource/workload/oversized.go | 4 +- .../cmd/debug/txsource/workload/parallel.go | 4 +- .../cmd/debug/txsource/workload/queries.go | 16 +-- .../debug/txsource/workload/registration.go | 2 +- .../cmd/debug/txsource/workload/runtime.go | 4 +- .../cmd/debug/txsource/workload/transfer.go | 2 +- go/oasis-node/cmd/genesis/genesis.go | 6 +- go/oasis-node/cmd/governance/governance.go | 10 +- go/oasis-node/cmd/ias/auth_registry.go | 2 +- go/oasis-node/cmd/ias/proxy.go | 2 +- .../cmd/identity/cometbft/cometbft.go | 4 +- go/oasis-node/cmd/identity/identity.go | 4 +- go/oasis-node/cmd/keymanager/keymanager.go | 10 +- go/oasis-node/cmd/node/node.go | 10 +- go/oasis-node/cmd/node/node_control.go | 30 ++--- go/oasis-node/cmd/node/run.go | 2 +- go/oasis-node/cmd/node/seed_control.go | 16 +-- go/oasis-node/cmd/node/unsafe_reset.go | 2 +- go/oasis-node/cmd/registry/entity/entity.go | 10 +- go/oasis-node/cmd/registry/node/node.go | 6 +- go/oasis-node/cmd/registry/runtime/runtime.go | 4 +- go/oasis-node/cmd/signer/signer.go | 2 +- go/oasis-node/cmd/stake/account.go | 20 +-- go/oasis-node/cmd/stake/stake.go | 6 +- go/oasis-node/cmd/storage/storage.go | 6 +- go/oasis-node/node_test.go | 6 +- go/oasis-remote-signer/cmd/root.go | 6 +- go/oasis-test-runner/cmd/cmp/cmp.go | 2 +- go/oasis-test-runner/cmd/root.go | 6 +- go/oasis-test-runner/log/handlers.go | 2 +- go/oasis-test-runner/oasis/args.go | 4 +- go/oasis-test-runner/oasis/cli/cli.go | 2 +- go/oasis-test-runner/oasis/seed.go | 2 +- .../scenario/e2e/byzantine_beacon_vrf.go | 2 +- .../scenario/e2e/change_reward_schedule.go | 2 +- .../e2e/consensus_parameter_upgrade.go | 2 +- .../scenario/e2e/consensus_state_sync.go | 2 +- go/oasis-test-runner/scenario/e2e/debond.go | 2 +- .../scenario/e2e/early_query.go | 2 +- .../scenario/e2e/genesis_file.go | 4 +- .../scenario/e2e/helpers_consensus.go | 4 +- .../scenario/e2e/helpers_network.go | 2 +- .../scenario/e2e/identity_cli.go | 6 +- .../scenario/e2e/min_transact_balance.go | 4 +- .../scenario/e2e/multiple_seeds.go | 2 +- .../scenario/e2e/registry_cli.go | 2 +- .../scenario/e2e/runtime/byzantine.go | 2 +- .../scenario/e2e/runtime/gas_fees.go | 2 +- .../e2e/runtime/helpers_keymanager.go | 6 +- .../scenario/e2e/runtime/helpers_network.go | 6 +- .../scenario/e2e/runtime/helpers_runtime.go | 8 +- .../scenario/e2e/runtime/history_reindex.go | 2 +- .../runtime/keymanager_ephemeral_secrets.go | 11 +- .../e2e/runtime/keymanager_master_secrets.go | 4 +- .../e2e/runtime/keymanager_replicate.go | 2 +- .../e2e/runtime/keymanager_replicate_many.go | 4 +- .../runtime/keymanager_rotation_failure.go | 6 +- .../scenario/e2e/runtime/multiple_runtimes.go | 2 +- .../scenario/e2e/runtime/runtime.go | 1 - .../scenario/e2e/runtime/runtime_dynamic.go | 8 +- .../e2e/runtime/runtime_governance.go | 2 +- .../scenario/e2e/runtime/runtime_message.go | 4 +- .../scenario/e2e/runtime/runtime_prune.go | 2 +- .../scenario/e2e/runtime/scenario.go | 2 +- .../e2e/runtime/storage_early_state_sync.go | 2 +- .../e2e/runtime/storage_sync_inconsistent.go | 4 +- .../scenario/e2e/runtime/test_client.go | 2 +- .../scenario/e2e/runtime/trust_root.go | 12 +- .../scenario/e2e/runtime/txsource.go | 2 +- go/oasis-test-runner/scenario/e2e/scenario.go | 4 +- go/oasis-test-runner/scenario/e2e/seed_api.go | 2 +- go/oasis-test-runner/scenario/e2e/upgrade.go | 6 +- .../scenario/e2e/validator_equivocation.go | 2 +- .../scenario/pluginsigner/basic.go | 2 +- .../scenario/pluginsigner/pluginsigner.go | 4 +- .../scenario/remotesigner/basic.go | 9 +- .../scenario/remotesigner/remotesigner.go | 4 +- go/oasis-test-runner/scenario/scenario.go | 2 +- go/p2p/api/crypto.go | 2 +- go/p2p/backup/cstore.go | 6 +- go/p2p/backup/memory.go | 6 +- go/p2p/discovery/bootstrap/client.go | 2 +- go/p2p/discovery/bootstrap/client_test.go | 2 +- go/p2p/discovery/peerstore/peerstore.go | 2 +- go/p2p/dispatch.go | 2 +- go/p2p/nop.go | 12 +- go/p2p/p2p.go | 2 +- go/p2p/peermgmt/discovery_test.go | 4 +- go/p2p/rpc/client_test.go | 8 +- go/p2p/rpc/nop.go | 49 +++---- go/p2p/rpc/peermgmt_test.go | 4 +- go/registry/api/api.go | 2 +- go/registry/api/api_test.go | 14 +- go/registry/api/runtime.go | 2 +- go/registry/api/sanity_check.go | 14 +- go/registry/tests/tester.go | 16 +-- go/roothash/api/api.go | 3 +- go/roothash/api/commitment/pool.go | 2 - go/roothash/api/commitment/pool_test.go | 50 +++---- go/roothash/api/grpc.go | 2 +- go/roothash/api/history.go | 2 +- go/roothash/tests/tester.go | 36 +++--- go/runtime/client/tests/tester.go | 3 +- go/runtime/history/history.go | 20 +-- go/runtime/history/history_test.go | 20 +-- go/runtime/history/prune.go | 4 +- go/runtime/host/host.go | 4 +- go/runtime/host/mock/mock.go | 12 +- go/runtime/host/multi/multi.go | 18 +-- go/runtime/host/protocol/connection.go | 8 +- go/runtime/host/protocol/connection_test.go | 18 +-- go/runtime/host/sandbox/sandbox.go | 8 +- go/runtime/host/sgx/ecdsa.go | 2 +- go/runtime/host/sgx/epid.go | 2 +- go/runtime/host/sgx/sgx.go | 10 +- go/runtime/host/sgx/sgx_test.go | 2 +- go/runtime/host/tests/tester.go | 6 +- go/runtime/registry/host.go | 45 +++---- go/runtime/registry/registry.go | 8 +- go/runtime/txpool/local_queue.go | 2 +- go/runtime/txpool/rim_queue.go | 4 +- go/runtime/txpool/txpool.go | 12 +- go/sentry/api/grpc.go | 2 +- go/sentry/sentry.go | 4 +- go/staking/api/api.go | 4 +- go/staking/api/grpc.go | 4 +- go/staking/tests/tester.go | 41 +++--- go/storage/api/root_cache.go | 2 +- go/storage/database/database.go | 6 +- go/storage/mkvs/checkpoint/checkpoint_test.go | 12 +- go/storage/mkvs/checkpoint/checkpointer.go | 2 +- .../mkvs/checkpoint/checkpointer_test.go | 6 +- go/storage/mkvs/checkpoint/file.go | 8 +- go/storage/mkvs/checkpoint/restorer.go | 4 +- go/storage/mkvs/db/api/api.go | 32 ++--- go/storage/mkvs/db/badger/badger.go | 10 +- go/storage/mkvs/db/badger/badger_test.go | 12 +- go/storage/mkvs/db/badger/migrate_test.go | 20 +-- go/storage/mkvs/interop/cmd/db_json_rpc.go | 2 +- .../mkvs/interop/cmd/protocol_server.go | 2 +- .../mkvs/interop/fixtures/consensus_mock.go | 2 +- go/storage/mkvs/overlay.go | 8 +- go/storage/mkvs/syncer/syncer.go | 6 +- go/storage/mkvs/tree_test.go | 122 +++++++++--------- go/storage/tests/tester.go | 2 +- go/upgrade/api/api.go | 10 +- go/upgrade/dummy.go | 14 +- .../migrations/consensus_max_allowances.go | 4 +- go/upgrade/migrations/consensus_v62.go | 4 +- go/upgrade/migrations/dummy.go | 4 +- go/upgrade/migrations/empty.go | 4 +- go/upgrade/migrations/migrations.go | 4 +- go/upgrade/upgrade.go | 17 +-- go/worker/beacon/worker.go | 2 - go/worker/client/committee/node.go | 4 +- go/worker/client/service.go | 2 +- go/worker/client/stateless.go | 6 +- go/worker/common/committee/group.go | 4 +- go/worker/common/committee/keymanager.go | 2 +- go/worker/common/committee/node.go | 8 +- go/worker/common/committee/p2p.go | 4 +- go/worker/common/committee/runtime_host.go | 6 +- go/worker/common/p2p/txsync/server.go | 6 +- go/worker/compute/executor/committee/node.go | 4 +- go/worker/compute/executor/committee/p2p.go | 6 +- .../compute/executor/committee/status.go | 4 +- go/worker/compute/executor/tests/tester.go | 2 +- go/worker/keymanager/handler.go | 6 +- go/worker/keymanager/init.go | 2 - go/worker/keymanager/p2p/client.go | 3 +- go/worker/keymanager/status.go | 4 +- go/worker/keymanager/worker.go | 2 +- go/worker/registration/worker.go | 5 +- .../storage/committee/checkpoint_sync.go | 2 +- go/worker/storage/committee/node.go | 16 +-- go/worker/storage/init.go | 2 - go/worker/storage/service_internal.go | 4 +- go/worker/storage/worker.go | 8 +- 272 files changed, 888 insertions(+), 976 deletions(-) diff --git a/go/beacon/api/grpc.go b/go/beacon/api/grpc.go index 6d10c99a809..b194ca89c28 100644 --- a/go/beacon/api/grpc.go +++ b/go/beacon/api/grpc.go @@ -84,8 +84,8 @@ var ( func handlerGetBaseEpoch( srv interface{}, - ctx context.Context, //nolint: revive - dec func(interface{}) error, + ctx context.Context, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -126,7 +126,7 @@ func handlerGetEpoch( func handlerGetFutureEpoch( srv interface{}, - ctx context.Context, //nolint: revive + ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { @@ -370,7 +370,7 @@ func (c *beaconClient) WatchEpochs(ctx context.Context) (<-chan EpochTime, pubsu return ch, sub, nil } -func (c *beaconClient) WatchLatestEpoch(ctx context.Context) (<-chan EpochTime, pubsub.ClosableSubscription, error) { +func (c *beaconClient) WatchLatestEpoch(context.Context) (<-chan EpochTime, pubsub.ClosableSubscription, error) { // The only thing that uses this is the registration worker, and it // is not over gRPC. return nil, nil, fmt.Errorf("beacon: gRPC method not implemented") diff --git a/go/common/crypto/mathrand/rand.go b/go/common/crypto/mathrand/rand.go index e0fc0a34302..5b1d2e05799 100644 --- a/go/common/crypto/mathrand/rand.go +++ b/go/common/crypto/mathrand/rand.go @@ -20,7 +20,7 @@ type rngAdapter struct { off int } -func (a *rngAdapter) Seed(seed int64) { +func (a *rngAdapter) Seed(int64) { panic("mathrand: Seed is not supported") } diff --git a/go/common/crypto/signature/signature.go b/go/common/crypto/signature/signature.go index e05e61ec428..b483e8d2146 100644 --- a/go/common/crypto/signature/signature.go +++ b/go/common/crypto/signature/signature.go @@ -463,7 +463,7 @@ type PrettySigned struct { // PrettyPrint writes a pretty-printed representation of the type // to the given writer. -func (p PrettySigned) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (p PrettySigned) PrettyPrint(_ context.Context, prefix string, w io.Writer) { data, err := json.MarshalIndent(p, prefix, " ") if err != nil { fmt.Fprintf(w, "%s\n", prefix, err) @@ -579,7 +579,7 @@ type PrettyMultiSigned struct { // PrettyPrint writes a pretty-printed representation of the type to the // given writer. -func (p PrettyMultiSigned) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (p PrettyMultiSigned) PrettyPrint(_ context.Context, prefix string, w io.Writer) { data, err := json.MarshalIndent(p, prefix, " ") if err != nil { fmt.Fprintf(w, "%s\n", prefix, err) diff --git a/go/common/crypto/signature/signers/memory/memory_signer.go b/go/common/crypto/signature/signers/memory/memory_signer.go index 842c2487505..d8fd69f3740 100644 --- a/go/common/crypto/signature/signers/memory/memory_signer.go +++ b/go/common/crypto/signature/signers/memory/memory_signer.go @@ -40,7 +40,7 @@ func NewFactory() signature.SignerFactory { } // EnsureRole is a no-op for testing expedience. -func (fac *Factory) EnsureRole(role signature.SignerRole) error { +func (fac *Factory) EnsureRole(signature.SignerRole) error { return nil } @@ -67,7 +67,7 @@ func (fac *Factory) Generate(role signature.SignerRole, rng io.Reader) (signatur } // Load will return an error, as the factory does not support persistence. -func (fac *Factory) Load(role signature.SignerRole) (signature.Signer, error) { +func (fac *Factory) Load(signature.SignerRole) (signature.Signer, error) { return nil, signature.ErrNotExist } diff --git a/go/common/crypto/signature/signers/plugin/plugin.go b/go/common/crypto/signature/signers/plugin/plugin.go index 3d46d18b2fc..bf43096104e 100644 --- a/go/common/crypto/signature/signers/plugin/plugin.go +++ b/go/common/crypto/signature/signers/plugin/plugin.go @@ -175,7 +175,7 @@ func (wf *wrapperFactory) EnsureRole(role signature.SignerRole) error { return nil } -func (wf *wrapperFactory) Generate(role signature.SignerRole, _rng io.Reader) (signature.Signer, error) { +func (wf *wrapperFactory) Generate(role signature.SignerRole, _ io.Reader) (signature.Signer, error) { if role == signature.SignerVRF { return nil, signature.ErrVRFNotSupported } @@ -271,13 +271,13 @@ type signerPlugin struct { impl Signer } -func (p *signerPlugin) Server(_broker *plugin.MuxBroker) (interface{}, error) { +func (p *signerPlugin) Server(*plugin.MuxBroker) (interface{}, error) { return &rpcServer{ impl: p.impl, }, nil } -func (signerPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) { +func (signerPlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error) { return &rpcClient{ client: c, }, nil diff --git a/go/common/crypto/signature/signers/plugin/rpc.go b/go/common/crypto/signature/signers/plugin/rpc.go index 44a815f1243..5925f6a51e3 100644 --- a/go/common/crypto/signature/signers/plugin/rpc.go +++ b/go/common/crypto/signature/signers/plugin/rpc.go @@ -31,11 +31,11 @@ type RPCContextSignArgs struct { Message []byte } -func (m *rpcServer) Initialize(args *RPCInitArgs, resp *interface{}) error { +func (m *rpcServer) Initialize(args *RPCInitArgs, _ *interface{}) error { return m.impl.Initialize(args.Config, args.Roles...) } -func (m *rpcServer) Load(args *RPCLoadArgs, resp *interface{}) error { +func (m *rpcServer) Load(args *RPCLoadArgs, _ *interface{}) error { return m.impl.Load(args.Role, args.MustGenerate) } diff --git a/go/common/crypto/signature/signers/remote/grpc.go b/go/common/crypto/signature/signers/remote/grpc.go index 27e561cdb8f..bbf41bcf154 100644 --- a/go/common/crypto/signature/signers/remote/grpc.go +++ b/go/common/crypto/signature/signers/remote/grpc.go @@ -67,16 +67,16 @@ type ProveRequest struct { // Backend is the remote signer backend interface. type Backend interface { - PublicKeys(context.Context) ([]PublicKey, error) - Sign(context.Context, *SignRequest) ([]byte, error) - Prove(context.Context, *ProveRequest) ([]byte, error) + PublicKeys() ([]PublicKey, error) + Sign(*SignRequest) ([]byte, error) + Prove(*ProveRequest) ([]byte, error) } type wrapper struct { signers map[signature.SignerRole]signature.Signer } -func (w *wrapper) PublicKeys(ctx context.Context) ([]PublicKey, error) { +func (w *wrapper) PublicKeys() ([]PublicKey, error) { var resp []PublicKey for _, v := range signature.SignerRoles { // Return in consistent order. if signer := w.signers[v]; signer != nil { @@ -89,7 +89,7 @@ func (w *wrapper) PublicKeys(ctx context.Context) ([]PublicKey, error) { return resp, nil } -func (w *wrapper) Sign(ctx context.Context, req *SignRequest) ([]byte, error) { +func (w *wrapper) Sign(req *SignRequest) ([]byte, error) { signer, ok := w.signers[req.Role] if !ok { return nil, signature.ErrNotExist @@ -97,7 +97,7 @@ func (w *wrapper) Sign(ctx context.Context, req *SignRequest) ([]byte, error) { return signer.ContextSign(signature.Context(req.Context), req.Message) } -func (w *wrapper) Prove(ctx context.Context, req *ProveRequest) ([]byte, error) { +func (w *wrapper) Prove(req *ProveRequest) ([]byte, error) { signer, ok := w.signers[req.Role] if !ok { return nil, signature.ErrNotExist @@ -115,18 +115,18 @@ func (w *wrapper) Prove(ctx context.Context, req *ProveRequest) ([]byte, error) func handlerPublicKeys( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { - return srv.(Backend).PublicKeys(ctx) + return srv.(Backend).PublicKeys() } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: methodPublicKeys.FullName(), } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(Backend).PublicKeys(ctx) + return srv.(Backend).PublicKeys() } return interceptor(ctx, nil, info, handler) } @@ -142,14 +142,14 @@ func handlerSign( return nil, err } if interceptor == nil { - return srv.(Backend).Sign(ctx, &req) + return srv.(Backend).Sign(&req) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: methodSign.FullName(), } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(Backend).Sign(ctx, req.(*SignRequest)) + return srv.(Backend).Sign(req.(*SignRequest)) } return interceptor(ctx, &req, info, handler) } @@ -165,14 +165,14 @@ func handlerProve( return nil, err } if interceptor == nil { - return srv.(Backend).Prove(ctx, &req) + return srv.(Backend).Prove(&req) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: methodProve.FullName(), } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(Backend).Prove(ctx, req.(*ProveRequest)) + return srv.(Backend).Prove(req.(*ProveRequest)) } return interceptor(ctx, &req, info, handler) } @@ -212,7 +212,7 @@ func (rf *remoteFactory) EnsureRole(role signature.SignerRole) error { return nil } -func (rf *remoteFactory) Generate(role signature.SignerRole, rng io.Reader) (signature.Signer, error) { +func (rf *remoteFactory) Generate(signature.SignerRole, io.Reader) (signature.Signer, error) { return nil, fmt.Errorf("signature/signer/remote: key re-generation prohibited") } @@ -280,7 +280,7 @@ func (fc *FactoryConfig) IsLocal() bool { } // NewFactory creates a new factory with the specified roles. -func NewFactory(config interface{}, roles ...signature.SignerRole) (signature.SignerFactory, error) { +func NewFactory(config interface{}) (signature.SignerFactory, error) { cfg, ok := config.(*FactoryConfig) if !ok { return nil, fmt.Errorf("signature/signer/remote: invalid remote signer configuration provided") diff --git a/go/common/grpc/auth/auth.go b/go/common/grpc/auth/auth.go index 32fc207acb0..394532be584 100644 --- a/go/common/grpc/auth/auth.go +++ b/go/common/grpc/auth/auth.go @@ -9,10 +9,10 @@ import ( // AuthenticationFunction defines the gRPC server default authentication function. This // can be overridden per service by implementing AuthFunc on the gRPC service. -type AuthenticationFunction func(ctx context.Context, fullMethodName string, req interface{}) error +type AuthenticationFunction func(ctx context.Context, req interface{}) error // NoAuth is a function that does no authentication. -func NoAuth(ctx context.Context, fullMethodName string, req interface{}) error { +func NoAuth(context.Context, interface{}) error { return nil } @@ -24,7 +24,7 @@ type ServerAuth interface { // // Make sure to error with `codes.Unauthenticated` and // `codes.PermissionDenied` appropriately. - AuthFunc(ctx context.Context, fullMethodName string, req interface{}) error + AuthFunc(ctx context.Context, req interface{}) error } // UnaryServerInterceptor returns an authentication unary server interceptor. @@ -38,13 +38,13 @@ func UnaryServerInterceptor(authFunc AuthenticationFunction) grpc.UnaryServerInt if !ok { // Server doesn't implement Authentication. // Use default Auth. - if err := authFunc(ctx, info.FullMethod, req); err != nil { + if err := authFunc(ctx, req); err != nil { return nil, err } return handler(ctx, req) } - if err := overrideSrv.AuthFunc(ctx, info.FullMethod, req); err != nil { + if err := overrideSrv.AuthFunc(ctx, req); err != nil { return nil, err } @@ -89,7 +89,7 @@ type authServerStream struct { grpc.ServerStream fullMethod string - authFunc func(ctx context.Context, fullMethodName string, req interface{}) error + authFunc func(ctx context.Context, req interface{}) error } func (a authServerStream) RecvMsg(m interface{}) error { @@ -97,5 +97,5 @@ func (a authServerStream) RecvMsg(m interface{}) error { return err } // Authenticate request. - return a.authFunc(a.Context(), a.fullMethod, m) + return a.authFunc(a.Context(), m) } diff --git a/go/common/grpc/auth/auth_test.go b/go/common/grpc/auth/auth_test.go index 51f212ab737..5eb3cae4452 100644 --- a/go/common/grpc/auth/auth_test.go +++ b/go/common/grpc/auth/auth_test.go @@ -23,7 +23,7 @@ const ( ) // rejectAll is an auth function that rejects all requests. -func rejectAll(ctx context.Context, fullMethodName string, req interface{}) error { +func rejectAll(context.Context, interface{}) error { return status.Errorf(codes.PermissionDenied, "rejecting all") } @@ -114,7 +114,7 @@ func testAuth(t *testing.T, testCase *testCase) { } // Test WatchPings. - ch, sub, err := client.WatchPings(ctx, pingQuery) + ch, sub, err := client.WatchPings(ctx) require.NoError(err, "Calling WatchPings shouldn't fail") defer sub.Close() diff --git a/go/common/grpc/auth/auth_tls.go b/go/common/grpc/auth/auth_tls.go index 92ac4aa4ef9..54f962bee2d 100644 --- a/go/common/grpc/auth/auth_tls.go +++ b/go/common/grpc/auth/auth_tls.go @@ -24,7 +24,7 @@ type PeerCertAuthenticator struct { } // AuthFunc is an AuthenticationFunction backed by the PeerCertAuthenticator. -func (auth *PeerCertAuthenticator) AuthFunc(ctx context.Context, fullMethodName string, req interface{}) error { +func (auth *PeerCertAuthenticator) AuthFunc(ctx context.Context, _ interface{}) error { peer, ok := peer.FromContext(ctx) if !ok { return status.Errorf(codes.PermissionDenied, "grpc: failed to obtain connection peer from context") diff --git a/go/common/grpc/auth/auth_tls_pubkeys.go b/go/common/grpc/auth/auth_tls_pubkeys.go index 6d067673a20..5744932ed2e 100644 --- a/go/common/grpc/auth/auth_tls_pubkeys.go +++ b/go/common/grpc/auth/auth_tls_pubkeys.go @@ -25,7 +25,7 @@ type PeerPubkeyAuthenticator struct { } // AuthFunc is an AuthenticationFunction backed by the PeerPubkeyAuthenticator. -func (auth *PeerPubkeyAuthenticator) AuthFunc(ctx context.Context, fullMethodName string, req interface{}) error { +func (auth *PeerPubkeyAuthenticator) AuthFunc(ctx context.Context, _ interface{}) error { peer, ok := peer.FromContext(ctx) if !ok { return status.Errorf(codes.PermissionDenied, "grpc: failed to obtain connection peer from context") diff --git a/go/common/grpc/errors.go b/go/common/grpc/errors.go index 6aa8e13b587..39fef8e8544 100644 --- a/go/common/grpc/errors.go +++ b/go/common/grpc/errors.go @@ -98,7 +98,7 @@ func errorFromGrpc(err error) error { func serverUnaryErrorMapper( ctx context.Context, req interface{}, - info *grpc.UnaryServerInfo, + _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (interface{}, error) { rsp, err := handler(ctx, req) @@ -108,7 +108,7 @@ func serverUnaryErrorMapper( func serverStreamErrorMapper( srv interface{}, ss grpc.ServerStream, - info *grpc.StreamServerInfo, + _ *grpc.StreamServerInfo, handler grpc.StreamHandler, ) error { err := handler(srv, ss) diff --git a/go/common/grpc/errors_test.go b/go/common/grpc/errors_test.go index 4a0e205a153..bf0777a13e6 100644 --- a/go/common/grpc/errors_test.go +++ b/go/common/grpc/errors_test.go @@ -29,15 +29,15 @@ type ErrorTestService interface { type errorTestServer struct{} -func (s *errorTestServer) ErrorTest(ctx context.Context, req *ErrorTestRequest) (*ErrorTestResponse, error) { +func (s *errorTestServer) ErrorTest(context.Context, *ErrorTestRequest) (*ErrorTestResponse, error) { return &ErrorTestResponse{}, errTest } -func (s *errorTestServer) ErrorTestWithContext(ctx context.Context, req *ErrorTestRequest) (*ErrorTestResponse, error) { +func (s *errorTestServer) ErrorTestWithContext(context.Context, *ErrorTestRequest) (*ErrorTestResponse, error) { return &ErrorTestResponse{}, errors.WithContext(errTest, "my test context") } -func (s *errorTestServer) ErrorStatusTest(ctx context.Context, req *ErrorTestRequest) (*ErrorTestResponse, error) { +func (s *errorTestServer) ErrorStatusTest(context.Context, *ErrorTestRequest) (*ErrorTestResponse, error) { return nil, io.ErrUnexpectedEOF } diff --git a/go/common/grpc/service.go b/go/common/grpc/service.go index 6fcc77b98ed..0d660f25321 100644 --- a/go/common/grpc/service.go +++ b/go/common/grpc/service.go @@ -24,10 +24,10 @@ type NamespaceExtractorFunc func(ctx context.Context, req interface{}) (common.N // AccessControlFunc is a function that decides whether access control policy lookup is required for // a specific request. In case an error is returned the request is aborted. -type AccessControlFunc func(ctx context.Context, req interface{}) (bool, error) +type AccessControlFunc func(req interface{}) (bool, error) // AccessControlAlways is a utility AccessControlFunc that enables access control for every request. -func AccessControlAlways(ctx context.Context, req interface{}) (bool, error) { +func AccessControlAlways(interface{}) (bool, error) { return true, nil } @@ -112,11 +112,11 @@ func (m *MethodDesc) FullName() string { } // IsAccessControlled retruns if method is access controlled. -func (m *MethodDesc) IsAccessControlled(ctx context.Context, req interface{}) (bool, error) { +func (m *MethodDesc) IsAccessControlled(req interface{}) (bool, error) { if m.accessControl == nil { return false, nil } - return m.accessControl(ctx, req) + return m.accessControl(req) } // UnmarshalRawMessage unmarshals `cbor.RawMessage` request. diff --git a/go/common/grpc/testing/ping.go b/go/common/grpc/testing/ping.go index 083a1689dda..454d0c10bf9 100644 --- a/go/common/grpc/testing/ping.go +++ b/go/common/grpc/testing/ping.go @@ -38,9 +38,7 @@ var ( return common.Namespace{}, errInvalidRequestType } return r.Namespace, nil - }).WithAccessControl(func(ctx context.Context, req interface{}) (bool, error) { - return true, nil - }) + }).WithAccessControl(cmnGrpc.AccessControlAlways) // MethodWatchPings is the WatchPings method. MethodWatchPings = serviceName.NewMethod("WatchPings", PingQuery{}). @@ -50,9 +48,7 @@ var ( return common.Namespace{}, errInvalidRequestType } return r.Namespace, nil - }).WithAccessControl(func(ctx context.Context, req interface{}) (bool, error) { - return true, nil - }) + }).WithAccessControl(cmnGrpc.AccessControlAlways) ) // CreateCertificate creates gRPC TLS certificate for testing. @@ -88,18 +84,18 @@ type PingServer interface { } type pingServer struct { - authFunc func(ctx context.Context, fullMethodName string, req interface{}) error + authFunc func(ctx context.Context, req interface{}) error } -func (s *pingServer) AuthFunc(ctx context.Context, fullMethodName string, req interface{}) error { - return s.authFunc(ctx, fullMethodName, req) +func (s *pingServer) AuthFunc(ctx context.Context, req interface{}) error { + return s.authFunc(ctx, req) } -func (s *pingServer) Ping(ctx context.Context, query *PingQuery) (*PingResponse, error) { +func (s *pingServer) Ping(context.Context, *PingQuery) (*PingResponse, error) { return &PingResponse{}, nil } -func (s *pingServer) WatchPings(ctx context.Context, query *PingQuery) (<-chan *PingResponse, pubsub.ClosableSubscription, error) { +func (s *pingServer) WatchPings(ctx context.Context, _ *PingQuery) (<-chan *PingResponse, pubsub.ClosableSubscription, error) { pingNotifier := pubsub.NewBroker(true) go func() { for { @@ -124,7 +120,7 @@ func RegisterService(server *grpc.Server, service PingServer) { } // NewPingServer retruns a new Ping server. -func NewPingServer(authFunc func(ctx context.Context, fullMethodName string, req interface{}) error) PingServer { +func NewPingServer(authFunc func(ctx context.Context, req interface{}) error) PingServer { ps := &pingServer{authFunc} return ps } @@ -137,7 +133,7 @@ func NewPingClient(conn *grpc.ClientConn) PingClient { // PingClient is a testing PingServer client. type PingClient interface { Ping(ctx context.Context, in *PingQuery, opts ...grpc.CallOption) (*PingResponse, error) - WatchPings(ctx context.Context, in *PingQuery, opts ...grpc.CallOption) (<-chan *PingResponse, pubsub.ClosableSubscription, error) + WatchPings(ctx context.Context) (<-chan *PingResponse, pubsub.ClosableSubscription, error) MissingMethod(ctx context.Context, in *PingQuery, opts ...grpc.CallOption) (*PingResponse, error) } @@ -154,7 +150,7 @@ func (c *pingClient) Ping(ctx context.Context, in *PingQuery, opts ...grpc.CallO return out, nil } -func (c *pingClient) WatchPings(ctx context.Context, in *PingQuery, opts ...grpc.CallOption) (<-chan *PingResponse, pubsub.ClosableSubscription, error) { +func (c *pingClient) WatchPings(ctx context.Context) (<-chan *PingResponse, pubsub.ClosableSubscription, error) { ctx, sub := pubsub.NewContextSubscription(ctx) stream, err := c.cc.NewStream(ctx, &ServiceDesc.Streams[0], MethodWatchPings.FullName()) diff --git a/go/common/grpc/wrapper_test.go b/go/common/grpc/wrapper_test.go index 10dc121b602..2a7bea37215 100644 --- a/go/common/grpc/wrapper_test.go +++ b/go/common/grpc/wrapper_test.go @@ -49,7 +49,7 @@ type multiPingServer struct { multiPingCount uint32 } -func (s *multiPingServer) Ping(ctx context.Context) (*MultiPingUnaryResponse, error) { +func (s *multiPingServer) Ping(context.Context) (*MultiPingUnaryResponse, error) { atomic.AddUint32(&s.pingCount, 1) return &MultiPingUnaryResponse{}, nil } diff --git a/go/common/version/version.go b/go/common/version/version.go index 6d3aa32ed82..80a69670efe 100644 --- a/go/common/version/version.go +++ b/go/common/version/version.go @@ -195,7 +195,7 @@ func (pv ProtocolVersions) String() string { // PrettyPrint writes a pretty-printed representation of ProtocolVersions to the // given writer. -func (pv ProtocolVersions) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (pv ProtocolVersions) PrettyPrint(_ context.Context, prefix string, w io.Writer) { fmt.Fprintf(w, "%sConsensus Protocol: %s\n", prefix, pv.ConsensusProtocol) fmt.Fprintf(w, "%sRuntime Host Protocol: %s\n", prefix, pv.RuntimeHostProtocol) fmt.Fprintf(w, "%sRuntime Committee Protocol: %s\n", prefix, pv.RuntimeCommitteeProtocol) diff --git a/go/consensus/api/grpc.go b/go/consensus/api/grpc.go index 3fad99bf4b5..a3b127ddf44 100644 --- a/go/consensus/api/grpc.go +++ b/go/consensus/api/grpc.go @@ -453,7 +453,7 @@ func handlerGetTransactionsWithProofs( func handlerGetUnconfirmedTransactions( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -541,7 +541,7 @@ func handlerStateSyncIterate( func handlerGetGenesisDocument( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -560,7 +560,7 @@ func handlerGetGenesisDocument( func handlerGetChainContext( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -579,7 +579,7 @@ func handlerGetChainContext( func handlerGetStatus( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -598,7 +598,7 @@ func handlerGetStatus( func handlerGetNextBlockState( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { diff --git a/go/consensus/api/light.go b/go/consensus/api/light.go index 8db86d86e91..e1a4498d7ba 100644 --- a/go/consensus/api/light.go +++ b/go/consensus/api/light.go @@ -17,7 +17,7 @@ type LightService interface { LightClient // GetStatus returns the current status overview. - GetStatus(ctx context.Context) (*LightClientStatus, error) + GetStatus() (*LightClientStatus, error) } // LightClient is a consensus light client interface. diff --git a/go/consensus/api/submission.go b/go/consensus/api/submission.go index ed8aedc3284..400aae3c4e8 100644 --- a/go/consensus/api/submission.go +++ b/go/consensus/api/submission.go @@ -42,13 +42,13 @@ func NewStaticPriceDiscovery(price uint64) (PriceDiscovery, error) { return pd, nil } -func (pd *staticPriceDiscovery) GasPrice(ctx context.Context) (*quantity.Quantity, error) { +func (pd *staticPriceDiscovery) GasPrice(context.Context) (*quantity.Quantity, error) { return pd.price.Clone(), nil } type noOpPriceDiscovery struct{} -func (pd *noOpPriceDiscovery) GasPrice(ctx context.Context) (*quantity.Quantity, error) { +func (pd *noOpPriceDiscovery) GasPrice(context.Context) (*quantity.Quantity, error) { return nil, transaction.ErrMethodNotSupported } @@ -301,16 +301,16 @@ func (m *NoOpSubmissionManager) PriceDiscovery() PriceDiscovery { } // EstimateGasAndSetFee implements SubmissionManager. -func (m *NoOpSubmissionManager) EstimateGasAndSetFee(ctx context.Context, signer signature.Signer, tx *transaction.Transaction) error { +func (m *NoOpSubmissionManager) EstimateGasAndSetFee(context.Context, signature.Signer, *transaction.Transaction) error { return transaction.ErrMethodNotSupported } // SignAndSubmitTx implements SubmissionManager. -func (m *NoOpSubmissionManager) SignAndSubmitTx(ctx context.Context, signer signature.Signer, tx *transaction.Transaction) error { +func (m *NoOpSubmissionManager) SignAndSubmitTx(context.Context, signature.Signer, *transaction.Transaction) error { return transaction.ErrMethodNotSupported } // SignAndSubmitTxWithProof implements SubmissionManager. -func (m *NoOpSubmissionManager) SignAndSubmitTxWithProof(ctx context.Context, signer signature.Signer, tx *transaction.Transaction) (*transaction.SignedTransaction, *transaction.Proof, error) { +func (m *NoOpSubmissionManager) SignAndSubmitTxWithProof(context.Context, signature.Signer, *transaction.Transaction) (*transaction.SignedTransaction, *transaction.Proof, error) { return nil, nil, transaction.ErrMethodNotSupported } diff --git a/go/consensus/cometbft/abci/messages_test.go b/go/consensus/cometbft/abci/messages_test.go index 27f91123be1..11d191ebccd 100644 --- a/go/consensus/cometbft/abci/messages_test.go +++ b/go/consensus/cometbft/abci/messages_test.go @@ -32,7 +32,7 @@ type testSubscriber struct { } // Implements api.MessageSubscriber. -func (s *testSubscriber) ExecuteMessage(ctx *api.Context, kind, msg interface{}) (interface{}, error) { +func (s *testSubscriber) ExecuteMessage(_ *api.Context, _, msg interface{}) (interface{}, error) { switch m := msg.(type) { case *testMessage: s.msgs = append(s.msgs, m.foo) diff --git a/go/consensus/cometbft/abci/mux.go b/go/consensus/cometbft/abci/mux.go index 6b1cad11b31..dacb143b976 100644 --- a/go/consensus/cometbft/abci/mux.go +++ b/go/consensus/cometbft/abci/mux.go @@ -264,7 +264,7 @@ func (mux *abciMux) registerHaltHook(hook consensus.HaltHook) { mux.haltHooks = append(mux.haltHooks, hook) } -func (mux *abciMux) Info(req types.RequestInfo) types.ResponseInfo { +func (mux *abciMux) Info(types.RequestInfo) types.ResponseInfo { return types.ResponseInfo{ AppVersion: version.CometBFTAppVersion, LastBlockHeight: mux.state.BlockHeight(), diff --git a/go/consensus/cometbft/abci/prune.go b/go/consensus/cometbft/abci/prune.go index 4e7005bb2fa..307b9a4146b 100644 --- a/go/consensus/cometbft/abci/prune.go +++ b/go/consensus/cometbft/abci/prune.go @@ -95,12 +95,12 @@ type statePrunerInitializer interface { type nonePruner struct{} -func (p *nonePruner) Prune(ctx context.Context, latestVersion uint64) error { +func (p *nonePruner) Prune(context.Context, uint64) error { // Nothing to prune. return nil } -func (p *nonePruner) RegisterHandler(handler api.StatePruneHandler) { +func (p *nonePruner) RegisterHandler(api.StatePruneHandler) { } func (p *nonePruner) GetLastRetainedVersion() uint64 { diff --git a/go/consensus/cometbft/abci/prune_test.go b/go/consensus/cometbft/abci/prune_test.go index ee9e9e70b9e..8d8389dc964 100644 --- a/go/consensus/cometbft/abci/prune_test.go +++ b/go/consensus/cometbft/abci/prune_test.go @@ -41,7 +41,7 @@ func TestPruneKeepN(t *testing.T) { var rootHash hash.Hash _, rootHash, err = tree.Commit(ctx, common.Namespace{}, i) require.NoError(err, "Commit") - err = ndb.Finalize(ctx, []mkvsNode.Root{{Namespace: common.Namespace{}, Version: i, Type: mkvsNode.RootTypeState, Hash: rootHash}}) + err = ndb.Finalize([]mkvsNode.Root{{Namespace: common.Namespace{}, Version: i, Type: mkvsNode.RootTypeState, Hash: rootHash}}) require.NoError(err, "Finalize") } diff --git a/go/consensus/cometbft/abci/snapshots.go b/go/consensus/cometbft/abci/snapshots.go index 6a7cb38ea6c..449460e5cd0 100644 --- a/go/consensus/cometbft/abci/snapshots.go +++ b/go/consensus/cometbft/abci/snapshots.go @@ -14,7 +14,7 @@ import ( "github.com/oasisprotocol/oasis-core/go/storage/mkvs/checkpoint" ) -func (mux *abciMux) ListSnapshots(req types.RequestListSnapshots) types.ResponseListSnapshots { +func (mux *abciMux) ListSnapshots(types.RequestListSnapshots) types.ResponseListSnapshots { // Get a list of all current checkpoints. cps, err := mux.state.storage.Checkpointer().GetCheckpoints(mux.state.ctx, &checkpoint.GetCheckpointsRequest{ Version: 1, @@ -234,7 +234,7 @@ func (mux *abciMux) ApplySnapshotChunk(req types.RequestApplySnapshotChunk) type // Check if we are done with the restoration. In this case, finalize the root. if done { - err = mux.state.storage.NodeDB().Finalize(mux.state.ctx, []storageApi.Root{cp.Root}) + err = mux.state.storage.NodeDB().Finalize([]storageApi.Root{cp.Root}) if err != nil { mux.logger.Error("failed to finalize restored root", "err", err, diff --git a/go/consensus/cometbft/abci/state.go b/go/consensus/cometbft/abci/state.go index f6cf4a3db51..e3c29ce5e6c 100644 --- a/go/consensus/cometbft/abci/state.go +++ b/go/consensus/cometbft/abci/state.go @@ -438,7 +438,7 @@ func (s *applicationState) doCommit() (uint64, error) { Type: storage.RootTypeState, Hash: stateRootHash, } - if err = s.storage.NodeDB().Finalize(s.ctx, []storage.Root{newStateRoot}); err != nil { + if err = s.storage.NodeDB().Finalize([]storage.Root{newStateRoot}); err != nil { return 0, fmt.Errorf("failed to finalize height %d: %w", newStateRoot.Version, err) } @@ -620,7 +620,7 @@ func (s *applicationState) pruneWorker() { } // InitStateStorage initializes the internal ABCI state storage. -func InitStateStorage(ctx context.Context, cfg *ApplicationConfig) (storage.LocalBackend, storage.NodeDB, *storage.Root, error) { +func InitStateStorage(cfg *ApplicationConfig) (storage.LocalBackend, storage.NodeDB, *storage.Root, error) { baseDir := filepath.Join(cfg.DataDir, appStateDir) switch cfg.ReadOnlyStorage { case true: @@ -670,7 +670,7 @@ func InitStateStorage(ctx context.Context, cfg *ApplicationConfig) (storage.Loca // Figure out the latest version/hash if any, and use that as the block height/hash. latestVersion, _ := ndb.GetLatestVersion() - roots, err := ndb.GetRootsForVersion(ctx, latestVersion) + roots, err := ndb.GetRootsForVersion(latestVersion) if err != nil { return nil, nil, nil, err } @@ -704,7 +704,7 @@ func newApplicationState(ctx context.Context, upgrader upgrade.Backend, cfg *App } // Initialize the state storage. - ldb, ndb, stateRoot, err := InitStateStorage(ctx, cfg) + ldb, ndb, stateRoot, err := InitStateStorage(cfg) if err != nil { return nil, err } diff --git a/go/consensus/cometbft/abci/transaction.go b/go/consensus/cometbft/abci/transaction.go index e8b1257c23e..32d03e701a1 100644 --- a/go/consensus/cometbft/abci/transaction.go +++ b/go/consensus/cometbft/abci/transaction.go @@ -130,7 +130,7 @@ func (mux *abciMux) executeTx(ctx *api.Context, rawTx []byte) error { // If we are in CheckTx mode and there is a pending upgrade in this block, make sure to reject // any transactions before processing as they may potentially query incompatible state. if upgrader := mux.state.Upgrader(); upgrader != nil && ctx.IsCheckOnly() { - hasUpgrade, err := upgrader.HasPendingUpgradeAt(ctx, ctx.BlockHeight()+1) + hasUpgrade, err := upgrader.HasPendingUpgradeAt(ctx.BlockHeight() + 1) if err != nil { return fmt.Errorf("failed to check for pending upgrades: %w", err) } diff --git a/go/consensus/cometbft/api/api.go b/go/consensus/cometbft/api/api.go index 8989ec32410..2270f802365 100644 --- a/go/consensus/cometbft/api/api.go +++ b/go/consensus/cometbft/api/api.go @@ -356,17 +356,17 @@ type ServiceClient interface { type BaseServiceClient struct{} // DeliverBlock implements ServiceClient. -func (bsc *BaseServiceClient) DeliverBlock(ctx context.Context, height int64) error { +func (bsc *BaseServiceClient) DeliverBlock(context.Context, int64) error { return nil } // DeliverEvent implements ServiceClient. -func (bsc *BaseServiceClient) DeliverEvent(ctx context.Context, height int64, tx cmttypes.Tx, ev *types.Event) error { +func (bsc *BaseServiceClient) DeliverEvent(context.Context, int64, cmttypes.Tx, *types.Event) error { return nil } // DeliverCommand implements ServiceClient. -func (bsc *BaseServiceClient) DeliverCommand(ctx context.Context, height int64, cmd interface{}) error { +func (bsc *BaseServiceClient) DeliverCommand(context.Context, int64, interface{}) error { return nil } diff --git a/go/consensus/cometbft/api/gas.go b/go/consensus/cometbft/api/gas.go index e4feee987df..9da1ebe2358 100644 --- a/go/consensus/cometbft/api/gas.go +++ b/go/consensus/cometbft/api/gas.go @@ -78,7 +78,7 @@ func NewGasAccountant(maxUsedGas transaction.Gas) GasAccountant { type nopGasAccountant struct{} -func (ga *nopGasAccountant) UseGas(multiplier int, op transaction.Op, costs transaction.Costs) error { +func (ga *nopGasAccountant) UseGas(multiplier int, _ transaction.Op, _ transaction.Costs) error { if multiplier < 0 { panic("gas: multiplier must be >= 0") } diff --git a/go/consensus/cometbft/api/state.go b/go/consensus/cometbft/api/state.go index a07be123fa0..f044d790f51 100644 --- a/go/consensus/cometbft/api/state.go +++ b/go/consensus/cometbft/api/state.go @@ -155,7 +155,7 @@ func (ms *mockApplicationState) GetBaseEpoch() (beacon.EpochTime, error) { return ms.cfg.BaseEpoch, nil } -func (ms *mockApplicationState) GetEpoch(ctx context.Context, blockHeight int64) (beacon.EpochTime, error) { +func (ms *mockApplicationState) GetEpoch(context.Context, int64) (beacon.EpochTime, error) { return ms.cfg.CurrentEpoch, nil } @@ -163,11 +163,11 @@ func (ms *mockApplicationState) LastRetainedVersion() (int64, error) { return ms.cfg.Genesis.Height, nil } -func (ms *mockApplicationState) GetCurrentEpoch(ctx context.Context) (beacon.EpochTime, error) { +func (ms *mockApplicationState) GetCurrentEpoch(context.Context) (beacon.EpochTime, error) { return ms.cfg.CurrentEpoch, nil } -func (ms *mockApplicationState) EpochChanged(ctx *Context) (bool, beacon.EpochTime) { +func (ms *mockApplicationState) EpochChanged(*Context) (bool, beacon.EpochTime) { return ms.cfg.EpochChanged, ms.cfg.CurrentEpoch } @@ -299,7 +299,7 @@ func NewImmutableState(ctx context.Context, state ApplicationQueryState, version } ndb := state.Storage().NodeDB() - roots, err := ndb.GetRootsForVersion(ctx, uint64(version)) + roots, err := ndb.GetRootsForVersion(uint64(version)) if err != nil { return nil, err } diff --git a/go/consensus/cometbft/apps/beacon/backend_insecure.go b/go/consensus/cometbft/apps/beacon/backend_insecure.go index 4074beb178f..5547470e929 100644 --- a/go/consensus/cometbft/apps/beacon/backend_insecure.go +++ b/go/consensus/cometbft/apps/beacon/backend_insecure.go @@ -90,7 +90,7 @@ func (impl *backendInsecure) OnBeginBlock( impl.app.doEmitEpochEvent(ctx, future.Epoch) // Generate the beacon - return impl.onEpochChangeBeacon(ctx, state, params, future.Epoch) + return impl.onEpochChangeBeacon(ctx, future.Epoch) } func (impl *backendInsecure) scheduleEpochTransitionBlock( @@ -106,8 +106,6 @@ func (impl *backendInsecure) scheduleEpochTransitionBlock( func (impl *backendInsecure) onEpochChangeBeacon( ctx *api.Context, - state *beaconState.MutableState, - params *beacon.ConsensusParameters, epoch beacon.EpochTime, ) error { var entropy []byte diff --git a/go/consensus/cometbft/apps/beacon/backend_vrf.go b/go/consensus/cometbft/apps/beacon/backend_vrf.go index 5175407e425..6bceb099c23 100644 --- a/go/consensus/cometbft/apps/beacon/backend_vrf.go +++ b/go/consensus/cometbft/apps/beacon/backend_vrf.go @@ -389,7 +389,7 @@ func (impl *backendVRF) doSetEpochTx( func (impl *backendVRF) updateNodeStatus( ctx *api.Context, - state *beaconState.MutableState, + _ *beaconState.MutableState, nextEpoch beacon.EpochTime, ) error { registryState := registryState.NewMutableState(ctx.State()) diff --git a/go/consensus/cometbft/apps/beacon/beacon.go b/go/consensus/cometbft/apps/beacon/beacon.go index 686bb302a59..b1c2bb6e447 100644 --- a/go/consensus/cometbft/apps/beacon/beacon.go +++ b/go/consensus/cometbft/apps/beacon/beacon.go @@ -47,7 +47,7 @@ func (app *beaconApplication) Dependencies() []string { return nil } -func (app *beaconApplication) OnRegister(state api.ApplicationState, md api.MessageDispatcher) { +func (app *beaconApplication) OnRegister(state api.ApplicationState, _ api.MessageDispatcher) { app.state = state } @@ -69,7 +69,7 @@ func (app *beaconApplication) BeginBlock(ctx *api.Context) error { return app.backend.OnBeginBlock(ctx, state, params) } -func (app *beaconApplication) ExecuteMessage(ctx *api.Context, kind, msg interface{}) (interface{}, error) { +func (app *beaconApplication) ExecuteMessage(*api.Context, interface{}, interface{}) (interface{}, error) { return nil, fmt.Errorf("beacon: unexpected message") } @@ -86,7 +86,7 @@ func (app *beaconApplication) ExecuteTx(ctx *api.Context, tx *transaction.Transa return app.backend.ExecuteTx(ctx, state, params, tx) } -func (app *beaconApplication) EndBlock(ctx *api.Context) (types.ResponseEndBlock, error) { +func (app *beaconApplication) EndBlock(*api.Context) (types.ResponseEndBlock, error) { return types.ResponseEndBlock{}, nil } diff --git a/go/consensus/cometbft/apps/beacon/genesis.go b/go/consensus/cometbft/apps/beacon/genesis.go index a629ee184f0..b690a5bed30 100644 --- a/go/consensus/cometbft/apps/beacon/genesis.go +++ b/go/consensus/cometbft/apps/beacon/genesis.go @@ -12,7 +12,7 @@ import ( genesis "github.com/oasisprotocol/oasis-core/go/genesis/api" ) -func (app *beaconApplication) InitChain(ctx *api.Context, req types.RequestInitChain, doc *genesis.Document) error { +func (app *beaconApplication) InitChain(ctx *api.Context, _ types.RequestInitChain, doc *genesis.Document) error { params := &doc.Beacon.Parameters // Note: If we ever decide that we need a beacon for the 0th epoch diff --git a/go/consensus/cometbft/apps/governance/genesis.go b/go/consensus/cometbft/apps/governance/genesis.go index 4d85dd90779..6d6699c18b9 100644 --- a/go/consensus/cometbft/apps/governance/genesis.go +++ b/go/consensus/cometbft/apps/governance/genesis.go @@ -12,7 +12,7 @@ import ( governance "github.com/oasisprotocol/oasis-core/go/governance/api" ) -func (app *governanceApplication) InitChain(ctx *abciAPI.Context, request types.RequestInitChain, doc *genesis.Document) error { +func (app *governanceApplication) InitChain(ctx *abciAPI.Context, _ types.RequestInitChain, doc *genesis.Document) error { st := doc.Governance epoch, err := app.state.GetCurrentEpoch(ctx) diff --git a/go/consensus/cometbft/apps/governance/governance.go b/go/consensus/cometbft/apps/governance/governance.go index 5f6846e4fcc..c468a737681 100644 --- a/go/consensus/cometbft/apps/governance/governance.go +++ b/go/consensus/cometbft/apps/governance/governance.go @@ -164,7 +164,7 @@ func (app *governanceApplication) BeginBlock(ctx *api.Context) error { // Check if the upgrade descriptor is installed in the node and has been executed. if upgrader := ctx.AppState().Upgrader(); upgrader != nil { - switch pu, err := upgrader.GetUpgrade(ctx, ud); err { + switch pu, err := upgrader.GetUpgrade(ud); err { case nil: // Upgrade exists, make sure it is in the process of being applied. if !pu.HasStage(upgrade.UpgradeStageStartup) { @@ -240,7 +240,7 @@ func (app *governanceApplication) executeProposal(ctx *api.Context, state *gover // Locally apply the upgrade proposal. if upgrader := ctx.AppState().Upgrader(); upgrader != nil { - if err = upgrader.SubmitDescriptor(ctx, &proposal.Content.Upgrade.Descriptor); err != nil { + if err = upgrader.SubmitDescriptor(&proposal.Content.Upgrade.Descriptor); err != nil { ctx.Logger().Error("failed to locally apply the upgrade descriptor", "err", err, "descriptor", proposal.Content.Upgrade.Descriptor, @@ -266,7 +266,7 @@ func (app *governanceApplication) executeProposal(ctx *api.Context, state *gover // Locally cancel the upgrade proposal. if upgrader := ctx.AppState().Upgrader(); upgrader != nil { - if err = upgrader.CancelUpgrade(ctx, &upgradeProposal.Descriptor); err != nil { + if err = upgrader.CancelUpgrade(&upgradeProposal.Descriptor); err != nil { ctx.Logger().Error("failed to locally cancel the upgrade", "err", err, "descriptor", upgradeProposal.Descriptor, diff --git a/go/consensus/cometbft/apps/governance/messages.go b/go/consensus/cometbft/apps/governance/messages.go index aa696ebd782..b10b00b5e1a 100644 --- a/go/consensus/cometbft/apps/governance/messages.go +++ b/go/consensus/cometbft/apps/governance/messages.go @@ -22,7 +22,7 @@ func (app *governanceApplication) completeStateSync(ctx *api.Context) (interface // Apply all pending upgrades locally. if upgrader := ctx.AppState().Upgrader(); upgrader != nil { for _, pu := range pendingUpgrades { - switch err = upgrader.SubmitDescriptor(ctx, pu); err { + switch err = upgrader.SubmitDescriptor(pu); err { case nil, upgrade.ErrAlreadyPending: default: ctx.Logger().Error("failed to locally apply the upgrade descriptor", diff --git a/go/consensus/cometbft/apps/keymanager/genesis.go b/go/consensus/cometbft/apps/keymanager/genesis.go index 92883cc133b..9a33862fb72 100644 --- a/go/consensus/cometbft/apps/keymanager/genesis.go +++ b/go/consensus/cometbft/apps/keymanager/genesis.go @@ -16,7 +16,7 @@ import ( registry "github.com/oasisprotocol/oasis-core/go/registry/api" ) -func (app *keymanagerApplication) InitChain(ctx *tmapi.Context, request types.RequestInitChain, doc *genesis.Document) error { +func (app *keymanagerApplication) InitChain(ctx *tmapi.Context, _ types.RequestInitChain, doc *genesis.Document) error { st := doc.KeyManager b, _ := json.Marshal(st) diff --git a/go/consensus/cometbft/apps/keymanager/keymanager.go b/go/consensus/cometbft/apps/keymanager/keymanager.go index 24a5d5d89a5..30c4b1d74dc 100644 --- a/go/consensus/cometbft/apps/keymanager/keymanager.go +++ b/go/consensus/cometbft/apps/keymanager/keymanager.go @@ -52,7 +52,7 @@ func (app *keymanagerApplication) Dependencies() []string { return []string{registryapp.AppName} } -func (app *keymanagerApplication) OnRegister(state tmapi.ApplicationState, md tmapi.MessageDispatcher) { +func (app *keymanagerApplication) OnRegister(state tmapi.ApplicationState, _ tmapi.MessageDispatcher) { app.state = state } @@ -65,7 +65,7 @@ func (app *keymanagerApplication) BeginBlock(ctx *tmapi.Context) error { return nil } -func (app *keymanagerApplication) ExecuteMessage(ctx *tmapi.Context, kind, msg interface{}) (interface{}, error) { +func (app *keymanagerApplication) ExecuteMessage(*tmapi.Context, interface{}, interface{}) (interface{}, error) { return nil, fmt.Errorf("keymanager: unexpected message") } @@ -98,7 +98,7 @@ func (app *keymanagerApplication) ExecuteTx(ctx *tmapi.Context, tx *transaction. } } -func (app *keymanagerApplication) EndBlock(ctx *tmapi.Context) (types.ResponseEndBlock, error) { +func (app *keymanagerApplication) EndBlock(*tmapi.Context) (types.ResponseEndBlock, error) { return types.ResponseEndBlock{}, nil } diff --git a/go/consensus/cometbft/apps/registry/genesis.go b/go/consensus/cometbft/apps/registry/genesis.go index 6207225a610..2c9f4e05acc 100644 --- a/go/consensus/cometbft/apps/registry/genesis.go +++ b/go/consensus/cometbft/apps/registry/genesis.go @@ -16,7 +16,7 @@ import ( registry "github.com/oasisprotocol/oasis-core/go/registry/api" ) -func (app *registryApplication) InitChain(ctx *abciAPI.Context, request types.RequestInitChain, doc *genesis.Document) error { +func (app *registryApplication) InitChain(ctx *abciAPI.Context, _ types.RequestInitChain, doc *genesis.Document) error { st := doc.Registry b, _ := json.Marshal(st) diff --git a/go/consensus/cometbft/apps/registry/registry.go b/go/consensus/cometbft/apps/registry/registry.go index 3baa7bfb13c..c4d5ff875e0 100644 --- a/go/consensus/cometbft/apps/registry/registry.go +++ b/go/consensus/cometbft/apps/registry/registry.go @@ -143,7 +143,7 @@ func (app *registryApplication) ExecuteTx(ctx *api.Context, tx *transaction.Tran ) return registry.ErrInvalidArgument } - if err := app.proveFreshness(ctx, state, blob); err != nil { + if err := app.proveFreshness(ctx, state); err != nil { return err } return nil @@ -153,7 +153,7 @@ func (app *registryApplication) ExecuteTx(ctx *api.Context, tx *transaction.Tran } } -func (app *registryApplication) EndBlock(ctx *api.Context) (types.ResponseEndBlock, error) { +func (app *registryApplication) EndBlock(*api.Context) (types.ResponseEndBlock, error) { return types.ResponseEndBlock{}, nil } diff --git a/go/consensus/cometbft/apps/registry/transactions.go b/go/consensus/cometbft/apps/registry/transactions.go index a0999f86db0..644d363883d 100644 --- a/go/consensus/cometbft/apps/registry/transactions.go +++ b/go/consensus/cometbft/apps/registry/transactions.go @@ -806,7 +806,6 @@ func (app *registryApplication) registerRuntime( // nolint: gocyclo func (app *registryApplication) proveFreshness( ctx *api.Context, state *registryState.MutableState, - blob [32]byte, ) error { params, err := state.ConsensusParameters(ctx) if err != nil { diff --git a/go/consensus/cometbft/apps/registry/transactions_test.go b/go/consensus/cometbft/apps/registry/transactions_test.go index 4371487c248..db57a215809 100644 --- a/go/consensus/cometbft/apps/registry/transactions_test.go +++ b/go/consensus/cometbft/apps/registry/transactions_test.go @@ -701,14 +701,12 @@ func TestProofFreshness(t *testing.T) { requirePkg.NoError(t, err, "registry.SetConsensusParameters") } - var blob [32]byte - t.Run("happy path", func(t *testing.T) { require := requirePkg.New(t) setTEEFeaturesFn(&node.TEEFeatures{FreshnessProofs: true}) - err := app.proveFreshness(ctx, state, blob) + err := app.proveFreshness(ctx, state) require.NoError(err, "freshness proofs should succeed") }) @@ -718,14 +716,14 @@ func TestProofFreshness(t *testing.T) { // Freshness proofs disabled. setTEEFeaturesFn(&node.TEEFeatures{FreshnessProofs: false}) - err := app.proveFreshness(ctx, state, blob) + err := app.proveFreshness(ctx, state) require.Error(err, "freshness proofs should not be enabled") require.Equal(registry.ErrInvalidArgument, err) // No TEE features. setTEEFeaturesFn(nil) - err = app.proveFreshness(ctx, state, blob) + err = app.proveFreshness(ctx, state) require.Error(err, "freshness proofs should not be enabled") require.Equal(registry.ErrInvalidArgument, err) }) diff --git a/go/consensus/cometbft/apps/roothash/genesis.go b/go/consensus/cometbft/apps/roothash/genesis.go index 4fc3943d954..c0790fd5cc7 100644 --- a/go/consensus/cometbft/apps/roothash/genesis.go +++ b/go/consensus/cometbft/apps/roothash/genesis.go @@ -15,7 +15,7 @@ import ( roothashAPI "github.com/oasisprotocol/oasis-core/go/roothash/api" ) -func (app *rootHashApplication) InitChain(ctx *abciAPI.Context, request types.RequestInitChain, doc *genesisAPI.Document) error { +func (app *rootHashApplication) InitChain(ctx *abciAPI.Context, _ types.RequestInitChain, doc *genesisAPI.Document) error { st := doc.RootHash state := roothashState.NewMutableState(ctx.State()) diff --git a/go/consensus/cometbft/apps/roothash/roothash.go b/go/consensus/cometbft/apps/roothash/roothash.go index ed13848dafe..32066f4cad8 100644 --- a/go/consensus/cometbft/apps/roothash/roothash.go +++ b/go/consensus/cometbft/apps/roothash/roothash.go @@ -249,10 +249,10 @@ func (app *rootHashApplication) suspendUnpaidRuntime( func (app *rootHashApplication) prepareNewCommittees( ctx *tmapi.Context, - epoch beacon.EpochTime, + _ beacon.EpochTime, rtState *roothash.RuntimeState, schedState *schedulerState.MutableState, - regState *registryState.MutableState, + _ *registryState.MutableState, ) ( executorPool *commitment.Pool, empty bool, @@ -360,7 +360,7 @@ func (app *rootHashApplication) verifyRuntimeUpdate(ctx *tmapi.Context, rt *regi return fmt.Errorf("failed to get consensus parameters: %w", err) } - return roothash.VerifyRuntimeParameters(ctx.Logger(), rt, params) + return roothash.VerifyRuntimeParameters(rt, params) } func (app *rootHashApplication) ExecuteTx(ctx *tmapi.Context, tx *transaction.Transaction) error { diff --git a/go/consensus/cometbft/apps/roothash/transactions.go b/go/consensus/cometbft/apps/roothash/transactions.go index 958825d90d5..7cd49756ce2 100644 --- a/go/consensus/cometbft/apps/roothash/transactions.go +++ b/go/consensus/cometbft/apps/roothash/transactions.go @@ -12,7 +12,6 @@ import ( stakingState "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/apps/staking/state" roothash "github.com/oasisprotocol/oasis-core/go/roothash/api" "github.com/oasisprotocol/oasis-core/go/roothash/api/block" - "github.com/oasisprotocol/oasis-core/go/roothash/api/commitment" "github.com/oasisprotocol/oasis-core/go/roothash/api/message" staking "github.com/oasisprotocol/oasis-core/go/staking/api" ) @@ -23,23 +22,20 @@ func (app *rootHashApplication) getRuntimeState( ctx *abciAPI.Context, state *roothashState.MutableState, id common.Namespace, -) (*roothash.RuntimeState, commitment.NodeLookup, error) { +) (*roothash.RuntimeState, error) { // Fetch current runtime state. rtState, err := state.RuntimeState(ctx, id) if err != nil { - return nil, nil, fmt.Errorf("roothash: failed to fetch runtime state: %w", err) + return nil, fmt.Errorf("roothash: failed to fetch runtime state: %w", err) } if rtState.Suspended { - return nil, nil, roothash.ErrRuntimeSuspended + return nil, roothash.ErrRuntimeSuspended } if rtState.ExecutorPool == nil { - return nil, nil, roothash.ErrNoExecutorPool + return nil, roothash.ErrNoExecutorPool } - // Create node lookup. - nl := registryState.NewMutableState(ctx.State()) - - return rtState, nl, nil + return rtState, nil } func (app *rootHashApplication) executorProposerTimeout( @@ -68,7 +64,7 @@ func (app *rootHashApplication) executorProposerTimeout( return nil } - rtState, nl, err := app.getRuntimeState(ctx, state, rpt.ID) + rtState, err := app.getRuntimeState(ctx, state, rpt.ID) if err != nil { return err } @@ -86,7 +82,7 @@ func (app *rootHashApplication) executorProposerTimeout( } // Ensure request is valid. - if err = rtState.ExecutorPool.CheckProposerTimeout(ctx, rtState.CurrentBlock, nl, ctx.TxSigner(), rpt.Round); err != nil { + if err = rtState.ExecutorPool.CheckProposerTimeout(rtState.CurrentBlock, ctx.TxSigner(), rpt.Round); err != nil { ctx.Logger().Debug("failed requesting proposer round timeout", "err", err, "round", rtState.CurrentBlock.Header.Round, @@ -151,10 +147,11 @@ func (app *rootHashApplication) executorCommit( return err } - rtState, nl, err := app.getRuntimeState(ctx, state, cc.ID) + rtState, err := app.getRuntimeState(ctx, state, cc.ID) if err != nil { return err } + nl := registryState.NewMutableState(ctx.State()) // Account for gas consumed by messages. msgGasAccountant := func(msgs []message.Message) error { @@ -242,7 +239,7 @@ func (app *rootHashApplication) submitEvidence( return nil } - rtState, _, err := app.getRuntimeState(ctx, state, evidence.ID) + rtState, err := app.getRuntimeState(ctx, state, evidence.ID) if err != nil { return err } @@ -352,7 +349,7 @@ func (app *rootHashApplication) submitMsg( return nil } - rtState, _, err := app.getRuntimeState(ctx, state, msg.ID) + rtState, err := app.getRuntimeState(ctx, state, msg.ID) if err != nil { return err } diff --git a/go/consensus/cometbft/apps/scheduler/scheduler.go b/go/consensus/cometbft/apps/scheduler/scheduler.go index 83e45108272..486319b3b30 100644 --- a/go/consensus/cometbft/apps/scheduler/scheduler.go +++ b/go/consensus/cometbft/apps/scheduler/scheduler.go @@ -211,7 +211,6 @@ func (app *schedulerApplication) BeginBlock(ctx *api.Context) error { for _, kind := range kinds { if err = app.electAllCommittees( ctx, - app.state, params, beaconState, beaconParameters, @@ -267,7 +266,7 @@ func (app *schedulerApplication) ExecuteMessage(ctx *api.Context, kind, msg inte } } -func (app *schedulerApplication) ExecuteTx(ctx *api.Context, tx *transaction.Transaction) error { +func (app *schedulerApplication) ExecuteTx(*api.Context, *transaction.Transaction) error { return fmt.Errorf("cometbft/scheduler: unexpected transaction") } @@ -413,7 +412,6 @@ func GetPerm(beacon []byte, runtimeID common.Namespace, rngCtx []byte, nrNodes i // Operates on consensus connection. func (app *schedulerApplication) electAllCommittees( ctx *api.Context, - appState api.ApplicationQueryState, schedulerParameters *scheduler.ConsensusParameters, beaconState *beaconState.MutableState, beaconParameters *beacon.ConsensusParameters, @@ -428,7 +426,6 @@ func (app *schedulerApplication) electAllCommittees( for _, runtime := range runtimes { if err := app.electCommittee( ctx, - appState, schedulerParameters, beaconState, beaconParameters, diff --git a/go/consensus/cometbft/apps/scheduler/scheduler_test.go b/go/consensus/cometbft/apps/scheduler/scheduler_test.go index d05464f22b1..95f37ea851f 100644 --- a/go/consensus/cometbft/apps/scheduler/scheduler_test.go +++ b/go/consensus/cometbft/apps/scheduler/scheduler_test.go @@ -792,7 +792,6 @@ func TestElectCommittee(t *testing.T) { err := app.electCommittee( ctx, - app.state, schedulerParameters, beaconState, beaconParameters, diff --git a/go/consensus/cometbft/apps/scheduler/shuffle.go b/go/consensus/cometbft/apps/scheduler/shuffle.go index 7782b49f40b..547109fe9eb 100644 --- a/go/consensus/cometbft/apps/scheduler/shuffle.go +++ b/go/consensus/cometbft/apps/scheduler/shuffle.go @@ -44,7 +44,7 @@ func getPrevVRFState( func shuffleValidators( ctx *api.Context, - appState api.ApplicationQueryState, + _ api.ApplicationQueryState, schedulerParameters *scheduler.ConsensusParameters, beaconState *beaconState.MutableState, beaconParameters *beacon.ConsensusParameters, @@ -148,7 +148,6 @@ func shuffleValidatorsByEntropy( func (app *schedulerApplication) electCommittee( //nolint: gocyclo ctx *api.Context, - appState api.ApplicationQueryState, schedulerParameters *scheduler.ConsensusParameters, beaconState *beaconState.MutableState, beaconParameters *beacon.ConsensusParameters, diff --git a/go/consensus/cometbft/apps/staking/genesis.go b/go/consensus/cometbft/apps/staking/genesis.go index a56a94633c1..b696f06ae97 100644 --- a/go/consensus/cometbft/apps/staking/genesis.go +++ b/go/consensus/cometbft/apps/staking/genesis.go @@ -286,7 +286,7 @@ func (app *stakingApplication) initDebondingDelegations(ctx *abciAPI.Context, st } // InitChain initializes the chain from genesis. -func (app *stakingApplication) InitChain(ctx *abciAPI.Context, request types.RequestInitChain, doc *genesis.Document) error { +func (app *stakingApplication) InitChain(ctx *abciAPI.Context, _ types.RequestInitChain, doc *genesis.Document) error { st := &doc.Staking var ( diff --git a/go/consensus/cometbft/apps/staking/slashing.go b/go/consensus/cometbft/apps/staking/slashing.go index 8cf5b7b22d5..03f3073a863 100644 --- a/go/consensus/cometbft/apps/staking/slashing.go +++ b/go/consensus/cometbft/apps/staking/slashing.go @@ -4,7 +4,6 @@ import ( "context" "encoding/hex" "math" - "time" cmtcrypto "github.com/cometbft/cometbft/crypto" @@ -20,9 +19,6 @@ func onEvidenceByzantineConsensus( ctx *abciAPI.Context, reason staking.SlashReason, addr cmtcrypto.Address, - height int64, - time time.Time, - power int64, ) error { regState := registryState.NewMutableState(ctx.State()) stakeState := stakingState.NewMutableState(ctx.State()) diff --git a/go/consensus/cometbft/apps/staking/slashing_test.go b/go/consensus/cometbft/apps/staking/slashing_test.go index 59397567be7..15c74ff6f70 100644 --- a/go/consensus/cometbft/apps/staking/slashing_test.go +++ b/go/consensus/cometbft/apps/staking/slashing_test.go @@ -2,7 +2,6 @@ package staking import ( "testing" - "time" "github.com/stretchr/testify/require" @@ -23,7 +22,6 @@ import ( func TestOnEvidenceByzantineConsensus(t *testing.T) { require := require.New(t) - now := time.Unix(1580461674, 0) appState := abciAPI.NewMockApplicationState(&abciAPI.MockApplicationStateConfig{ // Use a non-zero current epoch so we test freeze overflow. CurrentEpoch: 42, @@ -39,7 +37,7 @@ func TestOnEvidenceByzantineConsensus(t *testing.T) { stakeState := stakingState.NewMutableState(ctx.State()) // Validator address is not known as there are no nodes. - err := onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress, 1, now, 1) + err := onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress) require.NoError(err, "should not fail when validator address is not known") // Add entity. @@ -64,7 +62,7 @@ func TestOnEvidenceByzantineConsensus(t *testing.T) { require.NoError(err, "SetNode") // Should not fail if node status is not available. - err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress, 1, now, 1) + err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress) require.NoError(err, "should not fail when node status is not available") // Add node status. @@ -72,7 +70,7 @@ func TestOnEvidenceByzantineConsensus(t *testing.T) { require.NoError(err, "SetNodeStatus") // Should fail if unable to get the slashing procedure. - err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress, 1, now, 1) + err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress) require.Error(err, "should fail when unable to get the slashing procedure") // Add slashing procedure. @@ -90,7 +88,7 @@ func TestOnEvidenceByzantineConsensus(t *testing.T) { // Should not fail if the validator has no stake (which is in any case an // invariant violation as a validator needs to have some stake). - err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress, 1, now, 1) + err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress) require.NoError(err, "should not fail when validator has no stake") // Node should be frozen. status, err := regState.NodeStatus(ctx, nod.ID) @@ -99,7 +97,7 @@ func TestOnEvidenceByzantineConsensus(t *testing.T) { require.EqualValues(registry.FreezeForever, status.FreezeEndTime, "node should be frozen forever") // Should not fail slashing a frozen node. - err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress, 1, now, 1) + err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress) require.NoError(err, "should not fail when validator is frozen") // Unfreeze the node. err = regState.SetNodeStatus(ctx, nod.ID, ®istry.NodeStatus{FreezeEndTime: 0}) @@ -124,7 +122,7 @@ func TestOnEvidenceByzantineConsensus(t *testing.T) { require.NoError(err, "SetAccount") // Should slash. - err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress, 1, now, 1) + err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusEquivocation, validatorAddress) require.NoError(err, "slashing should succeed") // Entity stake should be slashed. @@ -140,6 +138,6 @@ func TestOnEvidenceByzantineConsensus(t *testing.T) { require.EqualValues(registry.FreezeForever, status.FreezeEndTime, "node should be frozen forever") // Should not fail in case the slashing penalty is not configured. - err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusLightClientAttack, validatorAddress, 1, now, 1) + err = onEvidenceByzantineConsensus(ctx, staking.SlashConsensusLightClientAttack, validatorAddress) require.NoError(err, "slashing should not fail") } diff --git a/go/consensus/cometbft/apps/staking/staking.go b/go/consensus/cometbft/apps/staking/staking.go index 536f13d50b4..87dddbb164b 100644 --- a/go/consensus/cometbft/apps/staking/staking.go +++ b/go/consensus/cometbft/apps/staking/staking.go @@ -111,7 +111,7 @@ func (app *stakingApplication) BeginBlock(ctx *api.Context) error { continue } - if err = onEvidenceByzantineConsensus(ctx, reason, evidence.Validator.Address, evidence.Height, evidence.Time, evidence.Validator.Power); err != nil { + if err = onEvidenceByzantineConsensus(ctx, reason, evidence.Validator.Address); err != nil { return err } } diff --git a/go/consensus/cometbft/apps/supplementarysanity/checks.go b/go/consensus/cometbft/apps/supplementarysanity/checks.go index 08719e47fe0..6b414ec25ae 100644 --- a/go/consensus/cometbft/apps/supplementarysanity/checks.go +++ b/go/consensus/cometbft/apps/supplementarysanity/checks.go @@ -20,7 +20,7 @@ import ( staking "github.com/oasisprotocol/oasis-core/go/staking/api" ) -func checkEpochTime(ctx *abciAPI.Context, now beacon.EpochTime) error { +func checkEpochTime(_ *abciAPI.Context, now beacon.EpochTime) error { if now == beacon.EpochInvalid { return fmt.Errorf("current epoch is invalid") } @@ -75,7 +75,7 @@ func checkRegistry(ctx *abciAPI.Context, now beacon.EpochTime) error { return nil } -func checkRootHash(ctx *abciAPI.Context, now beacon.EpochTime) error { +func checkRootHash(ctx *abciAPI.Context, _ beacon.EpochTime) error { st := roothashState.NewMutableState(ctx.State()) // Check blocks. @@ -254,7 +254,7 @@ func checkStaking(ctx *abciAPI.Context, now beacon.EpochTime) error { //nolint: return nil } -func checkKeyManager(ctx *abciAPI.Context, now beacon.EpochTime) error { +func checkKeyManager(ctx *abciAPI.Context, _ beacon.EpochTime) error { st := keymanagerState.NewMutableState(ctx.State()) statuses, err := st.Statuses(ctx) @@ -339,7 +339,7 @@ func checkHalt(*abciAPI.Context, beacon.EpochTime) error { return nil } -func checkStakeClaims(ctx *abciAPI.Context, now beacon.EpochTime) error { +func checkStakeClaims(ctx *abciAPI.Context, _ beacon.EpochTime) error { regSt := registryState.NewMutableState(ctx.State()) stakingSt := stakingState.NewMutableState(ctx.State()) diff --git a/go/consensus/cometbft/apps/supplementarysanity/supplementarysanity.go b/go/consensus/cometbft/apps/supplementarysanity/supplementarysanity.go index 8d43bc8be1c..3ac090a7104 100644 --- a/go/consensus/cometbft/apps/supplementarysanity/supplementarysanity.go +++ b/go/consensus/cometbft/apps/supplementarysanity/supplementarysanity.go @@ -55,14 +55,14 @@ func (app *supplementarySanityApplication) QueryFactory() interface{} { return nil } -func (app *supplementarySanityApplication) OnRegister(state api.ApplicationState, md api.MessageDispatcher) { +func (app *supplementarySanityApplication) OnRegister(state api.ApplicationState, _ api.MessageDispatcher) { app.state = state } func (app *supplementarySanityApplication) OnCleanup() { } -func (app *supplementarySanityApplication) ExecuteMessage(ctx *api.Context, kind, msg interface{}) (interface{}, error) { +func (app *supplementarySanityApplication) ExecuteMessage(*api.Context, interface{}, interface{}) (interface{}, error) { return nil, fmt.Errorf("supplementarysanity: unexpected message") } diff --git a/go/consensus/cometbft/beacon/beacon.go b/go/consensus/cometbft/beacon/beacon.go index 3c15b50802e..56167b618bc 100644 --- a/go/consensus/cometbft/beacon/beacon.go +++ b/go/consensus/cometbft/beacon/beacon.go @@ -76,7 +76,7 @@ func (sc *serviceClient) ConsensusParameters(ctx context.Context, height int64) return q.ConsensusParameters(ctx) } -func (sc *serviceClient) GetBaseEpoch(ctx context.Context) (beaconAPI.EpochTime, error) { +func (sc *serviceClient) GetBaseEpoch(context.Context) (beaconAPI.EpochTime, error) { return sc.baseEpoch, nil } @@ -168,7 +168,7 @@ func (sc *serviceClient) WaitEpoch(ctx context.Context, epoch beaconAPI.EpochTim } } -func (sc *serviceClient) WatchEpochs(ctx context.Context) (<-chan beaconAPI.EpochTime, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchEpochs(_ context.Context) (<-chan beaconAPI.EpochTime, pubsub.ClosableSubscription, error) { typedCh := make(chan beaconAPI.EpochTime) sub := sc.epochNotifier.Subscribe() sub.Unwrap(typedCh) @@ -176,7 +176,7 @@ func (sc *serviceClient) WatchEpochs(ctx context.Context) (<-chan beaconAPI.Epoc return typedCh, sub, nil } -func (sc *serviceClient) WatchLatestEpoch(ctx context.Context) (<-chan beaconAPI.EpochTime, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchLatestEpoch(context.Context) (<-chan beaconAPI.EpochTime, pubsub.ClosableSubscription, error) { typedCh := make(chan beaconAPI.EpochTime) sub := sc.epochNotifier.SubscribeBuffered(1) sub.Unwrap(typedCh) @@ -202,7 +202,7 @@ func (sc *serviceClient) GetVRFState(ctx context.Context, height int64) (*beacon return q.VRFState(ctx) } -func (sc *serviceClient) WatchLatestVRFEvent(ctx context.Context) (<-chan *beaconAPI.VRFEvent, *pubsub.Subscription, error) { +func (sc *serviceClient) WatchLatestVRFEvent(context.Context) (<-chan *beaconAPI.VRFEvent, *pubsub.Subscription, error) { typedCh := make(chan *beaconAPI.VRFEvent) sub := sc.vrfNotifier.Subscribe() sub.Unwrap(typedCh) @@ -281,7 +281,7 @@ func (sc *serviceClient) DeliverBlock(ctx context.Context, height int64) error { return nil } -func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error { +func (sc *serviceClient) DeliverEvent(_ context.Context, height int64, _ cmttypes.Tx, ev *cmtabcitypes.Event) error { for _, pair := range ev.GetAttributes() { key := pair.GetKey() val := pair.GetValue() diff --git a/go/consensus/cometbft/full/archive.go b/go/consensus/cometbft/full/archive.go index db7671bea36..44eaf47793b 100644 --- a/go/consensus/cometbft/full/archive.go +++ b/go/consensus/cometbft/full/archive.go @@ -119,12 +119,12 @@ func (srv *archiveService) GetStatus(ctx context.Context) (*consensusAPI.Status, } // Implements consensusAPI.Backend. -func (srv *archiveService) EstimateGas(ctx context.Context, req *consensusAPI.EstimateGasRequest) (transaction.Gas, error) { +func (srv *archiveService) EstimateGas(context.Context, *consensusAPI.EstimateGasRequest) (transaction.Gas, error) { return 0, consensusAPI.ErrUnsupported } // Implements consensusAPI.Backend. -func (srv *archiveService) GetSignerNonce(ctx context.Context, req *consensusAPI.GetSignerNonceRequest) (uint64, error) { +func (srv *archiveService) GetSignerNonce(context.Context, *consensusAPI.GetSignerNonceRequest) (uint64, error) { return 0, consensusAPI.ErrUnsupported } diff --git a/go/consensus/cometbft/full/common.go b/go/consensus/cometbft/full/common.go index c57f8e9872a..d00815a925b 100644 --- a/go/consensus/cometbft/full/common.go +++ b/go/consensus/cometbft/full/common.go @@ -234,7 +234,7 @@ func (n *commonNode) initialize() error { n.svcMgr.RegisterCleanupOnly(n.registry, "registry backend") var scStaking tmstaking.ServiceClient - if scStaking, err = tmstaking.New(n.ctx, n.parentNode); err != nil { + if scStaking, err = tmstaking.New(n.parentNode); err != nil { n.Logger.Error("staking: failed to initialize staking backend", "err", err, ) @@ -245,7 +245,7 @@ func (n *commonNode) initialize() error { n.svcMgr.RegisterCleanupOnly(n.staking, "staking backend") var scScheduler tmscheduler.ServiceClient - if scScheduler, err = tmscheduler.New(n.ctx, n.parentNode); err != nil { + if scScheduler, err = tmscheduler.New(n.parentNode); err != nil { n.Logger.Error("scheduler: failed to initialize scheduler backend", "err", err, ) @@ -256,7 +256,7 @@ func (n *commonNode) initialize() error { n.svcMgr.RegisterCleanupOnly(n.scheduler, "scheduler backend") var scRootHash tmroothash.ServiceClient - if scRootHash, err = tmroothash.New(n.ctx, n.dataDir, n.parentNode); err != nil { + if scRootHash, err = tmroothash.New(n.ctx, n.parentNode); err != nil { n.Logger.Error("roothash: failed to initialize roothash backend", "err", err, ) @@ -267,7 +267,7 @@ func (n *commonNode) initialize() error { n.svcMgr.RegisterCleanupOnly(n.roothash, "roothash backend") var scGovernance tmgovernance.ServiceClient - if scGovernance, err = tmgovernance.New(n.ctx, n.parentNode); err != nil { + if scGovernance, err = tmgovernance.New(n.parentNode); err != nil { n.Logger.Error("governance: failed to initialize governance backend", "err", err, ) @@ -397,12 +397,12 @@ func (n *commonNode) StateToGenesis(ctx context.Context, blockHeight int64) (*ge } // Implements consensusAPI.Backend. -func (n *commonNode) GetGenesisDocument(ctx context.Context) (*genesisAPI.Document, error) { +func (n *commonNode) GetGenesisDocument(context.Context) (*genesisAPI.Document, error) { return n.genesis, nil } // Implements consensusAPI.Backend. -func (n *commonNode) GetChainContext(ctx context.Context) (string, error) { +func (n *commonNode) GetChainContext(context.Context) (string, error) { return n.genesis.ChainContext(), nil } @@ -457,7 +457,7 @@ func (n *commonNode) TransactionAuthHandler() consensusAPI.TransactionAuthHandle } // Implements consensusAPI.Backend. -func (n *commonNode) EstimateGas(ctx context.Context, req *consensusAPI.EstimateGasRequest) (transaction.Gas, error) { +func (n *commonNode) EstimateGas(_ context.Context, req *consensusAPI.EstimateGasRequest) (transaction.Gas, error) { return n.mux.EstimateGas(req.Signer, req.Transaction) } @@ -896,37 +896,37 @@ func (n *commonNode) WatchCometBFTBlocks() (<-chan *cmttypes.Block, *pubsub.Subs } // Implements consensusAPI.Backend. -func (n *commonNode) GetNextBlockState(ctx context.Context) (*consensusAPI.NextBlockState, error) { +func (n *commonNode) GetNextBlockState(context.Context) (*consensusAPI.NextBlockState, error) { return nil, consensusAPI.ErrUnsupported } // Implements consensusAPI.Backend. -func (n *commonNode) SubmitEvidence(ctx context.Context, evidence *consensusAPI.Evidence) error { +func (n *commonNode) SubmitEvidence(context.Context, *consensusAPI.Evidence) error { return consensusAPI.ErrUnsupported } // Implements consensusAPI.Backend. -func (n *commonNode) SubmitTx(ctx context.Context, tx *transaction.SignedTransaction) error { +func (n *commonNode) SubmitTx(context.Context, *transaction.SignedTransaction) error { return consensusAPI.ErrUnsupported } // Implements consensusAPI.Backend. -func (n *commonNode) SubmitTxNoWait(ctx context.Context, tx *transaction.SignedTransaction) error { +func (n *commonNode) SubmitTxNoWait(context.Context, *transaction.SignedTransaction) error { return consensusAPI.ErrUnsupported } // Implements consensusAPI.Backend. -func (n *commonNode) SubmitTxWithProof(ctx context.Context, tx *transaction.SignedTransaction) (*transaction.Proof, error) { +func (n *commonNode) SubmitTxWithProof(context.Context, *transaction.SignedTransaction) (*transaction.Proof, error) { return nil, consensusAPI.ErrUnsupported } // Implements consensusAPI.Backend. -func (n *commonNode) GetUnconfirmedTransactions(ctx context.Context) ([][]byte, error) { +func (n *commonNode) GetUnconfirmedTransactions(context.Context) ([][]byte, error) { return nil, consensusAPI.ErrUnsupported } // Implements consensusAPI.Backend. -func (n *commonNode) WatchBlocks(ctx context.Context) (<-chan *consensusAPI.Block, pubsub.ClosableSubscription, error) { +func (n *commonNode) WatchBlocks(context.Context) (<-chan *consensusAPI.Block, pubsub.ClosableSubscription, error) { return nil, nil, consensusAPI.ErrUnsupported } @@ -936,7 +936,7 @@ func (n *commonNode) SubmissionManager() consensusAPI.SubmissionManager { } // Implements consensusAPI.Backend. -func (n *commonNode) RegisterP2PService(p2p p2pAPI.Service) error { +func (n *commonNode) RegisterP2PService(p2pAPI.Service) error { return consensusAPI.ErrUnsupported } diff --git a/go/consensus/cometbft/full/full.go b/go/consensus/cometbft/full/full.go index 7f6cdf283e4..69efb59a3c3 100644 --- a/go/consensus/cometbft/full/full.go +++ b/go/consensus/cometbft/full/full.go @@ -195,7 +195,7 @@ func (t *fullService) SubmitTx(ctx context.Context, tx *transaction.SignedTransa } // Implements consensusAPI.Backend. -func (t *fullService) SubmitTxNoWait(ctx context.Context, tx *transaction.SignedTransaction) error { +func (t *fullService) SubmitTxNoWait(_ context.Context, tx *transaction.SignedTransaction) error { return t.broadcastTxRaw(cbor.Marshal(tx)) } @@ -374,7 +374,7 @@ func (t *fullService) SubmissionManager() consensusAPI.SubmissionManager { } // Implements consensusAPI.Backend. -func (t *fullService) GetUnconfirmedTransactions(ctx context.Context) ([][]byte, error) { +func (t *fullService) GetUnconfirmedTransactions(context.Context) ([][]byte, error) { mempoolTxs := t.node.Mempool().ReapMaxTxs(-1) txs := make([][]byte, 0, len(mempoolTxs)) for _, v := range mempoolTxs { diff --git a/go/consensus/cometbft/governance/governance.go b/go/consensus/cometbft/governance/governance.go index f5e0b05ffb2..0582ed713bc 100644 --- a/go/consensus/cometbft/governance/governance.go +++ b/go/consensus/cometbft/governance/governance.go @@ -144,7 +144,7 @@ func (sc *serviceClient) GetEvents(ctx context.Context, height int64) ([]*api.Ev return events, nil } -func (sc *serviceClient) WatchEvents(ctx context.Context) (<-chan *api.Event, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchEvents(context.Context) (<-chan *api.Event, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.Event) sub := sc.eventNotifier.Subscribe() sub.Unwrap(typedCh) @@ -170,7 +170,7 @@ func (sc *serviceClient) ServiceDescriptor() tmapi.ServiceDescriptor { } // Implements api.ServiceClient. -func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error { +func (sc *serviceClient) DeliverEvent(_ context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error { events, err := EventsFromCometBFT(tx, height, []cmtabcitypes.Event{*ev}) if err != nil { return fmt.Errorf("governance: failed to process cometbft events: %w", err) @@ -261,7 +261,7 @@ func EventsFromCometBFT( } // New constructs a new CometBFT backed governance Backend instance. -func New(ctx context.Context, backend tmapi.Backend) (ServiceClient, error) { +func New(backend tmapi.Backend) (ServiceClient, error) { // Initialize and register the CometBFT service component. a := app.New() if err := backend.RegisterApplication(a); err != nil { diff --git a/go/consensus/cometbft/keymanager/keymanager.go b/go/consensus/cometbft/keymanager/keymanager.go index 20c0d0f6bdd..729c211dd40 100644 --- a/go/consensus/cometbft/keymanager/keymanager.go +++ b/go/consensus/cometbft/keymanager/keymanager.go @@ -113,7 +113,7 @@ func (sc *serviceClient) ServiceDescriptor() tmapi.ServiceDescriptor { } // Implements api.ServiceClient. -func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error { +func (sc *serviceClient) DeliverEvent(_ context.Context, _ int64, _ cmttypes.Tx, ev *cmtabcitypes.Event) error { for _, pair := range ev.GetAttributes() { if events.IsAttributeKind(pair.GetKey(), &api.StatusUpdateEvent{}) { var event api.StatusUpdateEvent diff --git a/go/consensus/cometbft/light/service.go b/go/consensus/cometbft/light/service.go index 72e1d90c5e2..2d19482c427 100644 --- a/go/consensus/cometbft/light/service.go +++ b/go/consensus/cometbft/light/service.go @@ -73,7 +73,7 @@ func (c *client) Start() error { return nil } -func (c *client) GetStatus(ctx context.Context) (*consensus.LightClientStatus, error) { +func (c *client) GetStatus() (*consensus.LightClientStatus, error) { status := &consensus.LightClientStatus{} oldest, err := c.store.FirstLightBlockHeight() if err != nil { diff --git a/go/consensus/cometbft/registry/registry.go b/go/consensus/cometbft/registry/registry.go index 780680a02bc..620d7957205 100644 --- a/go/consensus/cometbft/registry/registry.go +++ b/go/consensus/cometbft/registry/registry.go @@ -72,7 +72,7 @@ func (sc *serviceClient) GetEntities(ctx context.Context, height int64) ([]*enti return q.Entities(ctx) } -func (sc *serviceClient) WatchEntities(ctx context.Context) (<-chan *api.EntityEvent, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchEntities(context.Context) (<-chan *api.EntityEvent, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.EntityEvent) sub := sc.entityNotifier.Subscribe() sub.Unwrap(typedCh) @@ -116,7 +116,7 @@ func (sc *serviceClient) GetNodeByConsensusAddress(ctx context.Context, query *a return q.NodeByConsensusAddress(ctx, query.Address) } -func (sc *serviceClient) WatchNodes(ctx context.Context) (<-chan *api.NodeEvent, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchNodes(context.Context) (<-chan *api.NodeEvent, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.NodeEvent) sub := sc.nodeNotifier.Subscribe() sub.Unwrap(typedCh) @@ -124,7 +124,7 @@ func (sc *serviceClient) WatchNodes(ctx context.Context) (<-chan *api.NodeEvent, return typedCh, sub, nil } -func (sc *serviceClient) WatchNodeList(ctx context.Context) (<-chan *api.NodeList, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchNodeList(context.Context) (<-chan *api.NodeList, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.NodeList) sub := sc.nodeListNotifier.Subscribe() sub.Unwrap(typedCh) @@ -141,7 +141,7 @@ func (sc *serviceClient) GetRuntime(ctx context.Context, query *api.GetRuntimeQu return q.Runtime(ctx, query.ID, query.IncludeSuspended) } -func (sc *serviceClient) WatchRuntimes(ctx context.Context) (<-chan *api.Runtime, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchRuntimes(_ context.Context) (<-chan *api.Runtime, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.Runtime) sub := sc.runtimeNotifier.Subscribe() sub.Unwrap(typedCh) @@ -221,7 +221,7 @@ func (sc *serviceClient) GetEvents(ctx context.Context, height int64) ([]*api.Ev } // WatchEvents implements api.Backend. -func (sc *serviceClient) WatchEvents(ctx context.Context) (<-chan *api.Event, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchEvents(_ context.Context) (<-chan *api.Event, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.Event) sub := sc.eventNotifier.Subscribe() sub.Unwrap(typedCh) diff --git a/go/consensus/cometbft/roothash/roothash.go b/go/consensus/cometbft/roothash/roothash.go index bce0bad4254..8b64732abbf 100644 --- a/go/consensus/cometbft/roothash/roothash.go +++ b/go/consensus/cometbft/roothash/roothash.go @@ -167,7 +167,7 @@ func (sc *serviceClient) GetIncomingMessageQueue(ctx context.Context, request *a } // Implements api.Backend. -func (sc *serviceClient) WatchBlocks(ctx context.Context, id common.Namespace) (<-chan *api.AnnotatedBlock, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchBlocks(_ context.Context, id common.Namespace) (<-chan *api.AnnotatedBlock, pubsub.ClosableSubscription, error) { notifiers := sc.getRuntimeNotifiers(id) sub := notifiers.blockNotifier.SubscribeEx(-1, func(ch channels.Channel) { @@ -224,7 +224,7 @@ func (sc *serviceClient) WatchAllBlocks() (<-chan *block.Block, *pubsub.Subscrip } // Implements api.Backend. -func (sc *serviceClient) WatchEvents(ctx context.Context, id common.Namespace) (<-chan *api.Event, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchEvents(_ context.Context, id common.Namespace) (<-chan *api.Event, pubsub.ClosableSubscription, error) { notifiers := sc.getRuntimeNotifiers(id) sub := notifiers.eventNotifier.Subscribe() ch := make(chan *api.Event) @@ -240,7 +240,7 @@ func (sc *serviceClient) WatchEvents(ctx context.Context, id common.Namespace) ( } // Implements api.Backend. -func (sc *serviceClient) WatchExecutorCommitments(ctx context.Context) (<-chan *commitment.ExecutorCommitment, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchExecutorCommitments(_ context.Context) (<-chan *commitment.ExecutorCommitment, pubsub.ClosableSubscription, error) { sub := sc.ecNotifier.Subscribe() ch := make(chan *commitment.ExecutorCommitment) sub.Unwrap(ch) @@ -835,7 +835,7 @@ func (ph *pruneHandler) trackRuntime(bh api.BlockHistory) { } // Implements api.StatePruneHandler. -func (ph *pruneHandler) Prune(ctx context.Context, version uint64) error { +func (ph *pruneHandler) Prune(_ context.Context, version uint64) error { ph.Lock() defer ph.Unlock() @@ -860,7 +860,6 @@ func (ph *pruneHandler) Prune(ctx context.Context, version uint64) error { // New constructs a new CometBFT-based root hash backend. func New( ctx context.Context, - dataDir string, backend tmapi.Backend, ) (ServiceClient, error) { // Create the general executor commitment notifier. diff --git a/go/consensus/cometbft/scheduler/scheduler.go b/go/consensus/cometbft/scheduler/scheduler.go index a8c3e8d5bcb..ead76c67d52 100644 --- a/go/consensus/cometbft/scheduler/scheduler.go +++ b/go/consensus/cometbft/scheduler/scheduler.go @@ -83,7 +83,7 @@ func (sc *serviceClient) GetCommittees(ctx context.Context, request *api.GetComm return runtimeCommittees, nil } -func (sc *serviceClient) WatchCommittees(ctx context.Context) (<-chan *api.Committee, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchCommittees(_ context.Context) (<-chan *api.Committee, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.Committee) sub := sc.notifier.Subscribe() sub.Unwrap(typedCh) @@ -106,7 +106,7 @@ func (sc *serviceClient) ServiceDescriptor() tmapi.ServiceDescriptor { } // Implements api.ServiceClient. -func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error { +func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, _ cmttypes.Tx, ev *cmtabcitypes.Event) error { for _, pair := range ev.GetAttributes() { if events.IsAttributeKind(pair.GetKey(), &api.ElectedEvent{}) { var e api.ElectedEvent @@ -142,7 +142,7 @@ func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, tx cmtt } // New constructs a new CometBFT-based scheduler Backend instance. -func New(ctx context.Context, backend tmapi.Backend) (ServiceClient, error) { +func New(backend tmapi.Backend) (ServiceClient, error) { // Initialze and register the CometBFT service component. a := app.New() if err := backend.RegisterApplication(a); err != nil { diff --git a/go/consensus/cometbft/staking/staking.go b/go/consensus/cometbft/staking/staking.go index f90469ee03b..4624d7ff16b 100644 --- a/go/consensus/cometbft/staking/staking.go +++ b/go/consensus/cometbft/staking/staking.go @@ -271,7 +271,7 @@ func (sc *serviceClient) GetEvents(ctx context.Context, height int64) ([]*api.Ev return events, nil } -func (sc *serviceClient) WatchEvents(ctx context.Context) (<-chan *api.Event, pubsub.ClosableSubscription, error) { +func (sc *serviceClient) WatchEvents(context.Context) (<-chan *api.Event, pubsub.ClosableSubscription, error) { typedCh := make(chan *api.Event) sub := sc.eventNotifier.Subscribe() sub.Unwrap(typedCh) @@ -297,7 +297,7 @@ func (sc *serviceClient) ServiceDescriptor() tmapi.ServiceDescriptor { } // Implements api.ServiceClient. -func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error { +func (sc *serviceClient) DeliverEvent(_ context.Context, height int64, tx cmttypes.Tx, ev *cmtabcitypes.Event) error { events, err := EventsFromCometBFT(tx, height, []cmtabcitypes.Event{*ev}) if err != nil { return fmt.Errorf("staking: failed to process cometbft events: %w", err) @@ -418,7 +418,7 @@ func EventsFromCometBFT( } // New constructs a new CometBFT backed staking Backend instance. -func New(ctx context.Context, backend tmapi.Backend) (ServiceClient, error) { +func New(backend tmapi.Backend) (ServiceClient, error) { // Initialize and register the CometBFT service component. a := app.New() if err := backend.RegisterApplication(a); err != nil { diff --git a/go/control/api/grpc.go b/go/control/api/grpc.go index dd7bef66f47..99c1e35d614 100644 --- a/go/control/api/grpc.go +++ b/go/control/api/grpc.go @@ -98,7 +98,7 @@ func handlerRequestShutdown( func handlerWaitSync( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -117,7 +117,7 @@ func handlerWaitSync( func handlerIsSynced( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -136,7 +136,7 @@ func handlerIsSynced( func handlerWaitReady( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -155,7 +155,7 @@ func handlerWaitReady( func handlerIsReady( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -220,7 +220,7 @@ func handlerCancelUpgrade( func handlerGetStatus( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { diff --git a/go/extra/extract-metrics/main.go b/go/extra/extract-metrics/main.go index aaadb3e5d8f..5d8c383de8a 100644 --- a/go/extra/extract-metrics/main.go +++ b/go/extra/extract-metrics/main.go @@ -117,7 +117,7 @@ func printJSON(m map[string]Metric) { var metrics = map[string]Metric{} -func doExtractMetrics(cmd *cobra.Command, args []string) { +func doExtractMetrics(*cobra.Command, []string) { searchDir := viper.GetString(CfgCodebasePath) fset := token.NewFileSet() // positions are relative to fset err := filepath.Walk(searchDir, func(path string, f os.FileInfo, err error) error { diff --git a/go/governance/api/api.go b/go/governance/api/api.go index e505cecfa3b..bda7fc45544 100644 --- a/go/governance/api/api.go +++ b/go/governance/api/api.go @@ -195,7 +195,7 @@ func (cu *CancelUpgradeProposal) Equals(other *CancelUpgradeProposal) bool { // PrettyPrint writes a pretty-printed representation of CancelUpgradeProposal // to the given writer. -func (cu CancelUpgradeProposal) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (cu CancelUpgradeProposal) PrettyPrint(_ context.Context, prefix string, w io.Writer) { fmt.Fprintf(w, "%sProposal ID: %d\n", prefix, cu.ProposalID) } @@ -232,7 +232,7 @@ func (p *ChangeParametersProposal) Equals(other *ChangeParametersProposal) bool // PrettyPrint writes a pretty-printed representation of ChangeParametersProposal to the given // writer. -func (p *ChangeParametersProposal) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (p *ChangeParametersProposal) PrettyPrint(_ context.Context, prefix string, w io.Writer) { fmt.Fprintf(w, "%sModule: %s\n", prefix, p.Module) fmt.Fprintf(w, "%sChanges: %v\n", prefix, p.Changes) } @@ -264,7 +264,7 @@ type ProposalVote struct { // PrettyPrint writes a pretty-printed representation of ProposalVote to the // given writer. -func (pv ProposalVote) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (pv ProposalVote) PrettyPrint(_ context.Context, prefix string, w io.Writer) { fmt.Fprintf(w, "%sProposal ID: %d\n", prefix, pv.ID) fmt.Fprintf(w, "%sVote: %s\n", prefix, pv.Vote) } diff --git a/go/governance/tests/tester.go b/go/governance/tests/tester.go index c63e2a30846..5b24d95daf5 100644 --- a/go/governance/tests/tester.go +++ b/go/governance/tests/tester.go @@ -118,7 +118,7 @@ func assertAccountBalance( require.EqualValues(expectedBalance, &acc.General.Balance, "account should have expected balance") } -func testBadProposals(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, testState *governanceTestsState) { +func testBadProposals(t *testing.T, _ api.Backend, consensus consensusAPI.Backend, _ *governanceTestsState) { require := require.New(t) ctx := context.Background() @@ -145,7 +145,7 @@ func testBadProposals(t *testing.T, backend api.Backend, consensus consensusAPI. require.Equal(api.ErrInvalidArgument, err, "SubmitProposalTx") } -func testBadVotes(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, testState *governanceTestsState) { +func testBadVotes(t *testing.T, _ api.Backend, consensus consensusAPI.Backend, testState *governanceTestsState) { require := require.New(t) ctx := context.Background() diff --git a/go/ias/api/grpc.go b/go/ias/api/grpc.go index cdb08b9b98d..f1b1784b5df 100644 --- a/go/ias/api/grpc.go +++ b/go/ias/api/grpc.go @@ -68,7 +68,7 @@ func handlerVerifyEvidence( func handlerGetSPIDInfo( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { diff --git a/go/ias/http/http.go b/go/ias/http/http.go index 7e73d7aa509..48ea5cc30f1 100644 --- a/go/ias/http/http.go +++ b/go/ias/http/http.go @@ -132,7 +132,7 @@ func (e *httpEndpoint) VerifyEvidence(ctx context.Context, evidence *api.Evidenc }, nil } -func (e *httpEndpoint) GetSPIDInfo(ctx context.Context) (*api.SPIDInfo, error) { +func (e *httpEndpoint) GetSPIDInfo(context.Context) (*api.SPIDInfo, error) { return &e.spidInfo, nil } @@ -178,7 +178,7 @@ type mockEndpoint struct { spidInfo api.SPIDInfo } -func (e *mockEndpoint) VerifyEvidence(ctx context.Context, evidence *api.Evidence) (*ias.AVRBundle, error) { +func (e *mockEndpoint) VerifyEvidence(_ context.Context, evidence *api.Evidence) (*ias.AVRBundle, error) { if len(evidence.Nonce) > ias.NonceMaxLen { return nil, fmt.Errorf("ias: invalid nonce length") } @@ -193,11 +193,11 @@ func (e *mockEndpoint) VerifyEvidence(ctx context.Context, evidence *api.Evidenc }, nil } -func (e *mockEndpoint) GetSPIDInfo(ctx context.Context) (*api.SPIDInfo, error) { +func (e *mockEndpoint) GetSPIDInfo(context.Context) (*api.SPIDInfo, error) { return &e.spidInfo, nil } -func (e *mockEndpoint) GetSigRL(ctx context.Context, epidGID uint32) ([]byte, error) { +func (e *mockEndpoint) GetSigRL(context.Context, uint32) ([]byte, error) { return nil, nil } diff --git a/go/ias/proxy/proxy.go b/go/ias/proxy/proxy.go index 40ef4857694..227cc7b5604 100644 --- a/go/ias/proxy/proxy.go +++ b/go/ias/proxy/proxy.go @@ -16,16 +16,14 @@ var _ api.Endpoint = (*proxyEndpoint)(nil) // Authenticator is the interface used to authenticate gRPC requests. type Authenticator interface { - // VerifyEvidence returns nil iff the signer's evidenice may attest + // VerifyEvidence returns nil iff the signer's evidence may attest // via the gRPC server. - // - // Caller authentication information may be derived from the context. - VerifyEvidence(ctx context.Context, evidence *api.Evidence) error + VerifyEvidence(evidence *api.Evidence) error } type noOpAuthenticator struct{} -func (n *noOpAuthenticator) VerifyEvidence(ctx context.Context, evidence *api.Evidence) error { +func (n *noOpAuthenticator) VerifyEvidence(*api.Evidence) error { return nil } @@ -37,7 +35,7 @@ type proxyEndpoint struct { } func (p *proxyEndpoint) VerifyEvidence(ctx context.Context, evidence *api.Evidence) (*ias.AVRBundle, error) { - if err := p.authenticator.VerifyEvidence(ctx, evidence); err != nil { + if err := p.authenticator.VerifyEvidence(evidence); err != nil { p.logger.Warn("failed to authenticate IAS VerifyEvidence request", "err", err, ) diff --git a/go/oasis-net-runner/cmd/root.go b/go/oasis-net-runner/cmd/root.go index 9fce93a7668..5dbe6589182 100644 --- a/go/oasis-net-runner/cmd/root.go +++ b/go/oasis-net-runner/cmd/root.go @@ -105,7 +105,7 @@ func initRootEnv(cmd *cobra.Command) (*env.Env, error) { return env, nil } -func runRoot(cmd *cobra.Command, args []string) error { +func runRoot(cmd *cobra.Command, _ []string) error { cmd.SilenceUsage = true // Initialize the base dir, logging, etc. @@ -166,7 +166,7 @@ func runRoot(cmd *cobra.Command, args []string) error { return nil } -func doDumpFixture(cmd *cobra.Command, args []string) { +func doDumpFixture(*cobra.Command, []string) { f, err := fixtures.GetFixture() if err != nil { common.EarlyLogAndExit(err) diff --git a/go/oasis-net-runner/fixtures/default.go b/go/oasis-net-runner/fixtures/default.go index e4bf26d1d32..07882e40030 100644 --- a/go/oasis-net-runner/fixtures/default.go +++ b/go/oasis-net-runner/fixtures/default.go @@ -1,7 +1,6 @@ package fixtures import ( - "context" "encoding/json" "fmt" "math" @@ -294,7 +293,7 @@ func getLatestVersionAndStateRoot(db mkvsAPI.NodeDB) (uint64, *hash.Hash, error) if !exists { return 0, nil, fmt.Errorf("no version found in runtime state db: %v", dbVersion) } - rts, err := db.GetRootsForVersion(context.Background(), dbVersion) + rts, err := db.GetRootsForVersion(dbVersion) if err != nil { return 0, nil, err } diff --git a/go/oasis-node/cmd/common/signer/signer.go b/go/oasis-node/cmd/common/signer/signer.go index 15e832262d6..ee5e4da6c34 100644 --- a/go/oasis-node/cmd/common/signer/signer.go +++ b/go/oasis-node/cmd/common/signer/signer.go @@ -116,7 +116,7 @@ func doNewFactory(signerBackend, signerDir string, roles ...signature.SignerRole config.ServerCertificate = serverCert } - return remoteSigner.NewFactory(config, roles...) + return remoteSigner.NewFactory(config) case pluginSigner.SignerName: config := &pluginSigner.FactoryConfig{ Name: viper.GetString(cfgSignerPluginName), diff --git a/go/oasis-node/cmd/consensus/consensus.go b/go/oasis-node/cmd/consensus/consensus.go index 84a1908d15e..0cf43d60251 100644 --- a/go/oasis-node/cmd/consensus/consensus.go +++ b/go/oasis-node/cmd/consensus/consensus.go @@ -114,7 +114,7 @@ func loadUnsignedTx() *transaction.Transaction { return &tx } -func doSubmitTx(cmd *cobra.Command, args []string) { +func doSubmitTx(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -132,7 +132,7 @@ func doSubmitTx(cmd *cobra.Command, args []string) { } } -func doShowTx(cmd *cobra.Command, args []string) { +func doShowTx(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -148,7 +148,7 @@ func doShowTx(cmd *cobra.Command, args []string) { sigTx.PrettyPrint(ctx, "", os.Stdout) } -func doEstimateGas(cmd *cobra.Command, args []string) { +func doEstimateGas(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -176,7 +176,7 @@ func doEstimateGas(cmd *cobra.Command, args []string) { fmt.Println(gas) } -func doNextBlockState(cmd *cobra.Command, args []string) { +func doNextBlockState(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/control/control.go b/go/oasis-node/cmd/control/control.go index 58378ac61f5..5bcdf918a3a 100644 --- a/go/oasis-node/cmd/control/control.go +++ b/go/oasis-node/cmd/control/control.go @@ -102,7 +102,7 @@ func doConnectOnly(cmd *cobra.Command) (*grpc.ClientConn, control.NodeController return conn, client } -func doIsSynced(cmd *cobra.Command, args []string) { +func doIsSynced(cmd *cobra.Command, _ []string) { conn, client := DoConnect(cmd) defer conn.Close() @@ -125,7 +125,7 @@ func doIsSynced(cmd *cobra.Command, args []string) { } } -func doWaitSync(cmd *cobra.Command, args []string) { +func doWaitSync(cmd *cobra.Command, _ []string) { conn, client := DoConnect(cmd) defer conn.Close() @@ -141,7 +141,7 @@ func doWaitSync(cmd *cobra.Command, args []string) { } } -func doShutdown(cmd *cobra.Command, args []string) { +func doShutdown(cmd *cobra.Command, _ []string) { conn, client := DoConnect(cmd) defer conn.Close() @@ -154,7 +154,7 @@ func doShutdown(cmd *cobra.Command, args []string) { } } -func doClearDeregister(cmd *cobra.Command, args []string) { +func doClearDeregister(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -267,7 +267,7 @@ func doCancelUpgrade(cmd *cobra.Command, args []string) { } } -func doStatus(cmd *cobra.Command, args []string) { +func doStatus(cmd *cobra.Command, _ []string) { conn, client := DoConnect(cmd) defer conn.Close() diff --git a/go/oasis-node/cmd/debug/beacon/beacon.go b/go/oasis-node/cmd/debug/beacon/beacon.go index 294645fdbfe..2247280ee5a 100644 --- a/go/oasis-node/cmd/debug/beacon/beacon.go +++ b/go/oasis-node/cmd/debug/beacon/beacon.go @@ -49,7 +49,7 @@ func doConnect(cmd *cobra.Command) (*grpc.ClientConn, beacon.Backend) { return conn, client } -func doBeaconStatus(cmd *cobra.Command, args []string) { +func doBeaconStatus(cmd *cobra.Command, _ []string) { conn, client := doConnect(cmd) defer conn.Close() diff --git a/go/oasis-node/cmd/debug/bundle/bundle.go b/go/oasis-node/cmd/debug/bundle/bundle.go index 408090f56c5..a8c792209a6 100644 --- a/go/oasis-node/cmd/debug/bundle/bundle.go +++ b/go/oasis-node/cmd/debug/bundle/bundle.go @@ -52,7 +52,7 @@ var ( logger = logging.GetLogger("cmd/debug/bundle") ) -func doInit(cmd *cobra.Command, args []string) error { +func doInit(*cobra.Command, []string) error { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -143,7 +143,7 @@ func doInit(cmd *cobra.Command, args []string) error { return nil } -func doInfo(cmd *cobra.Command, args []string) error { +func doInfo(*cobra.Command, []string) error { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/debug/byzantine/beacon_vrf.go b/go/oasis-node/cmd/debug/byzantine/beacon_vrf.go index f63bed43741..1248febae4d 100644 --- a/go/oasis-node/cmd/debug/byzantine/beacon_vrf.go +++ b/go/oasis-node/cmd/debug/byzantine/beacon_vrf.go @@ -67,7 +67,7 @@ func (m *VRFBeaconMode) FromString(s string) error { return nil } -func doVRFBeaconScenario(cmd *cobra.Command, args []string) { +func doVRFBeaconScenario(*cobra.Command, []string) { ctx := context.Background() var runtimeID common.Namespace diff --git a/go/oasis-node/cmd/debug/byzantine/byzantine.go b/go/oasis-node/cmd/debug/byzantine/byzantine.go index 9dfc1b08916..a07b1d4185c 100644 --- a/go/oasis-node/cmd/debug/byzantine/byzantine.go +++ b/go/oasis-node/cmd/debug/byzantine/byzantine.go @@ -113,14 +113,14 @@ var ( } ) -func activateCommonConfig(cmd *cobra.Command, args []string) { +func activateCommonConfig(*cobra.Command, []string) { // This subcommand is used in networks where other nodes are honest or colluding with us. // Set this so we don't reject things when we run without real IAS. ias.SetSkipVerify() ias.SetAllowDebugEnclaves() } -func doExecutorScenario(cmd *cobra.Command, args []string) { //nolint: gocyclo +func doExecutorScenario(*cobra.Command, []string) { //nolint: gocyclo ctx := context.Background() var runtimeID common.Namespace diff --git a/go/oasis-node/cmd/debug/byzantine/node.go b/go/oasis-node/cmd/debug/byzantine/node.go index fc75f4caa6b..fd8883dac9d 100644 --- a/go/oasis-node/cmd/debug/byzantine/node.go +++ b/go/oasis-node/cmd/debug/byzantine/node.go @@ -179,8 +179,6 @@ func initializeAndRegisterByzantineNode( if err = registryRegisterNode( b.cometbft.service, b.identity, - cmdCommon.DataDir(), - getGrpcAddress(), b.p2p.service.Addresses(), b.runtimeID, b.capabilities, diff --git a/go/oasis-node/cmd/debug/byzantine/p2p.go b/go/oasis-node/cmd/debug/byzantine/p2p.go index 841d2c3f73e..49bacc27c0f 100644 --- a/go/oasis-node/cmd/debug/byzantine/p2p.go +++ b/go/oasis-node/cmd/debug/byzantine/p2p.go @@ -42,12 +42,12 @@ func (h *txMsgHandler) DecodeMessage(msg []byte) (interface{}, error) { return tx, nil } -func (h *txMsgHandler) AuthorizeMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}) error { +func (h *txMsgHandler) AuthorizeMessage(context.Context, signature.PublicKey, interface{}) error { // Everyone is allowed to publish transactions. return nil } -func (h *txMsgHandler) HandleMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}, isOwn bool) error { +func (h *txMsgHandler) HandleMessage(_ context.Context, peerID signature.PublicKey, msg interface{}, isOwn bool) error { if isOwn { return nil } @@ -72,13 +72,13 @@ func (h *committeeMsgHandler) DecodeMessage(msg []byte) (interface{}, error) { return &dec, nil } -func (h *committeeMsgHandler) AuthorizeMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}) error { +func (h *committeeMsgHandler) AuthorizeMessage(context.Context, signature.PublicKey, interface{}) error { // The Byzantine node itself isn't especially robust. We assume that // the other nodes are honest. return nil } -func (h *committeeMsgHandler) HandleMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}, isOwn bool) error { +func (h *committeeMsgHandler) HandleMessage(_ context.Context, peerID signature.PublicKey, msg interface{}, isOwn bool) error { if isOwn { return nil } diff --git a/go/oasis-node/cmd/debug/byzantine/registry.go b/go/oasis-node/cmd/debug/byzantine/registry.go index 6152483a1f5..06339bf1d43 100644 --- a/go/oasis-node/cmd/debug/byzantine/registry.go +++ b/go/oasis-node/cmd/debug/byzantine/registry.go @@ -8,15 +8,14 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/cbor" "github.com/oasisprotocol/oasis-core/go/common/crypto/signature" "github.com/oasisprotocol/oasis-core/go/common/identity" - "github.com/oasisprotocol/oasis-core/go/common/logging" "github.com/oasisprotocol/oasis-core/go/common/node" consensus "github.com/oasisprotocol/oasis-core/go/consensus/api" registry "github.com/oasisprotocol/oasis-core/go/registry/api" "github.com/oasisprotocol/oasis-core/go/worker/registration" ) -func registryRegisterNode(svc consensus.Backend, id *identity.Identity, dataDir string, addresses, p2pAddresses []node.Address, runtimeID common.Namespace, capabilities *node.Capabilities, roles node.RolesMask) error { - entityID, registrationSigner, err := registration.GetRegistrationSigner(logging.GetLogger("cmd/byzantine/registration"), dataDir, id) +func registryRegisterNode(svc consensus.Backend, id *identity.Identity, p2pAddresses []node.Address, runtimeID common.Namespace, capabilities *node.Capabilities, roles node.RolesMask) error { + entityID, registrationSigner, err := registration.GetRegistrationSigner(id) if err != nil { return fmt.Errorf("registration GetRegistrationSigner: %w", err) } diff --git a/go/oasis-node/cmd/debug/control/control.go b/go/oasis-node/cmd/debug/control/control.go index 552a9131742..362f4565302 100644 --- a/go/oasis-node/cmd/debug/control/control.go +++ b/go/oasis-node/cmd/debug/control/control.go @@ -66,7 +66,7 @@ func doConnect(cmd *cobra.Command) (*grpc.ClientConn, control.DebugController) { return conn, client } -func doSetEpoch(cmd *cobra.Command, args []string) { +func doSetEpoch(cmd *cobra.Command, _ []string) { conn, client := doConnect(cmd) defer conn.Close() @@ -81,7 +81,7 @@ func doSetEpoch(cmd *cobra.Command, args []string) { } } -func doWaitNodes(cmd *cobra.Command, args []string) { +func doWaitNodes(cmd *cobra.Command, _ []string) { conn, client := doConnect(cmd) defer conn.Close() @@ -99,7 +99,7 @@ func doWaitNodes(cmd *cobra.Command, args []string) { logger.Info("enough nodes have been registered") } -func doWaitReady(cmd *cobra.Command, args []string) { +func doWaitReady(cmd *cobra.Command, _ []string) { conn, client := cmdControl.DoConnect(cmd) defer conn.Close() diff --git a/go/oasis-node/cmd/debug/dumpdb/dumpdb.go b/go/oasis-node/cmd/debug/dumpdb/dumpdb.go index 97f4043e660..61b2e487af8 100644 --- a/go/oasis-node/cmd/debug/dumpdb/dumpdb.go +++ b/go/oasis-node/cmd/debug/dumpdb/dumpdb.go @@ -59,7 +59,7 @@ var ( logger = logging.GetLogger("cmd/debug/dumpdb") ) -func doDumpDB(cmd *cobra.Command, args []string) { +func doDumpDB(cmd *cobra.Command, _ []string) { var ok bool defer func() { if !ok { @@ -103,7 +103,6 @@ func doDumpDB(cmd *cobra.Command, args []string) { // Hope you have backups if you ever run into this. ctx := context.Background() ldb, _, stateRoot, err := abci.InitStateStorage( - ctx, &abci.ApplicationConfig{ DataDir: filepath.Join(dataDir, cmtCommon.StateDir), StorageBackend: storageDB.BackendNameBadgerDB, // No other backend for now. @@ -393,7 +392,7 @@ func (qs *dumpQueryState) BlockHeight() int64 { return qs.height } -func (qs *dumpQueryState) GetEpoch(ctx context.Context, blockHeight int64) (beacon.EpochTime, error) { +func (qs *dumpQueryState) GetEpoch(context.Context, int64) (beacon.EpochTime, error) { // This is only required because certain registry backend queries // need the epoch to filter out expired nodes. It is not // implemented because acquiring a full state dump does not diff --git a/go/oasis-node/cmd/debug/fixgenesis/fixgenesis.go b/go/oasis-node/cmd/debug/fixgenesis/fixgenesis.go index ef025593c27..b6039c36af8 100644 --- a/go/oasis-node/cmd/debug/fixgenesis/fixgenesis.go +++ b/go/oasis-node/cmd/debug/fixgenesis/fixgenesis.go @@ -17,7 +17,6 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/entity" "github.com/oasisprotocol/oasis-core/go/common/logging" "github.com/oasisprotocol/oasis-core/go/common/node" - "github.com/oasisprotocol/oasis-core/go/common/quantity" genesis "github.com/oasisprotocol/oasis-core/go/genesis/api" keymanager "github.com/oasisprotocol/oasis-core/go/keymanager/api" cmdCommon "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common" @@ -43,7 +42,7 @@ var ( errOldNodeDesc = errors.New("deprecated node descriptor") ) -func doFixGenesis(cmd *cobra.Command, args []string) { +func doFixGenesis(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -127,7 +126,7 @@ type oldNodeDesc struct { DeprecatedBeacon cbor.RawMessage `json:"beacon,omitempty"` } -func openSignedNode(context signature.Context, sn *node.MultiSignedNode) (*node.Node, error) { +func openSignedNode(_ signature.Context, sn *node.MultiSignedNode) (*node.Node, error) { var ( node node.Node err error @@ -221,7 +220,6 @@ func updateGenesisDoc(oldDoc genesis.Document) (*genesis.Document, error) { entities, nodes, runtimes, - newDoc.Staking.Parameters.Thresholds, newDoc.Staking.Ledger, ) if err != nil { @@ -338,7 +336,6 @@ func computeStakeClaims( entities []*entity.Entity, nodes []*node.Node, runtimes []*registry.Runtime, - stakeThresholds map[staking.ThresholdKind]quantity.Quantity, accounts map[staking.Address]*staking.Account, ) (map[staking.Address]*staking.EscrowAccount, error) { computedStakeClaims := make(map[staking.Address]*staking.EscrowAccount) diff --git a/go/oasis-node/cmd/debug/storage/benchmark.go b/go/oasis-node/cmd/debug/storage/benchmark.go index 4ae53359d13..557bb1d51b3 100644 --- a/go/oasis-node/cmd/debug/storage/benchmark.go +++ b/go/oasis-node/cmd/debug/storage/benchmark.go @@ -17,10 +17,7 @@ import ( "github.com/oasisprotocol/oasis-core/go/common" "github.com/oasisprotocol/oasis-core/go/common/crypto/hash" - memorySigner "github.com/oasisprotocol/oasis-core/go/common/crypto/signature/signers/memory" - "github.com/oasisprotocol/oasis-core/go/common/identity" "github.com/oasisprotocol/oasis-core/go/common/logging" - genesisTests "github.com/oasisprotocol/oasis-core/go/genesis/tests" cmdCommon "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common" storageAPI "github.com/oasisprotocol/oasis-core/go/storage/api" "github.com/oasisprotocol/oasis-core/go/worker/storage" @@ -41,7 +38,7 @@ var ( storageBenchmarkFlags = flag.NewFlagSet("", flag.ContinueOnError) ) -func doBenchmark(cmd *cobra.Command, args []string) { // nolint: gocyclo +func doBenchmark(_ *cobra.Command, _ []string) { // nolint: gocyclo if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -68,19 +65,9 @@ func doBenchmark(cmd *cobra.Command, args []string) { // nolint: gocyclo defer os.RemoveAll(dataDir) } - // Create an identity. - genesisTests.SetTestChainContext() - ident, err := identity.LoadOrGenerate(dataDir, memorySigner.NewFactory()) - if err != nil { - logger.Error("failed to generate a new identity", - "err", err, - ) - return - } - var ns common.Namespace - storage, err := storage.NewLocalBackend(dataDir, ns, ident) + storage, err := storage.NewLocalBackend(dataDir, ns) if err != nil { logger.Error("failed to initialize storage", "err", err, diff --git a/go/oasis-node/cmd/debug/storage/export.go b/go/oasis-node/cmd/debug/storage/export.go index 469aaa02717..8ad848cbd04 100644 --- a/go/oasis-node/cmd/debug/storage/export.go +++ b/go/oasis-node/cmd/debug/storage/export.go @@ -36,7 +36,7 @@ var ( storageExportFlags = flag.NewFlagSet("", flag.ContinueOnError) ) -func doExport(cmd *cobra.Command, args []string) { +func doExport(*cobra.Command, []string) { var ok bool defer func() { if !ok { diff --git a/go/oasis-node/cmd/debug/txsource/txsource.go b/go/oasis-node/cmd/debug/txsource/txsource.go index 727c5de15f2..982f9c65da6 100644 --- a/go/oasis-node/cmd/debug/txsource/txsource.go +++ b/go/oasis-node/cmd/debug/txsource/txsource.go @@ -44,7 +44,7 @@ var ( } ) -func doRun(cmd *cobra.Command, args []string) error { +func doRun(cmd *cobra.Command, _ []string) error { cmd.SilenceUsage = true config.GlobalConfig.Common.Log.Level = make(map[string]string) diff --git a/go/oasis-node/cmd/debug/txsource/workload/commission.go b/go/oasis-node/cmd/debug/txsource/workload/commission.go index 9b140e53472..2709d950390 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/commission.go +++ b/go/oasis-node/cmd/debug/txsource/workload/commission.go @@ -348,7 +348,7 @@ func (c *commission) Run( cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ []signature.Signer, ) error { // Initialize base workload. c.BaseWorkload.Init(cnsc, sm, fundingAccount) diff --git a/go/oasis-node/cmd/debug/txsource/workload/delegation.go b/go/oasis-node/cmd/debug/txsource/workload/delegation.go index 4281fdcbe7d..f3279fb6979 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/delegation.go +++ b/go/oasis-node/cmd/debug/txsource/workload/delegation.go @@ -188,7 +188,7 @@ func (d *delegation) Run( cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ []signature.Signer, ) error { // Initialize base workload. d.BaseWorkload.Init(cnsc, sm, fundingAccount) diff --git a/go/oasis-node/cmd/debug/txsource/workload/governance.go b/go/oasis-node/cmd/debug/txsource/workload/governance.go index f5a2d4e76d6..df9e6465f11 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/governance.go +++ b/go/oasis-node/cmd/debug/txsource/workload/governance.go @@ -565,7 +565,7 @@ func (g *governanceWorkload) NeedsFunds() bool { func (g *governanceWorkload) Run( gracefulExit context.Context, rng *rand.Rand, - conn *grpc.ClientConn, + _ *grpc.ClientConn, cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, diff --git a/go/oasis-node/cmd/debug/txsource/workload/oversized.go b/go/oasis-node/cmd/debug/txsource/workload/oversized.go index d9efc085923..8e91f082fdd 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/oversized.go +++ b/go/oasis-node/cmd/debug/txsource/workload/oversized.go @@ -41,11 +41,11 @@ func (*oversized) NeedsFunds() bool { func (o *oversized) Run( gracefulExit context.Context, rng *rand.Rand, - conn *grpc.ClientConn, + _ *grpc.ClientConn, cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ []signature.Signer, ) error { // Initialize base workload. o.BaseWorkload.Init(cnsc, sm, fundingAccount) diff --git a/go/oasis-node/cmd/debug/txsource/workload/parallel.go b/go/oasis-node/cmd/debug/txsource/workload/parallel.go index 1acb1c6e49b..d885772466f 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/parallel.go +++ b/go/oasis-node/cmd/debug/txsource/workload/parallel.go @@ -48,11 +48,11 @@ func (p *parallel) NeedsFunds() bool { func (p *parallel) Run( gracefulExit context.Context, rng *rand.Rand, - conn *grpc.ClientConn, + _ *grpc.ClientConn, cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ []signature.Signer, ) error { // Initialize base workload. p.BaseWorkload.Init(cnsc, sm, fundingAccount) diff --git a/go/oasis-node/cmd/debug/txsource/workload/queries.go b/go/oasis-node/cmd/debug/txsource/workload/queries.go index e685cec0132..3bc1005f573 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/queries.go +++ b/go/oasis-node/cmd/debug/txsource/workload/queries.go @@ -315,7 +315,7 @@ func (q *queries) doConsensusQueries(ctx context.Context, rng *rand.Rand, height // doSchedulerQueries does GetCommittees and GetValidator queries for the // provided height. -func (q *queries) doSchedulerQueries(ctx context.Context, rng *rand.Rand, height int64) error { +func (q *queries) doSchedulerQueries(ctx context.Context, _ *rand.Rand, height int64) error { q.logger.Debug("doing scheduler queries", "height", height, ) @@ -367,7 +367,7 @@ func (q *queries) doSchedulerQueries(ctx context.Context, rng *rand.Rand, height } // doRegistryQueries does registry queries for the provided height. -func (q *queries) doRegistryQueries(ctx context.Context, rng *rand.Rand, height int64) error { +func (q *queries) doRegistryQueries(ctx context.Context, height int64) error { q.logger.Debug("doing registry queries", "height", height, ) @@ -623,7 +623,7 @@ func (q *queries) doStakingQueries(ctx context.Context, rng *rand.Rand, height i } // doGovernanceQueries does governance queries at the provided height. -func (q *queries) doGovernanceQueries(ctx context.Context, rng *rand.Rand, height int64) error { +func (q *queries) doGovernanceQueries(ctx context.Context, _ *rand.Rand, height int64) error { q.logger.Debug("doing governance queries", "height", height, ) @@ -725,7 +725,7 @@ func (q *queries) doRuntimeQueries(ctx context.Context, rng *rand.Rand) error { return nil } -func (q *queries) doControlQueries(ctx context.Context, rng *rand.Rand) error { +func (q *queries) doControlQueries(ctx context.Context, _ *rand.Rand) error { q.logger.Debug("doing node control queries") _, err := q.control.GetStatus(ctx) @@ -780,7 +780,7 @@ func (q *queries) doQueries(ctx context.Context, rng *rand.Rand) error { if err := q.doSchedulerQueries(ctx, rng, height); err != nil { return fmt.Errorf("scheduler queries error: %w", err) } - if err := q.doRegistryQueries(ctx, rng, height); err != nil { + if err := q.doRegistryQueries(ctx, height); err != nil { return fmt.Errorf("registry queries error: %w", err) } if err := q.doStakingQueries(ctx, rng, height); err != nil { @@ -814,9 +814,9 @@ func (q *queries) Run( rng *rand.Rand, conn *grpc.ClientConn, cnsc consensus.ClientBackend, - sm consensus.SubmissionManager, - fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ consensus.SubmissionManager, + _ signature.Signer, + _ []signature.Signer, ) error { var err error ctx := context.Background() diff --git a/go/oasis-node/cmd/debug/txsource/workload/registration.go b/go/oasis-node/cmd/debug/txsource/workload/registration.go index a96c6ae53f0..f00a70379ee 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/registration.go +++ b/go/oasis-node/cmd/debug/txsource/workload/registration.go @@ -165,7 +165,7 @@ func (r *registration) Run( // nolint: gocyclo cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ []signature.Signer, ) error { // Initialize base workload. r.BaseWorkload.Init(cnsc, sm, fundingAccount) diff --git a/go/oasis-node/cmd/debug/txsource/workload/runtime.go b/go/oasis-node/cmd/debug/txsource/workload/runtime.go index 61ce3af845d..12d027682ee 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/runtime.go +++ b/go/oasis-node/cmd/debug/txsource/workload/runtime.go @@ -377,7 +377,7 @@ func (r *runtime) doRemoveRequest(ctx context.Context, rng *rand.Rand, rtc runti return nil } -func (r *runtime) doInMsgRequest(ctx context.Context, rng *rand.Rand, rtc runtimeClient.RuntimeClient) error { +func (r *runtime) doInMsgRequest(ctx context.Context, rng *rand.Rand, _ runtimeClient.RuntimeClient) error { key := r.generateVal(rng, false) value := r.generateVal(rng, false) @@ -782,7 +782,7 @@ func (r *runtime) Run( cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ []signature.Signer, ) error { // Initialize base workload. r.BaseWorkload.Init(cnsc, sm, fundingAccount) diff --git a/go/oasis-node/cmd/debug/txsource/workload/transfer.go b/go/oasis-node/cmd/debug/txsource/workload/transfer.go index 38db31c3a1d..b802c6866f3 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/transfer.go +++ b/go/oasis-node/cmd/debug/txsource/workload/transfer.go @@ -251,7 +251,7 @@ func (t *transfer) Run( cnsc consensus.ClientBackend, sm consensus.SubmissionManager, fundingAccount signature.Signer, - validatorEntities []signature.Signer, + _ []signature.Signer, ) error { // Initialize base workload. t.BaseWorkload.Init(cnsc, sm, fundingAccount) diff --git a/go/oasis-node/cmd/genesis/genesis.go b/go/oasis-node/cmd/genesis/genesis.go index ebc6c99800d..bb57a700f34 100644 --- a/go/oasis-node/cmd/genesis/genesis.go +++ b/go/oasis-node/cmd/genesis/genesis.go @@ -152,7 +152,7 @@ var ( logger = logging.GetLogger("cmd/genesis") ) -func doInitGenesis(cmd *cobra.Command, args []string) { +func doInitGenesis(*cobra.Command, []string) { var ok bool defer func() { if !ok { @@ -626,7 +626,7 @@ func appendStakingState(doc *genesis.Document, statePath string) error { return nil } -func doDumpGenesis(cmd *cobra.Command, args []string) { +func doDumpGenesis(cmd *cobra.Command, _ []string) { ctx := context.Background() if err := cmdCommon.Init(); err != nil { @@ -685,7 +685,7 @@ func doDumpGenesis(cmd *cobra.Command, args []string) { } } -func doCheckGenesis(cmd *cobra.Command, args []string) { +func doCheckGenesis(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/governance/governance.go b/go/oasis-node/cmd/governance/governance.go index 402b9a4248b..f492d58b84f 100644 --- a/go/oasis-node/cmd/governance/governance.go +++ b/go/oasis-node/cmd/governance/governance.go @@ -95,7 +95,7 @@ func doConnect(cmd *cobra.Command) (*grpc.ClientConn, governance.Backend) { return conn, client } -func doGenSubmitProposal(cmd *cobra.Command, args []string) { +func doGenSubmitProposal(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -152,7 +152,7 @@ func doGenSubmitProposal(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doGenCastVote(cmd *cobra.Command, args []string) { +func doGenCastVote(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -182,7 +182,7 @@ func doGenCastVote(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doProposalInfo(cmd *cobra.Command, args []string) { +func doProposalInfo(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -213,7 +213,7 @@ func doProposalInfo(cmd *cobra.Command, args []string) { fmt.Println(string(prettyProposal)) } -func doProposalVotes(cmd *cobra.Command, args []string) { +func doProposalVotes(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -244,7 +244,7 @@ func doProposalVotes(cmd *cobra.Command, args []string) { fmt.Println(string(prettyVotes)) } -func doListProposals(cmd *cobra.Command, args []string) { +func doListProposals(cmd *cobra.Command, _ []string) { var err error if err = cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) diff --git a/go/oasis-node/cmd/ias/auth_registry.go b/go/oasis-node/cmd/ias/auth_registry.go index d75cd232517..bd0ffe27a41 100644 --- a/go/oasis-node/cmd/ias/auth_registry.go +++ b/go/oasis-node/cmd/ias/auth_registry.go @@ -34,7 +34,7 @@ type registryAuthenticator struct { initCh chan struct{} } -func (auth *registryAuthenticator) VerifyEvidence(ctx context.Context, evidence *ias.Evidence) error { +func (auth *registryAuthenticator) VerifyEvidence(evidence *ias.Evidence) error { <-auth.initCh // TODO: This could/should do something clever with respect to verifying diff --git a/go/oasis-node/cmd/ias/proxy.go b/go/oasis-node/cmd/ias/proxy.go index af7b98d8104..bd4b42b921d 100644 --- a/go/oasis-node/cmd/ias/proxy.go +++ b/go/oasis-node/cmd/ias/proxy.go @@ -76,7 +76,7 @@ func TLSCertPaths(dataDir string) (string, string) { return certPath, keyPath } -func doProxy(cmd *cobra.Command, args []string) { +func doProxy(cmd *cobra.Command, _ []string) { var startOk bool defer func() { if !startOk { diff --git a/go/oasis-node/cmd/identity/cometbft/cometbft.go b/go/oasis-node/cmd/identity/cometbft/cometbft.go index 5059a2b6f6a..0534ed99a58 100644 --- a/go/oasis-node/cmd/identity/cometbft/cometbft.go +++ b/go/oasis-node/cmd/identity/cometbft/cometbft.go @@ -81,12 +81,12 @@ func printTmAddress(desc, keyFile string) { } } -func showNodeAddress(cmd *cobra.Command, args []string) { +func showNodeAddress(cmd *cobra.Command, _ []string) { desc := strings.TrimPrefix(cmd.Short, "outputs ") printTmAddress(desc, identity.P2PKeyPubFilename) } -func showConsensusAddress(cmd *cobra.Command, args []string) { +func showConsensusAddress(cmd *cobra.Command, _ []string) { desc := strings.TrimPrefix(cmd.Short, "outputs ") printTmAddress(desc, identity.ConsensusKeyPubFilename) } diff --git a/go/oasis-node/cmd/identity/identity.go b/go/oasis-node/cmd/identity/identity.go index 8d5d3de0620..801179b6ea6 100644 --- a/go/oasis-node/cmd/identity/identity.go +++ b/go/oasis-node/cmd/identity/identity.go @@ -51,7 +51,7 @@ var ( logger = logging.GetLogger("cmd/identity") ) -func doNodeInit(cmd *cobra.Command, args []string) { +func doNodeInit(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -83,7 +83,7 @@ func doNodeInit(cmd *cobra.Command, args []string) { fmt.Printf("Generated identity files in: %s\n", dataDir) } -func doShowPubkey(cmd *cobra.Command, args []string, sentry bool) { +func doShowPubkey(_ *cobra.Command, _ []string, sentry bool) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/keymanager/keymanager.go b/go/oasis-node/cmd/keymanager/keymanager.go index 26c65dfb874..42d306f52b2 100644 --- a/go/oasis-node/cmd/keymanager/keymanager.go +++ b/go/oasis-node/cmd/keymanager/keymanager.go @@ -92,7 +92,7 @@ var ( logger = logging.GetLogger("cmd/keymanager") ) -func doInitPolicy(cmd *cobra.Command, args []string) { +func doInitPolicy(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -213,7 +213,7 @@ func policyFromFlags() (*kmApi.PolicySGX, error) { }, nil } -func doSignPolicy(cmd *cobra.Command, args []string) { +func doSignPolicy(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -292,7 +292,7 @@ func signPolicyFromFlags() (*signature.Signature, error) { }, nil } -func doVerifyPolicy(cmd *cobra.Command, args []string) { +func doVerifyPolicy(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -368,7 +368,7 @@ func unmarshalPolicyCBOR(pb []byte) (*kmApi.PolicySGX, error) { return p, nil } -func doInitStatus(cmd *cobra.Command, args []string) { +func doInitStatus(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -401,7 +401,7 @@ func doInitStatus(cmd *cobra.Command, args []string) { ) } -func doGenUpdate(cmd *cobra.Command, args []string) { +func doGenUpdate(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/node/node.go b/go/oasis-node/cmd/node/node.go index cddb0b12898..889e92c2b80 100644 --- a/go/oasis-node/cmd/node/node.go +++ b/go/oasis-node/cmd/node/node.go @@ -174,7 +174,7 @@ func (n *Node) startRuntimeServices() error { "epoch", epoch, "block_height", blockHeight, ) - if err = n.dumpGenesis(ctx, blockHeight, epoch); err != nil { + if err = n.dumpGenesis(ctx, blockHeight); err != nil { n.logger.Error("halt hook: failed to dump genesis", "err", err, ) @@ -256,7 +256,6 @@ func (n *Node) initRuntimeWorkers() error { // Initialize the registration worker. n.RegistrationWorker, err = registration.New( - n.dataDir, n.Consensus.Beacon(), n.Consensus.Registry(), n.Identity, @@ -282,7 +281,6 @@ func (n *Node) initRuntimeWorkers() error { n.BeaconWorker, err = workerBeacon.New( n.Identity, n.Consensus, - n.commonStore, n.RegistrationWorker, ) if err != nil { @@ -295,7 +293,6 @@ func (n *Node) initRuntimeWorkers() error { n.grpcInternal, n.CommonWorker, n.RegistrationWorker, - n.Genesis, ) if err != nil { return err @@ -305,7 +302,6 @@ func (n *Node) initRuntimeWorkers() error { // Initialize the key manager worker. n.KeymanagerWorker, err = workerKeymanager.New( n.CommonWorker, - n.IAS, n.RegistrationWorker, n.Consensus.KeyManager(), ) @@ -332,7 +328,7 @@ func (n *Node) initRuntimeWorkers() error { n.svcMgr.Register(n.ClientWorker) // Commit storage settings to the registered runtimes. - err = n.RuntimeRegistry.FinishInitialization(n.svcMgr.Ctx) + err = n.RuntimeRegistry.FinishInitialization() if err != nil { return err } @@ -397,7 +393,7 @@ func (n *Node) startRuntimeWorkers() error { return nil } -func (n *Node) dumpGenesis(ctx context.Context, blockHeight int64, epoch beacon.EpochTime) error { +func (n *Node) dumpGenesis(ctx context.Context, blockHeight int64) error { doc, err := n.Consensus.StateToGenesis(ctx, blockHeight) if err != nil { return fmt.Errorf("dumpGenesis: failed to get genesis: %w", err) diff --git a/go/oasis-node/cmd/node/node_control.go b/go/oasis-node/cmd/node/node_control.go index 4d1b4608a1f..44385e0a521 100644 --- a/go/oasis-node/cmd/node/node_control.go +++ b/go/oasis-node/cmd/node/node_control.go @@ -104,13 +104,13 @@ func (n *Node) IsSynced(ctx context.Context) (bool, error) { } // UpgradeBinary implements control.NodeController. -func (n *Node) UpgradeBinary(ctx context.Context, descriptor *upgrade.Descriptor) error { - return n.Upgrader.SubmitDescriptor(ctx, descriptor) +func (n *Node) UpgradeBinary(_ context.Context, descriptor *upgrade.Descriptor) error { + return n.Upgrader.SubmitDescriptor(descriptor) } // CancelUpgrade implements control.NodeController. -func (n *Node) CancelUpgrade(ctx context.Context, descriptor *upgrade.Descriptor) error { - return n.Upgrader.CancelUpgrade(ctx, descriptor) +func (n *Node) CancelUpgrade(_ context.Context, descriptor *upgrade.Descriptor) error { + return n.Upgrader.CancelUpgrade(descriptor) } // GetStatus implements control.NodeController. @@ -120,7 +120,7 @@ func (n *Node) GetStatus(ctx context.Context) (*control.Status, error) { return nil, fmt.Errorf("failed to get consensus status: %w", err) } - lcs, err := n.getLightClientStatus(ctx) + lcs, err := n.getLightClientStatus() if err != nil { return nil, fmt.Errorf("failed to get light client status: %w", err) } @@ -135,12 +135,12 @@ func (n *Node) GetStatus(ctx context.Context) (*control.Status, error) { return nil, fmt.Errorf("failed to get runtime status: %w", err) } - kms, err := n.getKeymanagerStatus(ctx) + kms, err := n.getKeymanagerStatus() if err != nil { return nil, fmt.Errorf("failed to get key manager worker status: %w", err) } - pendingUpgrades, err := n.getPendingUpgrades(ctx) + pendingUpgrades, err := n.getPendingUpgrades() if err != nil { return nil, fmt.Errorf("failed to get pending upgrades: %w", err) } @@ -183,8 +183,8 @@ func (n *Node) getConsensusStatus(ctx context.Context) (*consensus.Status, error return n.Consensus.GetStatus(ctx) } -func (n *Node) getLightClientStatus(ctx context.Context) (*consensus.LightClientStatus, error) { - return n.LightClient.GetStatus(ctx) +func (n *Node) getLightClientStatus() (*consensus.LightClientStatus, error) { + return n.LightClient.GetStatus() } func (n *Node) getRegistrationStatus(ctx context.Context) (*control.RegistrationStatus, error) { @@ -300,7 +300,7 @@ func (n *Node) getRuntimeStatus(ctx context.Context) (map[common.Namespace]contr // Fetch common committee worker status. if rtNode := n.CommonWorker.GetRuntime(rt.ID()); rtNode != nil { - status.Committee, err = rtNode.GetStatus(ctx) + status.Committee, err = rtNode.GetStatus() if err != nil { n.logger.Error("failed to fetch common committee worker status", "err", err, @@ -311,7 +311,7 @@ func (n *Node) getRuntimeStatus(ctx context.Context) (map[common.Namespace]contr // Fetch executor worker status. if execNode := n.ExecutorWorker.GetRuntime(rt.ID()); execNode != nil { - status.Executor, err = execNode.GetStatus(ctx) + status.Executor, err = execNode.GetStatus() if err != nil { n.logger.Error("failed to fetch executor worker status", "err", err, @@ -349,15 +349,15 @@ func (n *Node) getRuntimeStatus(ctx context.Context) (map[common.Namespace]contr return runtimes, nil } -func (n *Node) getKeymanagerStatus(ctx context.Context) (*keymanagerWorker.Status, error) { +func (n *Node) getKeymanagerStatus() (*keymanagerWorker.Status, error) { if n.KeymanagerWorker == nil || !n.KeymanagerWorker.Enabled() { return nil, nil } - return n.KeymanagerWorker.GetStatus(ctx) + return n.KeymanagerWorker.GetStatus() } -func (n *Node) getPendingUpgrades(ctx context.Context) ([]*upgrade.PendingUpgrade, error) { - return n.Upgrader.PendingUpgrades(ctx) +func (n *Node) getPendingUpgrades() ([]*upgrade.PendingUpgrade, error) { + return n.Upgrader.PendingUpgrades() } func (n *Node) getP2PStatus() *p2p.Status { diff --git a/go/oasis-node/cmd/node/run.go b/go/oasis-node/cmd/node/run.go index eb623c61ab8..959461cebb9 100644 --- a/go/oasis-node/cmd/node/run.go +++ b/go/oasis-node/cmd/node/run.go @@ -18,7 +18,7 @@ type runnableNode interface { } // Run runs the Oasis node. -func Run(cmd *cobra.Command, args []string) { +func Run(_ *cobra.Command, _ []string) { cmdCommon.SetIsNodeCmd(true) var ( diff --git a/go/oasis-node/cmd/node/seed_control.go b/go/oasis-node/cmd/node/seed_control.go index 8078067fb86..9bfeb843822 100644 --- a/go/oasis-node/cmd/node/seed_control.go +++ b/go/oasis-node/cmd/node/seed_control.go @@ -12,43 +12,43 @@ import ( var _ control.NodeController = (*SeedNode)(nil) // RequestShutdown implements control.NodeController. -func (n *SeedNode) RequestShutdown(ctx context.Context, wait bool) error { +func (n *SeedNode) RequestShutdown(context.Context, bool) error { n.Stop() return nil } // WaitReady implements control.NodeController. -func (n *SeedNode) WaitReady(ctx context.Context) error { +func (n *SeedNode) WaitReady(context.Context) error { return control.ErrNotImplemented } // IsReady implements control.NodeController. -func (n *SeedNode) IsReady(ctx context.Context) (bool, error) { +func (n *SeedNode) IsReady(context.Context) (bool, error) { return false, control.ErrNotImplemented } // WaitSync implements control.NodeController. -func (n *SeedNode) WaitSync(ctx context.Context) error { +func (n *SeedNode) WaitSync(context.Context) error { return control.ErrNotImplemented } // IsSynced implements control.NodeController. -func (n *SeedNode) IsSynced(ctx context.Context) (bool, error) { +func (n *SeedNode) IsSynced(context.Context) (bool, error) { return false, control.ErrNotImplemented } // UpgradeBinary implements control.NodeController. -func (n *SeedNode) UpgradeBinary(ctx context.Context, descriptor *upgrade.Descriptor) error { +func (n *SeedNode) UpgradeBinary(context.Context, *upgrade.Descriptor) error { return control.ErrNotImplemented } // CancelUpgrade implements control.NodeController. -func (n *SeedNode) CancelUpgrade(ctx context.Context, descriptor *upgrade.Descriptor) error { +func (n *SeedNode) CancelUpgrade(context.Context, *upgrade.Descriptor) error { return control.ErrNotImplemented } // GetStatus implements control.NodeController. -func (n *SeedNode) GetStatus(ctx context.Context) (*control.Status, error) { +func (n *SeedNode) GetStatus(_ context.Context) (*control.Status, error) { tmAddresses, err := n.cometbftSeed.GetAddresses() if err != nil { return nil, err diff --git a/go/oasis-node/cmd/node/unsafe_reset.go b/go/oasis-node/cmd/node/unsafe_reset.go index 9a4a5608523..4afb61433a1 100644 --- a/go/oasis-node/cmd/node/unsafe_reset.go +++ b/go/oasis-node/cmd/node/unsafe_reset.go @@ -53,7 +53,7 @@ var ( logger = logging.GetLogger("cmd/unsafe-reset") ) -func doUnsafeReset(cmd *cobra.Command, args []string) { +func doUnsafeReset(*cobra.Command, []string) { var ok bool defer func() { if !ok { diff --git a/go/oasis-node/cmd/registry/entity/entity.go b/go/oasis-node/cmd/registry/entity/entity.go index 48c173eba2d..d84b4855e1b 100644 --- a/go/oasis-node/cmd/registry/entity/entity.go +++ b/go/oasis-node/cmd/registry/entity/entity.go @@ -94,7 +94,7 @@ func doConnect(cmd *cobra.Command) (*grpc.ClientConn, registry.Backend) { return conn, client } -func doInit(cmd *cobra.Command, args []string) { +func doInit(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -143,7 +143,7 @@ func doInit(cmd *cobra.Command, args []string) { ) } -func doUpdate(cmd *cobra.Command, args []string) { +func doUpdate(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -280,7 +280,7 @@ func signAndWriteEntityGenesis(dataDir string, signer signature.Signer, ent *ent return nil } -func doGenRegister(cmd *cobra.Command, args []string) { +func doGenRegister(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -311,7 +311,7 @@ func doGenRegister(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, signer) } -func doGenDeregister(cmd *cobra.Command, args []string) { +func doGenDeregister(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -325,7 +325,7 @@ func doGenDeregister(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doList(cmd *cobra.Command, args []string) { +func doList(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/registry/node/node.go b/go/oasis-node/cmd/registry/node/node.go index b638b567973..3f22d0443ed 100644 --- a/go/oasis-node/cmd/registry/node/node.go +++ b/go/oasis-node/cmd/registry/node/node.go @@ -89,7 +89,7 @@ func doConnect(cmd *cobra.Command) (*grpc.ClientConn, registry.Backend) { return conn, client } -func doInit(cmd *cobra.Command, args []string) { // nolint: gocyclo +func doInit(*cobra.Command, []string) { // nolint: gocyclo if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -271,7 +271,7 @@ func argsToRolesMask() (node.RolesMask, error) { return rolesMask, nil } -func doList(cmd *cobra.Command, args []string) { +func doList(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -309,7 +309,7 @@ func doList(cmd *cobra.Command, args []string) { } } -func doIsRegistered(cmd *cobra.Command, args []string) { +func doIsRegistered(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/registry/runtime/runtime.go b/go/oasis-node/cmd/registry/runtime/runtime.go index d5450516e6d..18dda8d977c 100644 --- a/go/oasis-node/cmd/registry/runtime/runtime.go +++ b/go/oasis-node/cmd/registry/runtime/runtime.go @@ -68,7 +68,7 @@ func doConnect(cmd *cobra.Command) (*grpc.ClientConn, registry.Backend) { return conn, client } -func doGenRegister(cmd *cobra.Command, args []string) { +func doGenRegister(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -111,7 +111,7 @@ func doGenRegister(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doList(cmd *cobra.Command, args []string) { +func doList(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/signer/signer.go b/go/oasis-node/cmd/signer/signer.go index 2404dc546ec..f6d22a13f25 100644 --- a/go/oasis-node/cmd/signer/signer.go +++ b/go/oasis-node/cmd/signer/signer.go @@ -26,7 +26,7 @@ var ( logger = logging.GetLogger("cmd/signer") ) -func doExport(cmd *cobra.Command, args []string) { +func doExport(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/stake/account.go b/go/oasis-node/cmd/stake/account.go index 494b56c29dc..e7302007715 100644 --- a/go/oasis-node/cmd/stake/account.go +++ b/go/oasis-node/cmd/stake/account.go @@ -133,7 +133,7 @@ var ( } ) -func doAccountInfo(cmd *cobra.Command, args []string) { +func doAccountInfo(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -216,7 +216,7 @@ func doAccountInfo(cmd *cobra.Command, args []string) { fmt.Printf("Nonce: %d\n", acct.General.Nonce) } -func doAccountNonce(cmd *cobra.Command, args []string) { +func doAccountNonce(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -239,7 +239,7 @@ func doAccountNonce(cmd *cobra.Command, args []string) { fmt.Println(acct.General.Nonce) } -func doValidateAddress(cmd *cobra.Command, args []string) { +func doValidateAddress(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -262,7 +262,7 @@ func doValidateAddress(cmd *cobra.Command, args []string) { } } -func doAccountTransfer(cmd *cobra.Command, args []string) { +func doAccountTransfer(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -290,7 +290,7 @@ func doAccountTransfer(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doAccountBurn(cmd *cobra.Command, args []string) { +func doAccountBurn(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -312,7 +312,7 @@ func doAccountBurn(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doAccountEscrow(cmd *cobra.Command, args []string) { +func doAccountEscrow(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -340,7 +340,7 @@ func doAccountEscrow(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doAccountReclaimEscrow(cmd *cobra.Command, args []string) { +func doAccountReclaimEscrow(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -402,7 +402,7 @@ func scanBoundStep(dst *api.CommissionRateBoundStep, raw string) error { return nil } -func doAccountAmendCommissionSchedule(cmd *cobra.Command, args []string) { +func doAccountAmendCommissionSchedule(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -446,7 +446,7 @@ func doAccountAmendCommissionSchedule(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doAccountAllow(cmd *cobra.Command, args []string) { +func doAccountAllow(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -483,7 +483,7 @@ func doAccountAllow(cmd *cobra.Command, args []string) { cmdConsensus.SignAndSaveTx(cmdContext.GetCtxWithGenesisInfo(genesis), tx, nil) } -func doAccountWithdraw(cmd *cobra.Command, args []string) { +func doAccountWithdraw(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/stake/stake.go b/go/oasis-node/cmd/stake/stake.go index 4793332b65c..342756df34b 100644 --- a/go/oasis-node/cmd/stake/stake.go +++ b/go/oasis-node/cmd/stake/stake.go @@ -172,7 +172,7 @@ func getDebondingDelegationsTo( return delegations } -func doInfo(cmd *cobra.Command, args []string) { +func doInfo(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -260,7 +260,7 @@ func doInfo(cmd *cobra.Command, args []string) { } } -func doList(cmd *cobra.Command, args []string) { +func doList(cmd *cobra.Command, _ []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } @@ -306,7 +306,7 @@ func doList(cmd *cobra.Command, args []string) { } } -func doPubkey2Address(cmd *cobra.Command, args []string) { +func doPubkey2Address(*cobra.Command, []string) { if err := cmdCommon.Init(); err != nil { cmdCommon.EarlyLogAndExit(err) } diff --git a/go/oasis-node/cmd/storage/storage.go b/go/oasis-node/cmd/storage/storage.go index e505a824757..19fbd00a639 100644 --- a/go/oasis-node/cmd/storage/storage.go +++ b/go/oasis-node/cmd/storage/storage.go @@ -150,7 +150,7 @@ func parseRuntimes(args []string) ([]common.Namespace, error) { return runtimes, nil } -func doMigrate(cmd *cobra.Command, args []string) error { +func doMigrate(_ *cobra.Command, args []string) error { dataDir := cmdCommon.DataDir() ctx := context.Background() @@ -199,7 +199,7 @@ func doMigrate(cmd *cobra.Command, args []string) error { return nil } -func doCheck(cmd *cobra.Command, args []string) error { +func doCheck(_ *cobra.Command, args []string) error { dataDir := cmdCommon.DataDir() ctx := context.Background() @@ -238,7 +238,7 @@ func doCheck(cmd *cobra.Command, args []string) error { return nil } -func doRenameNs(cmd *cobra.Command, args []string) error { +func doRenameNs(_ *cobra.Command, args []string) error { dataDir := cmdCommon.DataDir() if len(args) != 2 { diff --git a/go/oasis-node/node_test.go b/go/oasis-node/node_test.go index 0161375952a..7b6a9475365 100644 --- a/go/oasis-node/node_test.go +++ b/go/oasis-node/node_test.go @@ -324,12 +324,12 @@ func testBeacon(t *testing.T, node *testNode) { beaconTests.BeaconImplementationTests(t, timeSource) } -func testStorage(t *testing.T, node *testNode) { +func testStorage(t *testing.T, _ *testNode) { dataDir, err := os.MkdirTemp("", "oasis-storage-test_") require.NoError(t, err, "TempDir") defer os.RemoveAll(dataDir) - backend, err := storageWorker.NewLocalBackend(dataDir, testRuntimeID, node.Identity) + backend, err := storageWorker.NewLocalBackend(dataDir, testRuntimeID) require.NoError(t, err, "storage.New") defer backend.Cleanup() @@ -356,7 +356,7 @@ func testSchedulerClient(t *testing.T, node *testNode) { } func testStaking(t *testing.T, node *testNode) { - stakingTests.StakingImplementationTests(t, node.Consensus.Staking(), node.Consensus, node.Identity, node.entity, node.entitySigner, testRuntimeID) + stakingTests.StakingImplementationTests(t, node.Consensus.Staking(), node.Consensus, node.Identity, node.entity, testRuntimeID) } func testStakingClient(t *testing.T, node *testNode) { diff --git a/go/oasis-remote-signer/cmd/root.go b/go/oasis-remote-signer/cmd/root.go index 5425e03622d..3f76261d359 100644 --- a/go/oasis-remote-signer/cmd/root.go +++ b/go/oasis-remote-signer/cmd/root.go @@ -82,7 +82,7 @@ func ensureDataDir() (string, error) { return dataDir, nil } -func doServerInit(cmd *cobra.Command, args []string) { +func doServerInit(*cobra.Command, []string) { if _, _, err := serverInit(true); err != nil { logger.Error("failed to initialize server keys", "err", err, @@ -133,7 +133,7 @@ func serverInit(provisionKeys bool) (signature.SignerFactory, *goTls.Certificate return sf, cert, nil } -func doClientInit(cmd *cobra.Command, args []string) { +func doClientInit(*cobra.Command, []string) { if err := func() error { dataDir, err := ensureDataDir() if err != nil { @@ -154,7 +154,7 @@ func doClientInit(cmd *cobra.Command, args []string) { } } -func runRoot(cmd *cobra.Command, args []string) error { +func runRoot(*cobra.Command, []string) error { // Initialize all of the server keys. sf, cert, err := serverInit(false) if err != nil { diff --git a/go/oasis-test-runner/cmd/cmp/cmp.go b/go/oasis-test-runner/cmd/cmp/cmp.go index 14a315a0164..08c60506b27 100644 --- a/go/oasis-test-runner/cmd/cmp/cmp.go +++ b/go/oasis-test-runner/cmd/cmp/cmp.go @@ -522,7 +522,7 @@ func initCmpLogger() error { return nil } -func runCmp(cmd *cobra.Command, args []string) { +func runCmp(cmd *cobra.Command, _ []string) { if err := initCmpLogger(); err != nil { fmt.Println(err) os.Exit(1) diff --git a/go/oasis-test-runner/cmd/root.go b/go/oasis-test-runner/cmd/root.go index 9f862f44d25..2f3c02843da 100644 --- a/go/oasis-test-runner/cmd/root.go +++ b/go/oasis-test-runner/cmd/root.go @@ -271,7 +271,7 @@ func initRootEnv(cmd *cobra.Command) (*env.Env, error) { return env, nil } -func runRoot(cmd *cobra.Command, args []string) error { // nolint: gocyclo +func runRoot(cmd *cobra.Command, _ []string) error { // nolint: gocyclo cmd.SilenceUsage = true // Workaround for viper bug: https://github.com/spf13/viper/issues/233 @@ -487,7 +487,7 @@ func doScenario(ctx context.Context, childEnv *env.Env, sc scenario.Scenario) (e } }() - if err = sc.PreInit(childEnv); err != nil { + if err = sc.PreInit(); err != nil { err = fmt.Errorf("root: failed to pre-initialize scenario: %w", err) return } @@ -565,7 +565,7 @@ func doCleanup(childEnv *env.Env) (err error) { return } -func runList(cmd *cobra.Command, args []string) { +func runList(*cobra.Command, []string) { scNames := common.GetScenarioNames() switch len(scNames) { case 0: diff --git a/go/oasis-test-runner/log/handlers.go b/go/oasis-test-runner/log/handlers.go index 80b1f7397dd..e0718a31b78 100644 --- a/go/oasis-test-runner/log/handlers.go +++ b/go/oasis-test-runner/log/handlers.go @@ -29,7 +29,7 @@ func (a *assertBase) String() string { type assertBaseHandler assertBase -func (h *assertBaseHandler) Line(line string) error { +func (h *assertBaseHandler) Line(string) error { return nil } diff --git a/go/oasis-test-runner/oasis/args.go b/go/oasis-test-runner/oasis/args.go index 01ae1038873..638e28c57c9 100644 --- a/go/oasis-test-runner/oasis/args.go +++ b/go/oasis-test-runner/oasis/args.go @@ -136,7 +136,7 @@ func (args *argBuilder) appendDebugTestEntity() *argBuilder { return args } -func (args *argBuilder) appendNetwork(net *Network) *argBuilder { +func (args *argBuilder) appendNetwork(*Network) *argBuilder { args = args.grpcLogDebug() return args } @@ -171,7 +171,7 @@ func (args *argBuilder) byzantineRuntimeID(runtimeID common.Namespace) *argBuild return args } -func (args *argBuilder) merge(configDir string) []string { +func (args *argBuilder) merge(string) []string { output := []string{} shipped := map[string][]string{} multiValued := map[string][][]string{} diff --git a/go/oasis-test-runner/oasis/cli/cli.go b/go/oasis-test-runner/oasis/cli/cli.go index 4eae8fb955d..938a9823e03 100644 --- a/go/oasis-test-runner/oasis/cli/cli.go +++ b/go/oasis-test-runner/oasis/cli/cli.go @@ -99,7 +99,7 @@ func (h *Helpers) UnsafeReset(dataDir string, preserveRuntimeStorage, preserveLo // StartSubCommand launches an oasis-node subcommand. // // It does not wait for the subcommand to complete. -func StartSubCommand(childEnv *env.Env, logger *logging.Logger, name, binary string, args []string, stdout, stderr io.Writer) (*exec.Cmd, error) { +func StartSubCommand(_ *env.Env, logger *logging.Logger, _, binary string, args []string, stdout, stderr io.Writer) (*exec.Cmd, error) { cmd := exec.Command(binary, args...) cmd.SysProcAttr = env.CmdAttrs cmd.Stdout = stdout diff --git a/go/oasis-test-runner/oasis/seed.go b/go/oasis-test-runner/oasis/seed.go index 91b2bae56d5..5c1156bbdd8 100644 --- a/go/oasis-test-runner/oasis/seed.go +++ b/go/oasis-test-runner/oasis/seed.go @@ -26,7 +26,7 @@ type Seed struct { // nolint: maligned libp2pSeedPort uint16 } -func (seed *Seed) AddArgs(args *argBuilder) error { +func (seed *Seed) AddArgs(*argBuilder) error { return nil } diff --git a/go/oasis-test-runner/scenario/e2e/byzantine_beacon_vrf.go b/go/oasis-test-runner/scenario/e2e/byzantine_beacon_vrf.go index 59a54067997..d610dad5c19 100644 --- a/go/oasis-test-runner/scenario/e2e/byzantine_beacon_vrf.go +++ b/go/oasis-test-runner/scenario/e2e/byzantine_beacon_vrf.go @@ -93,7 +93,7 @@ func (sc *byzantineVRFBeaconImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *byzantineVRFBeaconImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *byzantineVRFBeaconImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/change_reward_schedule.go b/go/oasis-test-runner/scenario/e2e/change_reward_schedule.go index cbdf8191120..a350e3cef84 100644 --- a/go/oasis-test-runner/scenario/e2e/change_reward_schedule.go +++ b/go/oasis-test-runner/scenario/e2e/change_reward_schedule.go @@ -214,7 +214,7 @@ func (sc *changeRewardScheduleImpl) fetchEscrowBalance(owner staking.Address) (* return &a.Escrow.Active.Balance, nil } -func (sc *changeRewardScheduleImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *changeRewardScheduleImpl) Run(ctx context.Context, _ *env.Env) error { sc.ctx = ctx if err := sc.Net.Start(); err != nil { diff --git a/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go b/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go index cc3dc12de97..77d1482b254 100644 --- a/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go +++ b/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go @@ -327,7 +327,7 @@ func (sc *consensusParameterUpgradeImpl) nextEpoch(ctx context.Context) error { return nil } -func (sc *consensusParameterUpgradeImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *consensusParameterUpgradeImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/consensus_state_sync.go b/go/oasis-test-runner/scenario/e2e/consensus_state_sync.go index 6c071dc696e..1f4b8d71ebb 100644 --- a/go/oasis-test-runner/scenario/e2e/consensus_state_sync.go +++ b/go/oasis-test-runner/scenario/e2e/consensus_state_sync.go @@ -55,7 +55,7 @@ func (sc *consensusStateSyncImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *consensusStateSyncImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *consensusStateSyncImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/debond.go b/go/oasis-test-runner/scenario/e2e/debond.go index 4732b6c53e8..4184632b8e1 100644 --- a/go/oasis-test-runner/scenario/e2e/debond.go +++ b/go/oasis-test-runner/scenario/e2e/debond.go @@ -77,7 +77,7 @@ func (s *debondImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (s *debondImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (s *debondImpl) Run(ctx context.Context, _ *env.Env) error { if err := s.Net.Start(); err != nil { return fmt.Errorf("net Start: %w", err) } diff --git a/go/oasis-test-runner/scenario/e2e/early_query.go b/go/oasis-test-runner/scenario/e2e/early_query.go index 0b074626e23..fa78020aa71 100644 --- a/go/oasis-test-runner/scenario/e2e/early_query.go +++ b/go/oasis-test-runner/scenario/e2e/early_query.go @@ -57,7 +57,7 @@ func (sc *earlyQueryImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *earlyQueryImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *earlyQueryImpl) Run(ctx context.Context, _ *env.Env) error { // Start the network. var err error if err = sc.Net.Start(); err != nil { diff --git a/go/oasis-test-runner/scenario/e2e/genesis_file.go b/go/oasis-test-runner/scenario/e2e/genesis_file.go index 5f198d9ce3f..e455359968f 100644 --- a/go/oasis-test-runner/scenario/e2e/genesis_file.go +++ b/go/oasis-test-runner/scenario/e2e/genesis_file.go @@ -168,7 +168,7 @@ func (s *genesisFileImpl) Run(ctx context.Context, childEnv *env.Env) error { return nil } -func (s *genesisFileImpl) downloadGenesisFile(childEnv *env.Env, path string) error { +func (s *genesisFileImpl) downloadGenesisFile(_ *env.Env, path string) error { // Get the data. resp, err := http.Get(genesisURL) if err != nil { @@ -205,7 +205,7 @@ func (s *genesisFileImpl) downloadGenesisFile(childEnv *env.Env, path string) er return nil } -func (s *genesisFileImpl) createUncanonicalGenesisFile(childEnv *env.Env, uncanonicalGenesisFilePath string) error { +func (s *genesisFileImpl) createUncanonicalGenesisFile(_ *env.Env, uncanonicalGenesisFilePath string) error { provider, err := genesisFile.NewFileProvider(s.Net.GenesisPath()) if err != nil { return fmt.Errorf("failed to open genesis file: %w", err) diff --git a/go/oasis-test-runner/scenario/e2e/helpers_consensus.go b/go/oasis-test-runner/scenario/e2e/helpers_consensus.go index 0c10383b1c1..79a079fab5a 100644 --- a/go/oasis-test-runner/scenario/e2e/helpers_consensus.go +++ b/go/oasis-test-runner/scenario/e2e/helpers_consensus.go @@ -196,7 +196,7 @@ func (sc *Scenario) ExportedGenesisFiles(skipCompute bool) ([]string, error) { } // RegisterEntity registers the specified entity. -func (sc *Scenario) RegisterEntity(ctx context.Context, childEnv *env.Env, cli *cli.Helpers, ent *oasis.Entity, nonce uint64) error { +func (sc *Scenario) RegisterEntity(childEnv *env.Env, cli *cli.Helpers, ent *oasis.Entity, nonce uint64) error { txPath := uniqueFilepath(filepath.Join(childEnv.Dir(), "register_entity.json")) if err := cli.Registry.GenerateRegisterEntityTx(ent.Dir(), nonce, txPath); err != nil { return fmt.Errorf("failed to generate register entity tx: %w", err) @@ -209,7 +209,7 @@ func (sc *Scenario) RegisterEntity(ctx context.Context, childEnv *env.Env, cli * } // RegisterRuntime registers the specified runtime. -func (sc *Scenario) RegisterRuntime(ctx context.Context, childEnv *env.Env, cli *cli.Helpers, rt registry.Runtime, nonce uint64) error { +func (sc *Scenario) RegisterRuntime(childEnv *env.Env, cli *cli.Helpers, rt registry.Runtime, nonce uint64) error { txPath := uniqueFilepath(childEnv.Dir(), fmt.Sprintf("register_runtime_%s.json", rt.ID)) if err := cli.Registry.GenerateRegisterRuntimeTx(childEnv.Dir(), rt, nonce, txPath); err != nil { return fmt.Errorf("failed to generate register runtime tx: %w", err) diff --git a/go/oasis-test-runner/scenario/e2e/helpers_network.go b/go/oasis-test-runner/scenario/e2e/helpers_network.go index 7646f9ac1c3..648a2a90ed0 100644 --- a/go/oasis-test-runner/scenario/e2e/helpers_network.go +++ b/go/oasis-test-runner/scenario/e2e/helpers_network.go @@ -208,7 +208,7 @@ func (sc *Scenario) DumpRestoreNetwork( return nil } -func (sc *Scenario) dumpDatabase(childEnv *env.Env, fixture *oasis.NetworkFixture, exportPath string) error { +func (sc *Scenario) dumpDatabase(childEnv *env.Env, _ *oasis.NetworkFixture, exportPath string) error { // Load the existing export. eFp, err := genesisFile.NewFileProvider(exportPath) if err != nil { diff --git a/go/oasis-test-runner/scenario/e2e/identity_cli.go b/go/oasis-test-runner/scenario/e2e/identity_cli.go index b4cd6d3c406..b108c7f2811 100644 --- a/go/oasis-test-runner/scenario/e2e/identity_cli.go +++ b/go/oasis-test-runner/scenario/e2e/identity_cli.go @@ -31,11 +31,11 @@ func (sc *identityCLIImpl) Clone() scenario.Scenario { } } -func (sc *identityCLIImpl) PreInit(childEnv *env.Env) error { +func (sc *identityCLIImpl) PreInit() error { return nil } -func (sc *identityCLIImpl) Init(childEnv *env.Env, net *oasis.Network) error { +func (sc *identityCLIImpl) Init(childEnv *env.Env, _ *oasis.Network) error { dataDir, err := childEnv.NewSubDir("test-identity") if err != nil { return fmt.Errorf("scenario/e2e/identity_cli: init failed to create subdir: %w", err) @@ -49,7 +49,7 @@ func (sc *identityCLIImpl) Fixture() (*oasis.NetworkFixture, error) { return nil, nil } -func (sc *identityCLIImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *identityCLIImpl) Run(_ context.Context, childEnv *env.Env) error { // Provision node's identity. args := []string{ "identity", "init", diff --git a/go/oasis-test-runner/scenario/e2e/min_transact_balance.go b/go/oasis-test-runner/scenario/e2e/min_transact_balance.go index d9cf243dcc7..f8ce91a2c6a 100644 --- a/go/oasis-test-runner/scenario/e2e/min_transact_balance.go +++ b/go/oasis-test-runner/scenario/e2e/min_transact_balance.go @@ -71,7 +71,7 @@ func (mtb *minTransactBalanceImpl) fundFromTestEntity(ctx context.Context, nonce return nil } -func (mtb *minTransactBalanceImpl) getAccountAndCheckNonce(ctx context.Context, addr staking.Address, expected uint64) (*staking.Account, error) { +func (mtb *minTransactBalanceImpl) getAccountAndCheckNonce(ctx context.Context, addr staking.Address, _ uint64) (*staking.Account, error) { query := staking.OwnerQuery{ Owner: addr, Height: consensus.HeightLatest, @@ -116,7 +116,7 @@ func (mtb *minTransactBalanceImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (mtb *minTransactBalanceImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (mtb *minTransactBalanceImpl) Run(ctx context.Context, _ *env.Env) error { // Start the network if err := mtb.Net.Start(); err != nil { return err diff --git a/go/oasis-test-runner/scenario/e2e/multiple_seeds.go b/go/oasis-test-runner/scenario/e2e/multiple_seeds.go index 6d15d07ef9e..ab826c73904 100644 --- a/go/oasis-test-runner/scenario/e2e/multiple_seeds.go +++ b/go/oasis-test-runner/scenario/e2e/multiple_seeds.go @@ -43,7 +43,7 @@ func (sc *multipleSeeds) Clone() scenario.Scenario { } } -func (sc *multipleSeeds) Run(ctx context.Context, childEnv *env.Env) error { // nolint: gocyclo +func (sc *multipleSeeds) Run(ctx context.Context, _ *env.Env) error { // nolint: gocyclo if err := sc.Net.Start(); err != nil { return fmt.Errorf("net Start: %w", err) } diff --git a/go/oasis-test-runner/scenario/e2e/registry_cli.go b/go/oasis-test-runner/scenario/e2e/registry_cli.go index 8c0733cc100..d871927732b 100644 --- a/go/oasis-test-runner/scenario/e2e/registry_cli.go +++ b/go/oasis-test-runner/scenario/e2e/registry_cli.go @@ -659,7 +659,7 @@ func (sc *registryCLIImpl) testRuntime(ctx context.Context, childEnv *env.Env, c testRuntime.Genesis.StateRoot.Empty() // Register runtime. - if err = sc.RegisterRuntime(ctx, childEnv, cli, testRuntime, 0); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, testRuntime, 0); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go b/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go index b6c9fd304f7..f339b752df1 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go @@ -453,7 +453,7 @@ func (sc *byzantineImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *byzantineImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *byzantineImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/gas_fees.go b/go/oasis-test-runner/scenario/e2e/runtime/gas_fees.go index 3e8d7f5f377..cd0cbfa8c3e 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/gas_fees.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/gas_fees.go @@ -112,7 +112,7 @@ func (sc *gasFeesRuntimesImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *gasFeesRuntimesImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *gasFeesRuntimesImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go b/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go index c6492ac2d98..88f79dcb9d4 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go @@ -292,7 +292,7 @@ func (sc *Scenario) UpdateEnclavePolicies(rt *oasis.Runtime, deploymentIndex int // - Each SGX runtime must have only one deployment and a distinct enclave identity. // - Key manager enclaves are not allowed to replicate the master secrets. // - All compute runtime enclaves are allowed to query key manager enclaves. -func (sc *Scenario) BuildAllEnclavePolicies(childEnv *env.Env) (map[common.Namespace]map[sgx.EnclaveIdentity]*keymanager.EnclavePolicySGX, error) { +func (sc *Scenario) BuildAllEnclavePolicies() (map[common.Namespace]map[sgx.EnclaveIdentity]*keymanager.EnclavePolicySGX, error) { sc.Logger.Info("building key manager SGX policy enclave policies map") kmPolicies := make(map[common.Namespace]map[sgx.EnclaveIdentity]*keymanager.EnclavePolicySGX) @@ -374,8 +374,8 @@ func (sc *Scenario) BuildAllEnclavePolicies(childEnv *env.Env) (map[common.Names // // If the simple key manager runtime does not exist or is not running on an SGX platform, // it returns nil. -func (sc *Scenario) BuildEnclavePolicies(childEnv *env.Env) (map[sgx.EnclaveIdentity]*keymanager.EnclavePolicySGX, error) { - policies, err := sc.BuildAllEnclavePolicies(childEnv) +func (sc *Scenario) BuildEnclavePolicies() (map[sgx.EnclaveIdentity]*keymanager.EnclavePolicySGX, error) { + policies, err := sc.BuildAllEnclavePolicies() if err != nil { return nil, err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/helpers_network.go b/go/oasis-test-runner/scenario/e2e/runtime/helpers_network.go index 15ef4cc8d0d..f02740764a3 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/helpers_network.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/helpers_network.go @@ -140,7 +140,7 @@ func (sc *Scenario) checkTestClientLogs() error { } // StartKeymanagers starts the specified key manager nodes. -func (sc *Scenario) StartKeymanagers(ctx context.Context, idxs []int) error { +func (sc *Scenario) StartKeymanagers(idxs []int) error { sc.Logger.Info("starting the key managers", "ids", fmt.Sprintf("%+v", idxs)) kms := sc.Net.Keymanagers() @@ -153,7 +153,7 @@ func (sc *Scenario) StartKeymanagers(ctx context.Context, idxs []int) error { } // StopKeymanagers stops the specified key manager nodes. -func (sc *Scenario) StopKeymanagers(ctx context.Context, idxs []int) error { +func (sc *Scenario) StopKeymanagers(idxs []int) error { sc.Logger.Info("stopping the key managers", "ids", fmt.Sprintf("%+v", idxs)) kms := sc.Net.Keymanagers() @@ -198,7 +198,7 @@ func (sc *Scenario) WaitKeymanagers(ctx context.Context, idxs []int) error { // StartAndWaitKeymanagers starts the specified key manager nodes and waits // for them to become ready. func (sc *Scenario) StartAndWaitKeymanagers(ctx context.Context, idxs []int) error { - if err := sc.StartKeymanagers(ctx, idxs); err != nil { + if err := sc.StartKeymanagers(idxs); err != nil { return err } return sc.WaitKeymanagers(ctx, idxs) diff --git a/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go b/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go index dd15c8bdbdf..465720a4ea6 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go @@ -71,7 +71,7 @@ func (sc *Scenario) ResolveRuntimeBinary(runtimeBinary string, tee node.TEEHardw } // BuildRuntimes builds the specified runtime binaries using the provided trust root, if given. -func (sc *Scenario) BuildRuntimes(ctx context.Context, childEnv *env.Env, runtimes map[common.Namespace]string, trustRoot *e2e.TrustRoot) error { +func (sc *Scenario) BuildRuntimes(childEnv *env.Env, runtimes map[common.Namespace]string, trustRoot *e2e.TrustRoot) error { // Determine the required directories for building the runtime with an embedded trust root. buildDir, targetDir, err := sc.BuildTargetDirs() if err != nil { @@ -122,13 +122,13 @@ func (sc *Scenario) BuildRuntimes(ctx context.Context, childEnv *env.Env, runtim } // BuildAllRuntimes builds all runtime binaries, i.e. the key/value and the key manager runtime. -func (sc *Scenario) BuildAllRuntimes(ctx context.Context, childEnv *env.Env, trustRoot *e2e.TrustRoot) error { +func (sc *Scenario) BuildAllRuntimes(childEnv *env.Env, trustRoot *e2e.TrustRoot) error { runtimes := map[common.Namespace]string{ KeyValueRuntimeID: KeyValueRuntimeBinary, KeyManagerRuntimeID: KeyManagerRuntimeBinary, } - return sc.BuildRuntimes(ctx, childEnv, runtimes, trustRoot) + return sc.BuildRuntimes(childEnv, runtimes, trustRoot) } // EnsureActiveVersionForComputeWorker ensures that the specified compute worker @@ -328,7 +328,7 @@ func (sc *Scenario) EnableRuntimeDeployment(ctx context.Context, childEnv *env.E "valid_from", newRtDpl.ValidFrom, ) - if err = sc.RegisterRuntime(ctx, childEnv, cli, newRtDsc, nonce); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, newRtDsc, nonce); err != nil { return err } nonce++ // nolint: ineffassign diff --git a/go/oasis-test-runner/scenario/e2e/runtime/history_reindex.go b/go/oasis-test-runner/scenario/e2e/runtime/history_reindex.go index bdd4ab18fad..e9eb84a815f 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/history_reindex.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/history_reindex.go @@ -142,7 +142,7 @@ func (sc *historyReindexImpl) Run(ctx context.Context, childEnv *env.Env) error compRt := sc.Net.Runtimes()[rtIdx] rtDsc := compRt.ToRuntimeDescriptor() rtDsc.Deployments[0].ValidFrom = epoch + 1 - if err = sc.RegisterRuntime(ctx, childEnv, cli, rtDsc, 0); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, rtDsc, 0); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_ephemeral_secrets.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_ephemeral_secrets.go index 5fcdb94c97a..0363bdd95b4 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_ephemeral_secrets.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_ephemeral_secrets.go @@ -10,7 +10,6 @@ import ( "github.com/oasisprotocol/curve25519-voi/primitives/x25519" beacon "github.com/oasisprotocol/oasis-core/go/beacon/api" - "github.com/oasisprotocol/oasis-core/go/common" "github.com/oasisprotocol/oasis-core/go/common/cbor" "github.com/oasisprotocol/oasis-core/go/common/node" consensus "github.com/oasisprotocol/oasis-core/go/consensus/api" @@ -71,7 +70,7 @@ func (sc *kmEphemeralSecretsImpl) Clone() scenario.Scenario { } } -func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) error { // nolint: gocyclo +func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, _ *env.Env) error { // nolint: gocyclo // Start the network, but no need to start the client. Just ensure it // is synced. if err := sc.Scenario.StartNetworkAndWaitForClientSync(ctx); err != nil { @@ -340,7 +339,6 @@ func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) er sc.Logger.Info("encrypting plaintext") ciphertext, err := sc.submitKeyValueRuntimeEncryptTx( ctx, - KeyValueRuntimeID, rng.Uint64(), epoch, keyPairID, @@ -356,7 +354,6 @@ func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) er sc.Logger.Info("decrypting ciphertext") decrypted, err := sc.submitKeyValueRuntimeDecryptTx( ctx, - KeyValueRuntimeID, rng.Uint64(), epoch, keyPairID, @@ -375,7 +372,6 @@ func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) er sc.Logger.Info("decrypting ciphertext with wrong epoch") decrypted, err = sc.submitKeyValueRuntimeDecryptTx( ctx, - KeyValueRuntimeID, rng.Uint64(), epoch-1, keyPairID, @@ -391,7 +387,6 @@ func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) er sc.Logger.Info("decrypting ciphertext with wrong key pair id") decrypted, err = sc.submitKeyValueRuntimeDecryptTx( ctx, - KeyValueRuntimeID, rng.Uint64(), epoch, "wrong key pair id", @@ -412,7 +407,6 @@ func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) er sc.Logger.Info("encrypting plaintext with invalid epoch") _, err = sc.submitKeyValueRuntimeEncryptTx( ctx, - KeyValueRuntimeID, rng.Uint64(), epoch, keyPairID, @@ -428,7 +422,6 @@ func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) er sc.Logger.Info("decrypting ciphertext with invalid epoch") _, err = sc.submitKeyValueRuntimeDecryptTx( ctx, - KeyValueRuntimeID, rng.Uint64(), epoch, keyPairID, @@ -449,7 +442,6 @@ func (sc *kmEphemeralSecretsImpl) Run(ctx context.Context, childEnv *env.Env) er func (sc *kmEphemeralSecretsImpl) submitKeyValueRuntimeEncryptTx( ctx context.Context, - id common.Namespace, nonce uint64, epoch beacon.EpochTime, keyPairID string, @@ -478,7 +470,6 @@ func (sc *kmEphemeralSecretsImpl) submitKeyValueRuntimeEncryptTx( func (sc *kmEphemeralSecretsImpl) submitKeyValueRuntimeDecryptTx( ctx context.Context, - id common.Namespace, nonce uint64, epoch beacon.EpochTime, keyPairID string, diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_master_secrets.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_master_secrets.go index 8e5d99cfda2..226aa405f6d 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_master_secrets.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_master_secrets.go @@ -118,13 +118,13 @@ func (sc *kmMasterSecretsImpl) Run(ctx context.Context, childEnv *env.Env) (err } // Test master secrets if only two/one manager is running. - if err = sc.StopKeymanagers(ctx, []int{2}); err != nil { + if err = sc.StopKeymanagers([]int{2}); err != nil { return err } if _, err = sc.WaitMasterSecret(ctx, 4); err != nil { return err } - if err = sc.StopKeymanagers(ctx, []int{1}); err != nil { + if err = sc.StopKeymanagers([]int{1}); err != nil { return err } if _, err = sc.WaitMasterSecret(ctx, 6); err != nil { diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go index 158b71eef22..e6d7fa6f36f 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go @@ -64,7 +64,7 @@ func (sc *kmReplicateImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *kmReplicateImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *kmReplicateImpl) Run(ctx context.Context, _ *env.Env) error { // Start the first two key managers. if err := sc.Net.Start(); err != nil { return err diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate_many.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate_many.go index edaf7ebbe33..5b2ed3a0261 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate_many.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate_many.go @@ -83,7 +83,7 @@ func (sc *kmReplicateManyImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *kmReplicateManyImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *kmReplicateManyImpl) Run(ctx context.Context, _ *env.Env) error { // Fetch the number of secrets to replicate. n, _ := sc.Flags.GetUint64(cfgNumMasterSecrets) if n == 0 { @@ -102,7 +102,7 @@ func (sc *kmReplicateManyImpl) Run(ctx context.Context, childEnv *env.Env) error } // Start the last two key managers. - if err := sc.StartKeymanagers(ctx, []int{2, 3}); err != nil { + if err := sc.StartKeymanagers([]int{2, 3}); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go index bbc67b545a5..4490875503a 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_rotation_failure.go @@ -75,7 +75,7 @@ func (sc *kmRotationFailureImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *kmRotationFailureImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *kmRotationFailureImpl) Run(ctx context.Context, _ *env.Env) error { // Start the first two key managers. if err := sc.Net.Start(); err != nil { return err @@ -83,7 +83,7 @@ func (sc *kmRotationFailureImpl) Run(ctx context.Context, childEnv *env.Env) err for i := 0; i < 3; i++ { // Start the third key manager. - if err := sc.StartKeymanagers(ctx, []int{1, 2}); err != nil { + if err := sc.StartKeymanagers([]int{1, 2}); err != nil { return err } @@ -107,7 +107,7 @@ func (sc *kmRotationFailureImpl) Run(ctx context.Context, childEnv *env.Env) err } // Stop two key managers, leaving only 33% of the committee members to be active. - if err := sc.StopKeymanagers(ctx, []int{1, 2}); err != nil { + if err := sc.StopKeymanagers([]int{1, 2}); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go b/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go index f2c2376645f..676d3a9a3c1 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go @@ -142,7 +142,7 @@ func (sc *multipleRuntimesImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *multipleRuntimesImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *multipleRuntimesImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/runtime.go b/go/oasis-test-runner/scenario/e2e/runtime/runtime.go index f264cd6c580..bb39f3ae753 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/runtime.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/runtime.go @@ -115,7 +115,6 @@ func unpackRawTxResp(rawRsp []byte) (cbor.RawMessage, error) { func (sc *Scenario) submitConsensusXferTxMeta( ctx context.Context, - id common.Namespace, xfer staking.Transfer, nonce uint64, ) (*runtimeClient.SubmitTxMetaResponse, error) { diff --git a/go/oasis-test-runner/scenario/e2e/runtime/runtime_dynamic.go b/go/oasis-test-runner/scenario/e2e/runtime/runtime_dynamic.go index 298c88d5200..35363967165 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/runtime_dynamic.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/runtime_dynamic.go @@ -126,13 +126,13 @@ func (sc *runtimeDynamicImpl) Run(ctx context.Context, childEnv *env.Env) error kmRt := sc.Net.Runtimes()[0] rtDsc := kmRt.ToRuntimeDescriptor() rtDsc.Deployments[0].ValidFrom = epoch + 1 - if err = sc.RegisterRuntime(ctx, childEnv, cli, rtDsc, nonce); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, rtDsc, nonce); err != nil { return err } nonce++ // Generate and update the new keymanager runtime's policy. - policies, err := sc.BuildEnclavePolicies(childEnv) + policies, err := sc.BuildEnclavePolicies() if err != nil { return err } @@ -178,7 +178,7 @@ func (sc *runtimeDynamicImpl) Run(ctx context.Context, childEnv *env.Env) error compRt := sc.Net.Runtimes()[1] compRtDesc := compRt.ToRuntimeDescriptor() compRtDesc.Deployments[0].ValidFrom = epoch + 1 - if err = sc.RegisterRuntime(ctx, childEnv, cli, compRtDesc, nonce); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, compRtDesc, nonce); err != nil { return err } nonce++ @@ -491,7 +491,7 @@ func (sc *runtimeDynamicImpl) Run(ctx context.Context, childEnv *env.Env) error return fmt.Errorf("failed to escrow stake: %w", err) } // Update the runtime governance model. - if err = sc.RegisterRuntime(ctx, childEnv, cli, compRtDesc, nonce); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, compRtDesc, nonce); err != nil { return err } nonce++ // nolint: ineffassign diff --git a/go/oasis-test-runner/scenario/e2e/runtime/runtime_governance.go b/go/oasis-test-runner/scenario/e2e/runtime/runtime_governance.go index efa4cdb53b2..13e0f099504 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/runtime_governance.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/runtime_governance.go @@ -227,7 +227,7 @@ func (sc *runtimeGovernanceImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *runtimeGovernanceImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *runtimeGovernanceImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/runtime_message.go b/go/oasis-test-runner/scenario/e2e/runtime/runtime_message.go index 6fd6bf8c0b3..c3a78bb110b 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/runtime_message.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/runtime_message.go @@ -48,7 +48,7 @@ func (sc *runtimeMessageImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *runtimeMessageImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *runtimeMessageImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } @@ -78,7 +78,7 @@ func (sc *runtimeMessageImpl) Run(ctx context.Context, childEnv *env.Env) error // contain message results of the consensus transfer. sc.Logger.Debug("submitting consensus_transfer runtime transaction") var txMetaResponse *api.SubmitTxMetaResponse - if txMetaResponse, err = sc.submitConsensusXferTxMeta(ctx, KeyValueRuntimeID, staking.Transfer{}, 0); err != nil { + if txMetaResponse, err = sc.submitConsensusXferTxMeta(ctx, staking.Transfer{}, 0); err != nil { return err } if _, err = unpackRawTxResp(txMetaResponse.Output); err != nil { diff --git a/go/oasis-test-runner/scenario/e2e/runtime/runtime_prune.go b/go/oasis-test-runner/scenario/e2e/runtime/runtime_prune.go index 0625c5b5ade..40ac96c8f88 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/runtime_prune.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/runtime_prune.go @@ -59,7 +59,7 @@ func (sc *runtimePruneImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *runtimePruneImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *runtimePruneImpl) Run(ctx context.Context, _ *env.Env) error { if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/scenario.go b/go/oasis-test-runner/scenario/e2e/runtime/scenario.go index b558ee99698..ff1eed6f303 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/scenario.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/scenario.go @@ -117,7 +117,7 @@ func (sc *Scenario) Clone() scenario.Scenario { } } -func (sc *Scenario) PreInit(childEnv *env.Env) error { +func (sc *Scenario) PreInit() error { return nil } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/storage_early_state_sync.go b/go/oasis-test-runner/scenario/e2e/runtime/storage_early_state_sync.go index 70286656b88..d91ffa927af 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/storage_early_state_sync.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/storage_early_state_sync.go @@ -129,7 +129,7 @@ func (sc *storageEarlyStateSyncImpl) Run(ctx context.Context, childEnv *env.Env) compRt := sc.Net.Runtimes()[0] compRtDesc := compRt.ToRuntimeDescriptor() compRtDesc.Deployments[0].ValidFrom = epoch + 1 - if err = sc.RegisterRuntime(ctx, childEnv, cli, compRtDesc, 0); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, compRtDesc, 0); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/storage_sync_inconsistent.go b/go/oasis-test-runner/scenario/e2e/runtime/storage_sync_inconsistent.go index ac83c36257f..d63d0e71d12 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/storage_sync_inconsistent.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/storage_sync_inconsistent.go @@ -110,7 +110,7 @@ func (sc *storageSyncInconsistentImpl) waitForSegment(ctx context.Context, worke } } -func (sc *storageSyncInconsistentImpl) wipe(ctx context.Context, worker *oasis.Node) error { +func (sc *storageSyncInconsistentImpl) wipe(worker *oasis.Node) error { return os.RemoveAll(persistent.GetPersistentStoreDBDir(worker.DataDir())) } @@ -168,7 +168,7 @@ func (sc *storageSyncInconsistentImpl) Run(ctx context.Context, childEnv *env.En if err = messyWorker.Stop(); err != nil { return err } - if err = sc.wipe(ctx, messyWorker.Node); err != nil { + if err = sc.wipe(messyWorker.Node); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/test_client.go b/go/oasis-test-runner/scenario/e2e/runtime/test_client.go index 513002f980f..2d4f5150621 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/test_client.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/test_client.go @@ -37,7 +37,7 @@ func (cli *TestClient) Init(scenario *Scenario) error { } // Start starts the test client in a background. -func (cli *TestClient) Start(ctx context.Context, childEnv *env.Env) error { +func (cli *TestClient) Start(ctx context.Context, _ *env.Env) error { cli.ctx = ctx subCtx, cancelFn := context.WithCancel(ctx) diff --git a/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go b/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go index f68f3657667..ad742ea1cfd 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/trust_root.go @@ -88,7 +88,7 @@ func (sc *TrustRootImpl) PreRun(ctx context.Context, childEnv *env.Env) (err err } // Build simple key/value and key manager runtimes. - if err = sc.BuildAllRuntimes(ctx, childEnv, trustRoot); err != nil { + if err = sc.BuildAllRuntimes(childEnv, trustRoot); err != nil { return err } @@ -110,14 +110,14 @@ func (sc *TrustRootImpl) PreRun(ctx context.Context, childEnv *env.Env) (err err for _, rt := range sc.Net.Runtimes() { rtDsc := rt.ToRuntimeDescriptor() rtDsc.Deployments[0].ValidFrom = epoch + 2 - if err = sc.RegisterRuntime(ctx, childEnv, cli, rtDsc, nonce); err != nil { + if err = sc.RegisterRuntime(childEnv, cli, rtDsc, nonce); err != nil { return err } nonce++ } // Update the key manager policy. - policies, err := sc.BuildEnclavePolicies(childEnv) + policies, err := sc.BuildEnclavePolicies() if err != nil { return err } @@ -141,9 +141,9 @@ func (sc *TrustRootImpl) PreRun(ctx context.Context, childEnv *env.Env) (err err } // PostRun re-builds simple key/value and key manager runtimes. -func (sc *TrustRootImpl) PostRun(ctx context.Context, childEnv *env.Env) error { +func (sc *TrustRootImpl) PostRun(_ context.Context, childEnv *env.Env) error { // In the end, always rebuild all runtimes as we are changing binaries in one of the steps. - return sc.BuildAllRuntimes(ctx, childEnv, nil) + return sc.BuildAllRuntimes(childEnv, nil) } func (sc *TrustRootImpl) Run(ctx context.Context, childEnv *env.Env) (err error) { @@ -200,7 +200,7 @@ func (sc *TrustRootImpl) Run(ctx context.Context, childEnv *env.Env) (err error) return sc.RunTestClientAndCheckLogs(ctx, childEnv) } -func (sc *TrustRootImpl) startClientComputeAndKeyManagerNodes(ctx context.Context, childEnv *env.Env) error { +func (sc *TrustRootImpl) startClientComputeAndKeyManagerNodes(ctx context.Context, _ *env.Env) error { // Start client, compute workers and key manager nodes as they are not auto-started. sc.Logger.Info("starting clients, compute workers and key managers") for _, n := range sc.Net.Clients() { diff --git a/go/oasis-test-runner/scenario/e2e/runtime/txsource.go b/go/oasis-test-runner/scenario/e2e/runtime/txsource.go index ce06aec9d9b..dc200dfbd11 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/txsource.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/txsource.go @@ -181,7 +181,7 @@ type txSourceImpl struct { // nolint: maligned seed string } -func (sc *txSourceImpl) PreInit(childEnv *env.Env) error { +func (sc *txSourceImpl) PreInit() error { // Generate a new random seed and log it so we can reproduce the run. // Use existing seed, if it already exists. if sc.seed == "" { diff --git a/go/oasis-test-runner/scenario/e2e/scenario.go b/go/oasis-test-runner/scenario/e2e/scenario.go index 4cad65eab53..84b6b4f7e83 100644 --- a/go/oasis-test-runner/scenario/e2e/scenario.go +++ b/go/oasis-test-runner/scenario/e2e/scenario.go @@ -69,7 +69,7 @@ func (sc *Scenario) Parameters() *env.ParameterFlagSet { } // PreInit implements scenario.Scenario. -func (sc *Scenario) PreInit(childEnv *env.Env) error { +func (sc *Scenario) PreInit() error { return nil } @@ -102,7 +102,7 @@ func (sc *Scenario) Fixture() (*oasis.NetworkFixture, error) { } // Init implements scenario.Scenario. -func (sc *Scenario) Init(childEnv *env.Env, net *oasis.Network) error { +func (sc *Scenario) Init(_ *env.Env, net *oasis.Network) error { sc.Net = net return nil } diff --git a/go/oasis-test-runner/scenario/e2e/seed_api.go b/go/oasis-test-runner/scenario/e2e/seed_api.go index 865553ccf20..77f848f8030 100644 --- a/go/oasis-test-runner/scenario/e2e/seed_api.go +++ b/go/oasis-test-runner/scenario/e2e/seed_api.go @@ -41,7 +41,7 @@ func (sc *seedAPI) Clone() scenario.Scenario { } } -func (sc *seedAPI) Run(ctx context.Context, childEnv *env.Env) error { // nolint: gocyclo +func (sc *seedAPI) Run(ctx context.Context, _ *env.Env) error { // nolint: gocyclo if err := sc.Net.Start(); err != nil { return fmt.Errorf("net Start: %w", err) } diff --git a/go/oasis-test-runner/scenario/e2e/upgrade.go b/go/oasis-test-runner/scenario/e2e/upgrade.go index 3e8f5e6d78f..c5083045b3f 100644 --- a/go/oasis-test-runner/scenario/e2e/upgrade.go +++ b/go/oasis-test-runner/scenario/e2e/upgrade.go @@ -72,17 +72,17 @@ func (d *dummyUpgradeChecker) PostUpgradeFn(ctx context.Context, ctrl *oasis.Con type noOpUpgradeChecker struct{} -func (n *noOpUpgradeChecker) PreUpgradeFn(ctx context.Context, ctrl *oasis.Controller) error { +func (n *noOpUpgradeChecker) PreUpgradeFn(context.Context, *oasis.Controller) error { return nil } -func (n *noOpUpgradeChecker) PostUpgradeFn(ctx context.Context, ctrl *oasis.Controller) error { +func (n *noOpUpgradeChecker) PostUpgradeFn(context.Context, *oasis.Controller) error { return nil } type upgradeV62Checker struct{} -func (n *upgradeV62Checker) PreUpgradeFn(ctx context.Context, ctrl *oasis.Controller) error { +func (n *upgradeV62Checker) PreUpgradeFn(context.Context, *oasis.Controller) error { return nil } diff --git a/go/oasis-test-runner/scenario/e2e/validator_equivocation.go b/go/oasis-test-runner/scenario/e2e/validator_equivocation.go index 48feeb339f2..31ae61e687c 100644 --- a/go/oasis-test-runner/scenario/e2e/validator_equivocation.go +++ b/go/oasis-test-runner/scenario/e2e/validator_equivocation.go @@ -85,7 +85,7 @@ func (sc *validatorEquivocationImpl) Fixture() (*oasis.NetworkFixture, error) { return f, nil } -func (sc *validatorEquivocationImpl) Run(ctx context.Context, childEnv *env.Env) error { // nolint: gocyclo +func (sc *validatorEquivocationImpl) Run(ctx context.Context, _ *env.Env) error { // nolint: gocyclo if err := sc.Net.Start(); err != nil { return err } diff --git a/go/oasis-test-runner/scenario/pluginsigner/basic.go b/go/oasis-test-runner/scenario/pluginsigner/basic.go index c432297ed9d..231a61b858b 100644 --- a/go/oasis-test-runner/scenario/pluginsigner/basic.go +++ b/go/oasis-test-runner/scenario/pluginsigner/basic.go @@ -31,7 +31,7 @@ func (sc *basicImpl) Clone() scenario.Scenario { } } -func (sc *basicImpl) Run(ctx context.Context, childEnv *env.Env) error { +func (sc *basicImpl) Run(_ context.Context, _ *env.Env) error { roles := []signature.SignerRole{ signature.SignerEntity, signature.SignerNode, diff --git a/go/oasis-test-runner/scenario/pluginsigner/pluginsigner.go b/go/oasis-test-runner/scenario/pluginsigner/pluginsigner.go index 5dae7093d2c..49d2b7b9212 100644 --- a/go/oasis-test-runner/scenario/pluginsigner/pluginsigner.go +++ b/go/oasis-test-runner/scenario/pluginsigner/pluginsigner.go @@ -60,7 +60,7 @@ func (sc *pluginSignerImpl) Parameters() *env.ParameterFlagSet { return sc.flags } -func (sc *pluginSignerImpl) PreInit(childEnv *env.Env) error { +func (sc *pluginSignerImpl) PreInit() error { return nil } @@ -68,7 +68,7 @@ func (sc *pluginSignerImpl) Fixture() (*oasis.NetworkFixture, error) { return nil, nil } -func (sc *pluginSignerImpl) Init(childEnv *env.Env, net *oasis.Network) error { +func (sc *pluginSignerImpl) Init(*env.Env, *oasis.Network) error { return nil } diff --git a/go/oasis-test-runner/scenario/remotesigner/basic.go b/go/oasis-test-runner/scenario/remotesigner/basic.go index bfd3a9600fe..2066916f883 100644 --- a/go/oasis-test-runner/scenario/remotesigner/basic.go +++ b/go/oasis-test-runner/scenario/remotesigner/basic.go @@ -100,7 +100,13 @@ func (sc *basicImpl) Run(ctx context.Context, childEnv *env.Env) error { return err } childEnv.AddTermOnCleanup(cmd) - time.Sleep(2 * time.Second) // TODO: Is this needed? + + // TODO: Is this needed? + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(2 * time.Second): + } // Initialize a client. sc.logger.Info("initializing in-process client") @@ -117,7 +123,6 @@ func (sc *basicImpl) Run(ctx context.Context, childEnv *env.Env) error { ClientCertificate: clientCert, ServerCertificate: serverCert, }, - signature.SignerRoles..., ) if err != nil { return err diff --git a/go/oasis-test-runner/scenario/remotesigner/remotesigner.go b/go/oasis-test-runner/scenario/remotesigner/remotesigner.go index f1c3d84f341..e71db55ba1e 100644 --- a/go/oasis-test-runner/scenario/remotesigner/remotesigner.go +++ b/go/oasis-test-runner/scenario/remotesigner/remotesigner.go @@ -59,7 +59,7 @@ func (sc *remoteSignerImpl) Parameters() *env.ParameterFlagSet { return sc.flags } -func (sc *remoteSignerImpl) PreInit(childEnv *env.Env) error { +func (sc *remoteSignerImpl) PreInit() error { return nil } @@ -67,7 +67,7 @@ func (sc *remoteSignerImpl) Fixture() (*oasis.NetworkFixture, error) { return nil, nil } -func (sc *remoteSignerImpl) Init(childEnv *env.Env, net *oasis.Network) error { +func (sc *remoteSignerImpl) Init(*env.Env, *oasis.Network) error { return nil } diff --git a/go/oasis-test-runner/scenario/scenario.go b/go/oasis-test-runner/scenario/scenario.go index 9c4be2603a9..42cb5d92829 100644 --- a/go/oasis-test-runner/scenario/scenario.go +++ b/go/oasis-test-runner/scenario/scenario.go @@ -24,7 +24,7 @@ type Scenario interface { // PreInit performs initial scenario initialization. It is guaranteed to be called before // a new fixture is initialized in Fixture. - PreInit(childEnv *env.Env) error + PreInit() error // Fixture returns a network fixture to use for this scenario. // diff --git a/go/p2p/api/crypto.go b/go/p2p/api/crypto.go index 5b1d8b4e424..991b708e72c 100644 --- a/go/p2p/api/crypto.go +++ b/go/p2p/api/crypto.go @@ -23,7 +23,7 @@ func (s *p2pSigner) Bytes() ([]byte, error) { return nil, errCryptoNotSupported } -func (s *p2pSigner) Equals(other libp2pCrypto.Key) bool { +func (s *p2pSigner) Equals(libp2pCrypto.Key) bool { return false } diff --git a/go/p2p/backup/cstore.go b/go/p2p/backup/cstore.go index 2d7e8e025bf..a67bbd20377 100644 --- a/go/p2p/backup/cstore.go +++ b/go/p2p/backup/cstore.go @@ -39,7 +39,7 @@ func NewCommonStoreBackend(cs *persistent.CommonStore, bucket string, key string } // Delete implements PeerBackup. -func (b *commonStoreBackend) Delete(ctx context.Context) error { +func (b *commonStoreBackend) Delete(context.Context) error { if b.bucket == nil { return nil } @@ -48,7 +48,7 @@ func (b *commonStoreBackend) Delete(ctx context.Context) error { } // Backup implements PeerBackup. -func (b *commonStoreBackend) Backup(ctx context.Context, nsPeers map[string][]peer.AddrInfo) error { +func (b *commonStoreBackend) Backup(_ context.Context, nsPeers map[string][]peer.AddrInfo) error { if b.bucket == nil { return nil } @@ -87,7 +87,7 @@ func (b *commonStoreBackend) Backup(ctx context.Context, nsPeers map[string][]pe } // Restore implements PeerBackup. -func (b *commonStoreBackend) Restore(ctx context.Context) (map[string][]peer.AddrInfo, error) { +func (b *commonStoreBackend) Restore(_ context.Context) (map[string][]peer.AddrInfo, error) { if b.bucket == nil { return map[string][]peer.AddrInfo{}, nil } diff --git a/go/p2p/backup/memory.go b/go/p2p/backup/memory.go index 619e9687fae..b3582e148cd 100644 --- a/go/p2p/backup/memory.go +++ b/go/p2p/backup/memory.go @@ -24,7 +24,7 @@ func NewInMemoryBackend() *InMemoryBackend { } // Delete implements PeerBackup. -func (b *InMemoryBackend) Delete(ctx context.Context) error { +func (b *InMemoryBackend) Delete(context.Context) error { b.mu.Lock() defer b.mu.Unlock() @@ -33,7 +33,7 @@ func (b *InMemoryBackend) Delete(ctx context.Context) error { } // Backup implements PeerBackup. -func (b *InMemoryBackend) Backup(ctx context.Context, nsPeers map[string][]peer.AddrInfo) error { +func (b *InMemoryBackend) Backup(_ context.Context, nsPeers map[string][]peer.AddrInfo) error { b.mu.Lock() defer b.mu.Unlock() @@ -42,7 +42,7 @@ func (b *InMemoryBackend) Backup(ctx context.Context, nsPeers map[string][]peer. } // Restore implements PeerBackup. -func (b *InMemoryBackend) Restore(ctx context.Context) (map[string][]peer.AddrInfo, error) { +func (b *InMemoryBackend) Restore(context.Context) (map[string][]peer.AddrInfo, error) { b.mu.Lock() defer b.mu.Unlock() diff --git a/go/p2p/discovery/bootstrap/client.go b/go/p2p/discovery/bootstrap/client.go index fd02924ea4c..46d818749b2 100644 --- a/go/p2p/discovery/bootstrap/client.go +++ b/go/p2p/discovery/bootstrap/client.go @@ -115,7 +115,7 @@ func NewClient(h host.Host, seed peer.AddrInfo, opts ...ClientOption) discovery. } // Advertise implements discovery.Advertiser and discovery.Discovery. -func (c *client) Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error) { +func (c *client) Advertise(ctx context.Context, ns string, _ ...discovery.Option) (time.Duration, error) { req := AdvertiseRequest{ Namespace: ns, } diff --git a/go/p2p/discovery/bootstrap/client_test.go b/go/p2p/discovery/bootstrap/client_test.go index c58891a7dee..3e3bde31b99 100644 --- a/go/p2p/discovery/bootstrap/client_test.go +++ b/go/p2p/discovery/bootstrap/client_test.go @@ -227,7 +227,7 @@ func (s *BootstrapTestSuite) TestDiscovery() { } // HandleRequest is a malicious seed which doesn't respect the protocol. -func (s *BootstrapTestSuite) HandleRequest(ctx context.Context, method string, body cbor.RawMessage) (interface{}, error) { +func (s *BootstrapTestSuite) HandleRequest(_ context.Context, _ string, body cbor.RawMessage) (interface{}, error) { var req DiscoverRequest if err := cbor.Unmarshal(body, &req); err != nil { return nil, ErrBadRequest diff --git a/go/p2p/discovery/peerstore/peerstore.go b/go/p2p/discovery/peerstore/peerstore.go index 7dbcfb3931a..41c1c00fa80 100644 --- a/go/p2p/discovery/peerstore/peerstore.go +++ b/go/p2p/discovery/peerstore/peerstore.go @@ -349,7 +349,7 @@ func (s *Store) Stop() { } // cleanup removes peers which registration expired. -func (s *Store) cleanup(ctx context.Context) error { +func (s *Store) cleanup(_ context.Context) error { s.mu.Lock() defer s.mu.Unlock() diff --git a/go/p2p/dispatch.go b/go/p2p/dispatch.go index 90546ab2526..64eabd1ce0a 100644 --- a/go/p2p/dispatch.go +++ b/go/p2p/dispatch.go @@ -56,7 +56,7 @@ type queuedMsg struct { msg interface{} } -func (h *topicHandler) topicMessageValidator(ctx context.Context, unused core.PeerID, envelope *pubsub.Message) bool { +func (h *topicHandler) topicMessageValidator(_ context.Context, _ core.PeerID, envelope *pubsub.Message) bool { // Tease apart the pubsub message envelope and convert it to // the expected format. diff --git a/go/p2p/nop.go b/go/p2p/nop.go index 6be79f8aa7c..093bbe91586 100644 --- a/go/p2p/nop.go +++ b/go/p2p/nop.go @@ -51,20 +51,20 @@ func (p *nopP2P) Addresses() []node.Address { } // Implements api.Service. -func (p *nopP2P) Peers(runtimeID common.Namespace) []string { +func (p *nopP2P) Peers(common.Namespace) []string { return nil } // Implements api.Service. -func (p *nopP2P) Publish(ctx context.Context, topic string, msg interface{}) { +func (p *nopP2P) Publish(context.Context, string, interface{}) { } // Implements api.Service. -func (p *nopP2P) RegisterHandler(topic string, handler api.Handler) { +func (p *nopP2P) RegisterHandler(string, api.Handler) { } // Implements api.Service. -func (p *nopP2P) BlockPeer(peerID core.PeerID) { +func (p *nopP2P) BlockPeer(core.PeerID) { } // Implements api.Service. @@ -78,11 +78,11 @@ func (p *nopP2P) PeerManager() api.PeerManager { } // Implements api.Service. -func (p *nopP2P) RegisterProtocol(pid core.ProtocolID, min int, total int) { +func (p *nopP2P) RegisterProtocol(core.ProtocolID, int, int) { } // Implements api.Service. -func (p *nopP2P) RegisterProtocolServer(srv rpc.Server) { +func (p *nopP2P) RegisterProtocolServer(rpc.Server) { } // Implements api.Service. diff --git a/go/p2p/p2p.go b/go/p2p/p2p.go index e45aec5c9b7..e1b30242ab5 100644 --- a/go/p2p/p2p.go +++ b/go/p2p/p2p.go @@ -255,7 +255,7 @@ func filterGloballyReachableAddresses(addrs []multiaddr.Multiaddr) []multiaddr.M } // Implements api.Service. -func (p *p2p) Publish(ctx context.Context, topic string, msg interface{}) { +func (p *p2p) Publish(_ context.Context, topic string, msg interface{}) { rawMsg := cbor.Marshal(msg) p.RLock() diff --git a/go/p2p/peermgmt/discovery_test.go b/go/p2p/peermgmt/discovery_test.go index fca5533b6cd..8a30a2fd52d 100644 --- a/go/p2p/peermgmt/discovery_test.go +++ b/go/p2p/peermgmt/discovery_test.go @@ -140,7 +140,7 @@ func (s *DiscoveryTestSuite) discoveryCount() int { return s.discoveryCounter } -func (s *DiscoveryTestSuite) FindPeers(ctx context.Context, ns string, opts ...discovery.Option) (<-chan peer.AddrInfo, error) { +func (s *DiscoveryTestSuite) FindPeers(_ context.Context, ns string, _ ...discovery.Option) (<-chan peer.AddrInfo, error) { s.mu.Lock() defer s.mu.Unlock() @@ -159,7 +159,7 @@ func (s *DiscoveryTestSuite) FindPeers(ctx context.Context, ns string, opts ...d return ch, nil } -func (s *DiscoveryTestSuite) Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error) { +func (s *DiscoveryTestSuite) Advertise(_ context.Context, ns string, _ ...discovery.Option) (time.Duration, error) { s.mu.Lock() defer s.mu.Unlock() diff --git a/go/p2p/rpc/client_test.go b/go/p2p/rpc/client_test.go index 8f37e10f3ce..61d2248a9d1 100644 --- a/go/p2p/rpc/client_test.go +++ b/go/p2p/rpc/client_test.go @@ -34,7 +34,7 @@ type testService struct { id int } -func (s *testService) HandleRequest(ctx context.Context, method string, body cbor.RawMessage) (interface{}, error) { +func (s *testService) HandleRequest(_ context.Context, method string, body cbor.RawMessage) (interface{}, error) { if method != testMethod { return nil, fmt.Errorf("unsupported method") } @@ -59,19 +59,19 @@ type testListener struct { badPeers int } -func (l *testListener) RecordSuccess(peerID core.PeerID, latency time.Duration) { +func (l *testListener) RecordSuccess(core.PeerID, time.Duration) { l.mu.Lock() l.successes++ l.mu.Unlock() } -func (l *testListener) RecordFailure(peerID core.PeerID, latency time.Duration) { +func (l *testListener) RecordFailure(core.PeerID, time.Duration) { l.mu.Lock() l.failures++ l.mu.Unlock() } -func (l *testListener) RecordBadPeer(peerID core.PeerID) { +func (l *testListener) RecordBadPeer(core.PeerID) { l.mu.Lock() l.badPeers++ l.mu.Unlock() diff --git a/go/p2p/rpc/nop.go b/go/p2p/rpc/nop.go index a9ab70229df..e56893140a0 100644 --- a/go/p2p/rpc/nop.go +++ b/go/p2p/rpc/nop.go @@ -15,28 +15,28 @@ var errUnsupported = fmt.Errorf("unsupported: p2p is disabled") type nopPeerManager struct{} // Implements PeerManager. -func (*nopPeerManager) AddPeer(peerID peer.ID) { +func (*nopPeerManager) AddPeer(peer.ID) { } // Implements PeerManager. -func (*nopPeerManager) GetBestPeers(opts ...BestPeersOption) []peer.ID { +func (*nopPeerManager) GetBestPeers(...BestPeersOption) []peer.ID { return nil } // Implements PeerManager. -func (*nopPeerManager) RecordBadPeer(peerID peer.ID) { +func (*nopPeerManager) RecordBadPeer(peer.ID) { } // Implements PeerManager. -func (*nopPeerManager) RecordFailure(peerID peer.ID, latency time.Duration) { +func (*nopPeerManager) RecordFailure(peer.ID, time.Duration) { } // Implements PeerManager. -func (*nopPeerManager) RecordSuccess(peerID peer.ID, latency time.Duration) { +func (*nopPeerManager) RecordSuccess(peer.ID, time.Duration) { } // Implements PeerManager. -func (*nopPeerManager) RemovePeer(peerID peer.ID) { +func (*nopPeerManager) RemovePeer(peer.ID) { } // Implements PeersUpdates. @@ -48,39 +48,42 @@ type nopClient struct{} // Implements Client. func (c *nopClient) Call( - ctx context.Context, - peer peer.ID, - method string, - body, rsp interface{}, - opts ...CallOption, + context.Context, + peer.ID, + string, + interface{}, + interface{}, + ...CallOption, ) (PeerFeedback, error) { return nil, errUnsupported } // Implements Client. func (c *nopClient) CallOne( - ctx context.Context, - peers []peer.ID, - method string, - body, rsp interface{}, - opts ...CallOption, + context.Context, + []peer.ID, + string, + interface{}, + interface{}, + ...CallOption, ) (PeerFeedback, error) { return nil, errUnsupported } // Implements Client. func (c *nopClient) CallMulti( - ctx context.Context, - peers []peer.ID, - method string, - body, rspTyp interface{}, - opts ...CallMultiOption, + context.Context, + []peer.ID, + string, + interface{}, + interface{}, + ...CallMultiOption, ) ([]interface{}, []PeerFeedback, error) { return nil, nil, errUnsupported } // Implements Client. -func (c *nopClient) RegisterListener(l ClientListener) {} +func (c *nopClient) RegisterListener(ClientListener) {} // Implements Client. -func (c *nopClient) UnregisterListener(l ClientListener) {} +func (c *nopClient) UnregisterListener(ClientListener) {} diff --git a/go/p2p/rpc/peermgmt_test.go b/go/p2p/rpc/peermgmt_test.go index 03cd9ac1037..2b4f2c767be 100644 --- a/go/p2p/rpc/peermgmt_test.go +++ b/go/p2p/rpc/peermgmt_test.go @@ -18,7 +18,7 @@ type testP2P struct { } // BlockPeer implements P2P. -func (*testP2P) BlockPeer(peerID peer.ID) { +func (*testP2P) BlockPeer(peer.ID) { } // Host implements P2P. @@ -27,7 +27,7 @@ func (t *testP2P) Host() host.Host { } // RegisterProtocol implements P2P. -func (*testP2P) RegisterProtocol(p protocol.ID, min int, total int) { +func (*testP2P) RegisterProtocol(protocol.ID, int, int) { } func TestWatchUpdates(t *testing.T) { diff --git a/go/registry/api/api.go b/go/registry/api/api.go index cca7ec8c4da..5aae4f2d285 100644 --- a/go/registry/api/api.go +++ b/go/registry/api/api.go @@ -368,7 +368,7 @@ func (e *NodeListEpochEvent) EventValue() string { } // DecodeValue decodes the attribute event value. -func (e *NodeListEpochEvent) DecodeValue(value string) error { +func (e *NodeListEpochEvent) DecodeValue(string) error { return nil } diff --git a/go/registry/api/api_test.go b/go/registry/api/api_test.go index 17c6fb18366..326bcf22f97 100644 --- a/go/registry/api/api_test.go +++ b/go/registry/api/api_test.go @@ -24,7 +24,7 @@ type mockNodeLookup struct { nodesList []*node.Node } -func (n *mockNodeLookup) NodeBySubKey(ctx context.Context, key signature.PublicKey) (*node.Node, error) { +func (n *mockNodeLookup) NodeBySubKey(_ context.Context, key signature.PublicKey) (*node.Node, error) { for _, nd := range n.nodesList { if nd.ID.Equal(key) { return nd, nil @@ -42,7 +42,7 @@ func (n *mockNodeLookup) NodeBySubKey(ctx context.Context, key signature.PublicK return nil, ErrNoSuchNode } -func (n *mockNodeLookup) Nodes(ctx context.Context) ([]*node.Node, error) { +func (n *mockNodeLookup) Nodes(context.Context) ([]*node.Node, error) { return n.nodesList, nil } @@ -50,26 +50,26 @@ type mockRuntimeLookup struct { runtimes map[common.Namespace]*Runtime } -func (rl *mockRuntimeLookup) Runtime(ctx context.Context, id common.Namespace) (*Runtime, error) { +func (rl *mockRuntimeLookup) Runtime(context.Context, common.Namespace) (*Runtime, error) { panic("not implemented") } -func (rl *mockRuntimeLookup) SuspendedRuntime(ctx context.Context, id common.Namespace) (*Runtime, error) { +func (rl *mockRuntimeLookup) SuspendedRuntime(context.Context, common.Namespace) (*Runtime, error) { panic("not implemented") } -func (rl *mockRuntimeLookup) AnyRuntime(ctx context.Context, id common.Namespace) (*Runtime, error) { +func (rl *mockRuntimeLookup) AnyRuntime(_ context.Context, id common.Namespace) (*Runtime, error) { if rl.runtimes[id] != nil { return rl.runtimes[id], nil } return nil, ErrNoSuchRuntime } -func (rl *mockRuntimeLookup) AllRuntimes(ctx context.Context) ([]*Runtime, error) { +func (rl *mockRuntimeLookup) AllRuntimes(context.Context) ([]*Runtime, error) { panic("not implemented") } -func (rl *mockRuntimeLookup) Runtimes(ctx context.Context) ([]*Runtime, error) { +func (rl *mockRuntimeLookup) Runtimes(context.Context) ([]*Runtime, error) { panic("not implemented") } diff --git a/go/registry/api/runtime.go b/go/registry/api/runtime.go index 891aac6eb89..153a399dd4a 100644 --- a/go/registry/api/runtime.go +++ b/go/registry/api/runtime.go @@ -718,7 +718,7 @@ func (rtg *RuntimeGenesis) Equal(cmp *RuntimeGenesis) bool { // SanityCheck does basic sanity checking of RuntimeGenesis. // isGenesis is true, if it is called during consensus chain init. -func (rtg *RuntimeGenesis) SanityCheck(isGenesis bool) error { +func (rtg *RuntimeGenesis) SanityCheck(bool) error { return nil } diff --git a/go/registry/api/sanity_check.go b/go/registry/api/sanity_check.go index e36ac404b83..313959ed59d 100644 --- a/go/registry/api/sanity_check.go +++ b/go/registry/api/sanity_check.go @@ -435,7 +435,7 @@ func newSanityCheckRuntimeLookup(runtimes, suspendedRuntimes []*Runtime) (Runtim }, nil } -func (r *sanityCheckRuntimeLookup) Runtime(ctx context.Context, id common.Namespace) (*Runtime, error) { +func (r *sanityCheckRuntimeLookup) Runtime(_ context.Context, id common.Namespace) (*Runtime, error) { rt, ok := r.runtimes[id] if !ok { return nil, fmt.Errorf("runtime not found") @@ -443,7 +443,7 @@ func (r *sanityCheckRuntimeLookup) Runtime(ctx context.Context, id common.Namesp return rt, nil } -func (r *sanityCheckRuntimeLookup) SuspendedRuntime(ctx context.Context, id common.Namespace) (*Runtime, error) { +func (r *sanityCheckRuntimeLookup) SuspendedRuntime(_ context.Context, id common.Namespace) (*Runtime, error) { srt, ok := r.suspendedRuntimes[id] if !ok { return nil, ErrNoSuchRuntime @@ -451,7 +451,7 @@ func (r *sanityCheckRuntimeLookup) SuspendedRuntime(ctx context.Context, id comm return srt, nil } -func (r *sanityCheckRuntimeLookup) AnyRuntime(ctx context.Context, id common.Namespace) (*Runtime, error) { +func (r *sanityCheckRuntimeLookup) AnyRuntime(_ context.Context, id common.Namespace) (*Runtime, error) { rt, ok := r.runtimes[id] if !ok { srt, ok := r.suspendedRuntimes[id] @@ -463,11 +463,11 @@ func (r *sanityCheckRuntimeLookup) AnyRuntime(ctx context.Context, id common.Nam return rt, nil } -func (r *sanityCheckRuntimeLookup) AllRuntimes(ctx context.Context) ([]*Runtime, error) { +func (r *sanityCheckRuntimeLookup) AllRuntimes(context.Context) ([]*Runtime, error) { return r.allRuntimes, nil } -func (r *sanityCheckRuntimeLookup) Runtimes(ctx context.Context) ([]*Runtime, error) { +func (r *sanityCheckRuntimeLookup) Runtimes(context.Context) ([]*Runtime, error) { runtimes := make([]*Runtime, 0, len(r.runtimes)) for _, r := range r.runtimes { runtimes = append(runtimes, r) @@ -482,7 +482,7 @@ type sanityCheckNodeLookup struct { nodesList []*node.Node } -func (n *sanityCheckNodeLookup) NodeBySubKey(ctx context.Context, key signature.PublicKey) (*node.Node, error) { +func (n *sanityCheckNodeLookup) NodeBySubKey(_ context.Context, key signature.PublicKey) (*node.Node, error) { node, ok := n.nodes[key] if !ok { return nil, ErrNoSuchNode @@ -490,6 +490,6 @@ func (n *sanityCheckNodeLookup) NodeBySubKey(ctx context.Context, key signature. return node, nil } -func (n *sanityCheckNodeLookup) Nodes(ctx context.Context) ([]*node.Node, error) { +func (n *sanityCheckNodeLookup) Nodes(context.Context) ([]*node.Node, error) { return n.nodesList, nil } diff --git a/go/registry/tests/tester.go b/go/registry/tests/tester.go index 3fd2e533e1d..a5f621c1e88 100644 --- a/go/registry/tests/tester.go +++ b/go/registry/tests/tester.go @@ -947,7 +947,7 @@ func testRegistryRuntime(t *testing.T, backend api.Backend, consensus consensusA rtMap[rt.Runtime.ID] = rt.Runtime rt.MustRegister(t, backend, consensus) case false: - rt.MustNotRegister(t, backend, consensus) + rt.MustNotRegister(t, consensus) } rtMapByName[tc.name] = rt.Runtime @@ -974,14 +974,14 @@ func testRegistryRuntime(t *testing.T, backend api.Backend, consensus consensusA re.MustRegister(t, backend, consensus) // Runtime to consensus governance transition should fail. re.Runtime.GovernanceModel = api.GovernanceConsensus - re.MustNotRegister(t, backend, consensus) + re.MustNotRegister(t, consensus) // Runtime back to entity governance transition should fail. re.Runtime.GovernanceModel = api.GovernanceEntity - re.MustNotRegister(t, backend, consensus) + re.MustNotRegister(t, consensus) // Any updates to runtime parameters should fail for runtime-governed runtimes. re.Runtime.GovernanceModel = api.GovernanceRuntime re.Runtime.TxnScheduler.ProposerTimeout = 6 - re.MustNotRegister(t, backend, consensus) + re.MustNotRegister(t, consensus) re, err = NewTestRuntime([]byte("Runtime re-registration test 2"), entity, true) require.NoError(err, "NewTestRuntime (re-registration test 2)") @@ -994,17 +994,17 @@ func testRegistryRuntime(t *testing.T, backend api.Backend, consensus consensusA re.MustRegister(t, backend, consensus) // Non-compute runtimes cannot transition to runtime governance. re.Runtime.GovernanceModel = api.GovernanceRuntime - re.MustNotRegister(t, backend, consensus) + re.MustNotRegister(t, consensus) // Entity to consensus governance transition should fail for KM runtimes too. re.Runtime.GovernanceModel = api.GovernanceConsensus - re.MustNotRegister(t, backend, consensus) + re.MustNotRegister(t, consensus) re, err = NewTestRuntime([]byte("Runtime re-registration test 3"), entity, false) require.NoError(err, "NewTestRuntime (re-registration test 3)") re.MustRegister(t, backend, consensus) // Entity to consensus governance transition should fail. re.Runtime.GovernanceModel = api.GovernanceConsensus - re.MustNotRegister(t, backend, consensus) + re.MustNotRegister(t, consensus) // No way to de-register the runtime or the controlling entity, so it will be left there. @@ -1615,7 +1615,7 @@ func (rt *TestRuntime) MustRegister(t *testing.T, backend api.Backend, consensus } // MustNotRegister attempts to register the TestRuntime with the provided registry and expects failure. -func (rt *TestRuntime) MustNotRegister(t *testing.T, backend api.Backend, consensus consensusAPI.Backend) { +func (rt *TestRuntime) MustNotRegister(t *testing.T, consensus consensusAPI.Backend) { require := require.New(t) tx := api.NewRegisterRuntimeTx(0, nil, rt.Runtime) diff --git a/go/roothash/api/api.go b/go/roothash/api/api.go index 26cea2a0e30..9ab1f8b683b 100644 --- a/go/roothash/api/api.go +++ b/go/roothash/api/api.go @@ -11,7 +11,6 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/cbor" "github.com/oasisprotocol/oasis-core/go/common/crypto/hash" "github.com/oasisprotocol/oasis-core/go/common/errors" - "github.com/oasisprotocol/oasis-core/go/common/logging" "github.com/oasisprotocol/oasis-core/go/common/pubsub" "github.com/oasisprotocol/oasis-core/go/common/quantity" "github.com/oasisprotocol/oasis-core/go/consensus/api/events" @@ -632,7 +631,7 @@ var DefaultGasCosts = transaction.Costs{ // VerifyRuntimeParameters verifies whether the runtime parameters are valid in the context of the // roothash service. -func VerifyRuntimeParameters(logger *logging.Logger, rt *registry.Runtime, params *ConsensusParameters) error { +func VerifyRuntimeParameters(rt *registry.Runtime, params *ConsensusParameters) error { if rt.Executor.MaxMessages > params.MaxRuntimeMessages { return ErrMaxMessagesTooBig } diff --git a/go/roothash/api/commitment/pool.go b/go/roothash/api/commitment/pool.go index 040e9e22fd1..49fae71da02 100644 --- a/go/roothash/api/commitment/pool.go +++ b/go/roothash/api/commitment/pool.go @@ -471,9 +471,7 @@ func (p *Pool) ProcessCommitments(didTimeout bool) (OpenCommitment, error) { // CheckProposerTimeout verifies executor timeout request conditions. func (p *Pool) CheckProposerTimeout( - ctx context.Context, block *block.Block, - nl NodeLookup, id signature.PublicKey, round uint64, ) error { diff --git a/go/roothash/api/commitment/pool_test.go b/go/roothash/api/commitment/pool_test.go index f49dd20c8a8..ea80853ffeb 100644 --- a/go/roothash/api/commitment/pool_test.go +++ b/go/roothash/api/commitment/pool_test.go @@ -26,7 +26,7 @@ type staticNodeLookup struct { runtime *node.Runtime } -func (n *staticNodeLookup) Node(ctx context.Context, id signature.PublicKey) (*node.Node, error) { +func (n *staticNodeLookup) Node(_ context.Context, id signature.PublicKey) (*node.Node, error) { return &node.Node{ Versioned: cbor.NewVersioned(node.LatestNodeDescriptorVersion), ID: id, @@ -65,7 +65,7 @@ func TestPoolDefault(t *testing.T) { _, err = pool.ProcessCommitments(false) require.Error(t, err, "ProcessCommitments") require.Equal(t, ErrNoCommittee, err) - err = pool.CheckProposerTimeout(context.Background(), blk, &staticNodeLookup{}, sk.Public(), 0) + err = pool.CheckProposerTimeout(blk, sk.Public(), 0) require.Error(t, err, "CheckProposerTimeout") require.Equal(t, ErrNoCommittee, err) } @@ -111,7 +111,7 @@ func TestPoolSingleCommitment(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) nl := &staticNodeLookup{ runtime: &node.Runtime{ @@ -133,7 +133,7 @@ func TestPoolSingleCommitment(t *testing.T) { {"MissingInMessagesHash", func(ec *ExecutorCommitment) { ec.Header.Header.InMessagesHash = nil }, ErrBadExecutorCommitment}, {"BadFailureIndicating", func(ec *ExecutorCommitment) { ec.Header.Failure = FailureUnknown }, ErrBadExecutorCommitment}, } { - _, _, invalidEc := generateExecutorCommitment(t, pool.Round) + _, _, invalidEc := generateExecutorCommitment(pool.Round) tc.fn(&invalidEc) @@ -251,7 +251,7 @@ func TestPoolSingleCommitmentTEE(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) rakSig, err := signature.Sign(skRAK, ComputeResultsHeaderSignatureContext, cbor.Marshal(ec.Header.Header)) require.NoError(t, err, "Sign") ec.Header.RAKSignature = &rakSig.Signature @@ -309,7 +309,7 @@ func TestPoolStragglers(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -354,7 +354,7 @@ func TestPoolStragglers(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec.NodeID = sk1.Public() err := ec.Sign(sk1, rt.ID) @@ -387,7 +387,7 @@ func TestPoolStragglers(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -430,7 +430,7 @@ func TestPoolStragglers(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -486,7 +486,7 @@ func TestPoolStragglers(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -555,7 +555,7 @@ func TestPoolTwoCommitments(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -773,7 +773,7 @@ func TestPoolManyCommitments(t *testing.T) { Round: 0, } - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -805,7 +805,7 @@ func TestPoolManyCommitments(t *testing.T) { Round: 0, } - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec2 := ec ec2.NodeID = sk2.Public() @@ -838,7 +838,7 @@ func TestPoolManyCommitments(t *testing.T) { Discrepancy: true, } - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec4 := ec ec4.NodeID = sk4.Public() @@ -872,7 +872,7 @@ func TestPoolManyCommitments(t *testing.T) { Discrepancy: true, } - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec4 := ec ec4.NodeID = sk4.Public() @@ -926,7 +926,7 @@ func TestPoolFailureIndicatingCommitment(t *testing.T) { } // Generate an executor commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) // Generate a valid commitment. ec1 := ec @@ -1010,7 +1010,7 @@ func TestPoolFailureIndicatingCommitment(t *testing.T) { } // Generate an executor commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) // Generate a valid commitment. ec1 := ec @@ -1132,7 +1132,7 @@ func TestPoolSerialization(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec.NodeID = sk.Public() err = ec.Sign(sk, rt.ID) @@ -1175,7 +1175,7 @@ func TestTryFinalize(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -1235,7 +1235,7 @@ func TestTryFinalize(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() @@ -1337,7 +1337,7 @@ func TestExecutorTimeoutRequest(t *testing.T) { expectedError: nil, }, } { - err := pool.CheckProposerTimeout(ctx, childBlk, nl, tc.signer.Public(), tc.round) + err := pool.CheckProposerTimeout(childBlk, tc.signer.Public(), tc.round) switch tc.expectedError { case nil: require.NoError(err, "CheckProposerTimeout unexpected error") @@ -1347,7 +1347,7 @@ func TestExecutorTimeoutRequest(t *testing.T) { } // Generate a commitment. - childBlk, _, ec := generateExecutorCommitment(t, pool.Round) + childBlk, _, ec := generateExecutorCommitment(pool.Round) ec.NodeID = sk1.Public() err := ec.Sign(sk1, rt.ID) require.NoError(err, "ec.Sign") @@ -1356,7 +1356,7 @@ func TestExecutorTimeoutRequest(t *testing.T) { require.NoError(err, "AddExecutorCommitment") // Timeout after commitment should fail. - err = pool.CheckProposerTimeout(ctx, childBlk, nl, sk2.Public(), 0) + err = pool.CheckProposerTimeout(childBlk, sk2.Public(), 0) require.Error(err, "CheckProposerTimeout commitment exists") require.Equal(ErrAlreadyCommitted, err, "CheckProposerTimeout commitment exists") }) @@ -1423,7 +1423,7 @@ func generateMockCommittee(t *testing.T, rtTemplate *registry.Runtime) ( return } -func generateExecutorCommitment(t *testing.T, round uint64) (*block.Block, *block.Block, ExecutorCommitment) { +func generateExecutorCommitment(round uint64) (*block.Block, *block.Block, ExecutorCommitment) { var id common.Namespace childBlk := block.NewGenesisBlock(id, round) parentBlk := block.NewEmptyBlock(childBlk, 1, block.Normal) @@ -1468,7 +1468,7 @@ func setupDiscrepancy( } // Generate a commitment. - childBlk, parentBlk, ec := generateExecutorCommitment(t, pool.Round) + childBlk, parentBlk, ec := generateExecutorCommitment(pool.Round) ec1 := ec ec1.NodeID = sk1.Public() diff --git a/go/roothash/api/grpc.go b/go/roothash/api/grpc.go index a085d2b698a..bd77c3628ed 100644 --- a/go/roothash/api/grpc.go +++ b/go/roothash/api/grpc.go @@ -455,7 +455,7 @@ func (c *roothashClient) GetIncomingMessageQueue(ctx context.Context, request *I return rsp, nil } -func (c *roothashClient) TrackRuntime(ctx context.Context, history BlockHistory) error { +func (c *roothashClient) TrackRuntime(context.Context, BlockHistory) error { return ErrInvalidArgument } diff --git a/go/roothash/api/history.go b/go/roothash/api/history.go index ac6daf70fe3..8334e2c3a0e 100644 --- a/go/roothash/api/history.go +++ b/go/roothash/api/history.go @@ -34,7 +34,7 @@ type BlockHistory interface { // StorageSyncCheckpoint records the last storage round which was synced // to runtime storage. - StorageSyncCheckpoint(ctx context.Context, round uint64) error + StorageSyncCheckpoint(round uint64) error // LastStorageSyncedRound returns the last runtime round which was synced to storage. LastStorageSyncedRound() (uint64, error) diff --git a/go/roothash/tests/tester.go b/go/roothash/tests/tester.go index 02fd45d3e9a..bb58215c587 100644 --- a/go/roothash/tests/tester.go +++ b/go/roothash/tests/tester.go @@ -102,11 +102,11 @@ func RootHashImplementationTests(t *testing.T, backend api.Backend, consensus co // EpochTransitionBlock was successful. Otherwise this may leave the // committees set to nil and cause a crash. t.Run("SuccessfulRound", func(t *testing.T) { - testSuccessfulRound(t, backend, consensus, identity, rtStates) + testSuccessfulRound(t, backend, consensus, rtStates) }) t.Run("RoundTimeout", func(t *testing.T) { - testRoundTimeout(t, backend, consensus, identity, rtStates) + testRoundTimeout(t, backend, consensus, rtStates) }) t.Run("ProposerTimeout", func(t *testing.T) { @@ -114,7 +114,7 @@ func RootHashImplementationTests(t *testing.T, backend api.Backend, consensus co }) t.Run("RoundTimeoutWithEpochTransition", func(t *testing.T) { - testRoundTimeoutWithEpochTransition(t, backend, consensus, identity, rtStates) + testRoundTimeoutWithEpochTransition(t, backend, consensus, rtStates) }) t.Run("EquivocationEvidence", func(t *testing.T) { @@ -258,13 +258,13 @@ func (s *runtimeState) testEpochTransitionBlock(t *testing.T, consensus consensu } } -func testSuccessfulRound(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, identity *identity.Identity, states []*runtimeState) { +func testSuccessfulRound(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, states []*runtimeState) { for _, state := range states { - state.testSuccessfulRound(t, backend, consensus, identity) + state.testSuccessfulRound(t, backend, consensus) } } -func (s *runtimeState) generateExecutorCommitments(t *testing.T, consensus consensusAPI.Backend, identity *identity.Identity, child *block.Block) ( +func (s *runtimeState) generateExecutorCommitments(t *testing.T, consensus consensusAPI.Backend, child *block.Block) ( parent *block.Block, executorCommits []commitment.ExecutorCommitment, executorNodes []*registryTests.TestNode, @@ -281,7 +281,7 @@ func (s *runtimeState) generateExecutorCommitments(t *testing.T, consensus conse var ns common.Namespace copy(ns[:], rt.Runtime.ID[:]) - storageBackend, err := storage.NewLocalBackend(dataDir, ns, identity) + storageBackend, err := storage.NewLocalBackend(dataDir, ns) require.NoError(err, "storage.New") defer storageBackend.Cleanup() @@ -349,7 +349,7 @@ func (s *runtimeState) generateExecutorCommitments(t *testing.T, consensus conse return } -func (s *runtimeState) testSuccessfulRound(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, identity *identity.Identity) { +func (s *runtimeState) testSuccessfulRound(t *testing.T, backend api.Backend, consensus consensusAPI.Backend) { require := require.New(t) child, err := backend.GetLatestBlock(context.Background(), &api.RuntimeRequest{ @@ -366,7 +366,7 @@ func (s *runtimeState) testSuccessfulRound(t *testing.T, backend api.Backend, co defer cancel() // Generate and submit all executor commitments. - parent, executorCommits, executorNodes := s.generateExecutorCommitments(t, consensus, identity, child) + parent, executorCommits, executorNodes := s.generateExecutorCommitments(t, consensus, child) tx := api.NewExecutorCommitTx(0, nil, s.rt.Runtime.ID, executorCommits) err = consensusAPI.SignAndSubmitTx(ctx, consensus, executorNodes[0].Signer, tx) require.NoError(err, "ExecutorCommit") @@ -457,13 +457,13 @@ func (s *runtimeState) testSuccessfulRound(t *testing.T, backend api.Backend, co } } -func testRoundTimeout(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, identity *identity.Identity, states []*runtimeState) { +func testRoundTimeout(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, states []*runtimeState) { for _, state := range states { - state.testRoundTimeout(t, backend, consensus, identity) + state.testRoundTimeout(t, backend, consensus) } } -func (s *runtimeState) testRoundTimeout(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, identity *identity.Identity) { +func (s *runtimeState) testRoundTimeout(t *testing.T, backend api.Backend, consensus consensusAPI.Backend) { require := require.New(t) child, err := backend.GetLatestBlock(context.Background(), &api.RuntimeRequest{ @@ -480,7 +480,7 @@ func (s *runtimeState) testRoundTimeout(t *testing.T, backend api.Backend, conse defer cancel() // Only submit a single commitment to cause a timeout. - _, executorCommits, executorNodes := s.generateExecutorCommitments(t, consensus, identity, child) + _, executorCommits, executorNodes := s.generateExecutorCommitments(t, consensus, child) tx := api.NewExecutorCommitTx(0, nil, s.rt.Runtime.ID, executorCommits[:1]) err = consensusAPI.SignAndSubmitTx(ctx, consensus, executorNodes[0].Signer, tx) require.NoError(err, "ExecutorCommit") @@ -562,13 +562,13 @@ WaitForRoundTimeoutBlocks: } } -func testRoundTimeoutWithEpochTransition(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, identity *identity.Identity, states []*runtimeState) { +func testRoundTimeoutWithEpochTransition(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, states []*runtimeState) { for _, state := range states { - state.testRoundTimeoutWithEpochTransition(t, backend, consensus, identity) + state.testRoundTimeoutWithEpochTransition(t, backend, consensus) } } -func (s *runtimeState) testRoundTimeoutWithEpochTransition(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, identity *identity.Identity) { +func (s *runtimeState) testRoundTimeoutWithEpochTransition(t *testing.T, backend api.Backend, consensus consensusAPI.Backend) { require := require.New(t) child, err := backend.GetLatestBlock(context.Background(), &api.RuntimeRequest{ @@ -585,7 +585,7 @@ func (s *runtimeState) testRoundTimeoutWithEpochTransition(t *testing.T, backend defer cancel() // Only submit a single commitment to cause a timeout. - _, executorCommits, executorNodes := s.generateExecutorCommitments(t, consensus, identity, child) + _, executorCommits, executorNodes := s.generateExecutorCommitments(t, consensus, child) tx := api.NewExecutorCommitTx(0, nil, s.rt.Runtime.ID, executorCommits[:1]) err = consensusAPI.SignAndSubmitTx(ctx, consensus, executorNodes[0].Signer, tx) require.NoError(err, "ExecutorCommit") @@ -875,7 +875,7 @@ func MustTransitionEpoch( } } -func testSubmitEquivocationEvidence(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, identity *identity.Identity, states []*runtimeState) { +func testSubmitEquivocationEvidence(t *testing.T, backend api.Backend, consensus consensusAPI.Backend, _ *identity.Identity, states []*runtimeState) { require := require.New(t) ctx := context.Background() diff --git a/go/runtime/client/tests/tester.go b/go/runtime/client/tests/tester.go index 7ff35140767..4b6e38a9f9b 100644 --- a/go/runtime/client/tests/tester.go +++ b/go/runtime/client/tests/tester.go @@ -49,7 +49,7 @@ func ClientImplementationTests( t.Run("FailSubmitTx", func(t *testing.T) { ctx, cancelFunc := context.WithTimeout(context.Background(), timeout) defer cancelFunc() - testFailSubmitTransaction(ctx, t, runtimeID, client, testInput) + testFailSubmitTransaction(ctx, t, runtimeID, client) }) } @@ -76,7 +76,6 @@ func testFailSubmitTransaction( t *testing.T, runtimeID common.Namespace, c api.RuntimeClient, - input string, ) { // Failures during CheckTx. resp, err := c.SubmitTxMeta(ctx, &api.SubmitTxRequest{Data: mock.CheckTxFailInput, RuntimeID: runtimeID}) diff --git a/go/runtime/history/history.go b/go/runtime/history/history.go index 58abed60e8e..9b97c265a0b 100644 --- a/go/runtime/history/history.go +++ b/go/runtime/history/history.go @@ -63,15 +63,15 @@ func (h *nopHistory) RuntimeID() common.Namespace { return h.runtimeID } -func (h *nopHistory) Commit(blk *roothash.AnnotatedBlock, roundResults *roothash.RoundResults, notify bool) error { +func (h *nopHistory) Commit(*roothash.AnnotatedBlock, *roothash.RoundResults, bool) error { return errNopHistory } -func (h *nopHistory) ConsensusCheckpoint(height int64) error { +func (h *nopHistory) ConsensusCheckpoint(int64) error { return errNopHistory } -func (h *nopHistory) StorageSyncCheckpoint(ctx context.Context, round uint64) error { +func (h *nopHistory) StorageSyncCheckpoint(uint64) error { return errNopHistory } @@ -83,7 +83,7 @@ func (h *nopHistory) WatchBlocks() (<-chan *roothash.AnnotatedBlock, pubsub.Clos return nil, nil, errNopHistory } -func (h *nopHistory) WaitRoundSynced(ctx context.Context, round uint64) (uint64, error) { +func (h *nopHistory) WaitRoundSynced(context.Context, uint64) (uint64, error) { return 0, errNopHistory } @@ -91,23 +91,23 @@ func (h *nopHistory) LastConsensusHeight() (int64, error) { return 0, errNopHistory } -func (h *nopHistory) GetCommittedBlock(ctx context.Context, round uint64) (*block.Block, error) { +func (h *nopHistory) GetCommittedBlock(context.Context, uint64) (*block.Block, error) { return nil, errNopHistory } -func (h *nopHistory) GetBlock(ctx context.Context, round uint64) (*block.Block, error) { +func (h *nopHistory) GetBlock(context.Context, uint64) (*block.Block, error) { return nil, errNopHistory } -func (h *nopHistory) GetAnnotatedBlock(ctx context.Context, round uint64) (*roothash.AnnotatedBlock, error) { +func (h *nopHistory) GetAnnotatedBlock(context.Context, uint64) (*roothash.AnnotatedBlock, error) { return nil, errNopHistory } -func (h *nopHistory) GetEarliestBlock(ctx context.Context) (*block.Block, error) { +func (h *nopHistory) GetEarliestBlock(context.Context) (*block.Block, error) { return nil, errNopHistory } -func (h *nopHistory) GetRoundResults(ctx context.Context, round uint64) (*roothash.RoundResults, error) { +func (h *nopHistory) GetRoundResults(context.Context, uint64) (*roothash.RoundResults, error) { return nil, errNopHistory } @@ -175,7 +175,7 @@ func (h *runtimeHistory) ConsensusCheckpoint(height int64) error { return h.db.consensusCheckpoint(height) } -func (h *runtimeHistory) StorageSyncCheckpoint(ctx context.Context, round uint64) error { +func (h *runtimeHistory) StorageSyncCheckpoint(round uint64) error { if !h.haveLocalStorageWorker { panic("received storage sync checkpoint when local storage worker is disabled") } diff --git a/go/runtime/history/history_test.go b/go/runtime/history/history_test.go index 8886cd9c6f9..3d630f1d52e 100644 --- a/go/runtime/history/history_test.go +++ b/go/runtime/history/history_test.go @@ -99,11 +99,11 @@ func TestHistory(t *testing.T) { require.NoError(err, "LastConsensusHeight") require.EqualValues(50, lastHeight) - err = history.StorageSyncCheckpoint(ctx, 12) + err = history.StorageSyncCheckpoint(12) require.Error(err, "StorageSyncCheckpoint should fail for non-indexed round") - err = history.StorageSyncCheckpoint(ctx, 10) + err = history.StorageSyncCheckpoint(10) require.NoError(err, "StorageSyncCheckpoint") - err = history.StorageSyncCheckpoint(ctx, 5) + err = history.StorageSyncCheckpoint(5) require.Error(err, "StorageSyncCheckpoint should fail for lower height") lastRound, err = history.LastStorageSyncedRound() @@ -150,7 +150,7 @@ func TestHistory(t *testing.T) { require.Equal(runtimeID, history.RuntimeID()) // Storage sync checkpoint is not persisted. - err = history.StorageSyncCheckpoint(ctx, 10) + err = history.StorageSyncCheckpoint(10) require.NoError(err, "StorageSyncCheckpoint should work") lastHeight, err = history.LastConsensusHeight() @@ -236,7 +236,7 @@ func TestWatchBlocks(t *testing.T) { testWatchBlocks(t, history, 0) // Commit storage checkpoint. - err = history.StorageSyncCheckpoint(ctx, 10) + err = history.StorageSyncCheckpoint(10) require.NoError(err, "StorageSyncCheckpoint") // Block should be received. @@ -266,7 +266,7 @@ func TestWatchBlocks(t *testing.T) { require.EqualValues(10, r, "WaitRoundSynced") // Committing storage checkpoint should panic. - assert.Panics(t, func() { _ = history.StorageSyncCheckpoint(ctx, 10) }, "StorageSyncCheckpoint should panic") + assert.Panics(t, func() { _ = history.StorageSyncCheckpoint(10) }, "StorageSyncCheckpoint should panic") } type testPruneHandler struct { @@ -277,7 +277,7 @@ type testPruneHandler struct { batches []int } -func (h *testPruneHandler) Prune(ctx context.Context, rounds []uint64) error { +func (h *testPruneHandler) Prune(_ context.Context, rounds []uint64) error { // NOTE: Users must ensure that accessing prunedRounds is safe (e.g., that // no more pruning happens using this handler before prunedRounds is // accessed from a different goroutine). @@ -341,7 +341,7 @@ func TestHistoryPrune(t *testing.T) { err = history.Commit(&blk, roundResults, true) require.NoError(err, "Commit") - err = history.StorageSyncCheckpoint(ctx, blk.Block.Header.Round) + err = history.StorageSyncCheckpoint(blk.Block.Header.Round) require.NoError(err, "StorageSyncCheckpoint") } @@ -399,7 +399,7 @@ func TestHistoryPrune(t *testing.T) { type testPruneFailingHandler struct{} -func (h *testPruneFailingHandler) Prune(ctx context.Context, rounds []uint64) error { +func (h *testPruneFailingHandler) Prune(context.Context, []uint64) error { return fmt.Errorf("thou shall not pass") } @@ -435,7 +435,7 @@ func TestHistoryPruneError(t *testing.T) { err = history.Commit(&blk, nil, true) require.NoError(err, "Commit") - err = history.StorageSyncCheckpoint(ctx, blk.Block.Header.Round) + err = history.StorageSyncCheckpoint(blk.Block.Header.Round) require.NoError(err, "StorageSyncCheckpoint") } diff --git a/go/runtime/history/prune.go b/go/runtime/history/prune.go index a93b8e97be7..fb13985d19f 100644 --- a/go/runtime/history/prune.go +++ b/go/runtime/history/prune.go @@ -65,10 +65,10 @@ func newPrunerBase() prunerBase { type nonePruner struct{} -func (p *nonePruner) RegisterHandler(handler PruneHandler) { +func (p *nonePruner) RegisterHandler(PruneHandler) { } -func (p *nonePruner) Prune(ctx context.Context, latestRound uint64) error { +func (p *nonePruner) Prune(context.Context, uint64) error { return nil } diff --git a/go/runtime/host/host.go b/go/runtime/host/host.go index 6b75b9c97a2..ebee20a5759 100644 --- a/go/runtime/host/host.go +++ b/go/runtime/host/host.go @@ -41,7 +41,7 @@ type Provisioner interface { // // This method may return before the runtime is fully provisioned. The returned runtime will not // be started automatically, you must call Start explicitly. - NewRuntime(ctx context.Context, cfg Config) (Runtime, error) + NewRuntime(cfg Config) (Runtime, error) // Name returns the name of the provisioner. Name() string @@ -57,7 +57,7 @@ type Runtime interface { // GetCapabilityTEE retrieves the CapabilityTEE of the runtime. It may be nil in case the // runtime is not running inside a TEE. - GetCapabilityTEE(ctx context.Context) (*node.CapabilityTEE, error) + GetCapabilityTEE() (*node.CapabilityTEE, error) // Call sends a request message to the runtime over the Runtime Host Protocol and waits for the // response (which may be a failure). diff --git a/go/runtime/host/mock/mock.go b/go/runtime/host/mock/mock.go index a5ce1204d7b..6537bcd90fb 100644 --- a/go/runtime/host/mock/mock.go +++ b/go/runtime/host/mock/mock.go @@ -26,7 +26,7 @@ type provisioner struct{} var CheckTxFailInput = []byte("checktx-mock-fail") // Implements host.Provisioner. -func (p *provisioner) NewRuntime(ctx context.Context, cfg host.Config) (host.Runtime, error) { +func (p *provisioner) NewRuntime(cfg host.Config) (host.Runtime, error) { r := &runtime{ runtimeID: cfg.Bundle.Manifest.ID, notifier: pubsub.NewBroker(false), @@ -51,7 +51,7 @@ func (r *runtime) ID() common.Namespace { } // Implements host.Runtime. -func (r *runtime) GetInfo(ctx context.Context) (*protocol.RuntimeInfoResponse, error) { +func (r *runtime) GetInfo(context.Context) (*protocol.RuntimeInfoResponse, error) { return &protocol.RuntimeInfoResponse{ ProtocolVersion: version.RuntimeHostProtocol, RuntimeVersion: version.MustFromString("0.0.0"), @@ -64,7 +64,7 @@ func (r *runtime) GetInfo(ctx context.Context) (*protocol.RuntimeInfoResponse, e } // Implements host.Runtime. -func (r *runtime) GetCapabilityTEE(ctx context.Context) (*node.CapabilityTEE, error) { +func (r *runtime) GetCapabilityTEE() (*node.CapabilityTEE, error) { return nil, nil } @@ -185,12 +185,12 @@ func (r *runtime) Call(ctx context.Context, body *protocol.Body) (*protocol.Body } // Implements host.Runtime. -func (r *runtime) UpdateCapabilityTEE(ctx context.Context) error { +func (r *runtime) UpdateCapabilityTEE(context.Context) error { return nil } // Implements host.Runtime. -func (r *runtime) WatchEvents(ctx context.Context) (<-chan *host.Event, pubsub.ClosableSubscription, error) { +func (r *runtime) WatchEvents(context.Context) (<-chan *host.Event, pubsub.ClosableSubscription, error) { typedCh := make(chan *host.Event) sub := r.notifier.Subscribe() sub.Unwrap(typedCh) @@ -207,7 +207,7 @@ func (r *runtime) Start() error { } // Implements host.Runtime. -func (r *runtime) Abort(ctx context.Context, force bool) error { +func (r *runtime) Abort(context.Context, bool) error { return nil } diff --git a/go/runtime/host/multi/multi.go b/go/runtime/host/multi/multi.go index ba48b1989b8..c7c52f949a3 100644 --- a/go/runtime/host/multi/multi.go +++ b/go/runtime/host/multi/multi.go @@ -133,14 +133,14 @@ func (agg *Aggregate) GetInfo(ctx context.Context) (*protocol.RuntimeInfoRespons } // GetCapabilityTEE implements host.Runtime. -func (agg *Aggregate) GetCapabilityTEE(ctx context.Context) (*node.CapabilityTEE, error) { +func (agg *Aggregate) GetCapabilityTEE() (*node.CapabilityTEE, error) { agg.l.RLock() defer agg.l.RUnlock() if agg.active == nil { return nil, ErrNoActiveVersion } - return agg.active.host.GetCapabilityTEE(ctx) + return agg.active.host.GetCapabilityTEE() } // Call implements host.Runtime. @@ -187,7 +187,7 @@ func (agg *Aggregate) UpdateCapabilityTEE(ctx context.Context) error { } // WatchEvents implements host.Runtime. -func (agg *Aggregate) WatchEvents(ctx context.Context) (<-chan *host.Event, pubsub.ClosableSubscription, error) { +func (agg *Aggregate) WatchEvents(context.Context) (<-chan *host.Event, pubsub.ClosableSubscription, error) { typedCh := make(chan *host.Event) sub := agg.notifier.Subscribe() sub.Unwrap(typedCh) @@ -232,7 +232,7 @@ func (agg *Aggregate) Stop() { } // GetVersion retrieves the runtime host for the specified version. -func (agg *Aggregate) GetVersion(ctx context.Context, version version.Version) (host.Runtime, error) { +func (agg *Aggregate) GetVersion(version version.Version) (host.Runtime, error) { agg.l.RLock() defer agg.l.RUnlock() @@ -253,7 +253,7 @@ func (agg *Aggregate) GetVersion(ctx context.Context, version version.Version) ( // - Start the newly active version if it exists. // - Do nothing if the next version is already the requested version. // - Start the next version if it exists. -func (agg *Aggregate) SetVersion(ctx context.Context, active version.Version, next *version.Version) error { +func (agg *Aggregate) SetVersion(active version.Version, next *version.Version) error { agg.l.Lock() defer agg.l.Unlock() @@ -263,16 +263,16 @@ func (agg *Aggregate) SetVersion(ctx context.Context, active version.Version, ne "next", next, ) - if err := agg.setActiveVersionLocked(ctx, active); err != nil { + if err := agg.setActiveVersionLocked(active); err != nil { return err } - if err := agg.setNextVersionLocked(ctx, next); err != nil { + if err := agg.setNextVersionLocked(next); err != nil { return err } return nil } -func (agg *Aggregate) setActiveVersionLocked(ctx context.Context, version version.Version) error { +func (agg *Aggregate) setActiveVersionLocked(version version.Version) error { // Contract: agg.l already locked for write. next := agg.hosts[version] @@ -372,7 +372,7 @@ func (agg *Aggregate) stopActiveLocked() { agg.active = nil } -func (agg *Aggregate) setNextVersionLocked(ctx context.Context, maybeVersion *version.Version) error { +func (agg *Aggregate) setNextVersionLocked(maybeVersion *version.Version) error { // Contract: agg.l already locked for write. // The next version could become unscheduled, in this case tear it down. diff --git a/go/runtime/host/protocol/connection.go b/go/runtime/host/protocol/connection.go index d683b61c41f..832235eaa23 100644 --- a/go/runtime/host/protocol/connection.go +++ b/go/runtime/host/protocol/connection.go @@ -92,7 +92,7 @@ type Connection interface { Close() // GetInfo retrieves the runtime information. - GetInfo(ctx context.Context) (*RuntimeInfoResponse, error) + GetInfo() (*RuntimeInfoResponse, error) // Call sends a request to the other side and returns the response or error. Call(ctx context.Context, body *Body) (*Body, error) @@ -110,7 +110,7 @@ type Connection interface { // state. // // Only one of InitHost/InitGuest can be called otherwise the method may panic. - InitGuest(ctx context.Context, conn net.Conn) error + InitGuest(conn net.Conn) error } // HostInfo contains the information about the host environment that is sent to the runtime during @@ -260,7 +260,7 @@ func (c *connection) Close() { } // Implements Connection. -func (c *connection) GetInfo(ctx context.Context) (*RuntimeInfoResponse, error) { +func (c *connection) GetInfo() (*RuntimeInfoResponse, error) { c.Lock() defer c.Unlock() @@ -515,7 +515,7 @@ func (c *connection) initConn(conn net.Conn) { } // Implements Connection. -func (c *connection) InitGuest(ctx context.Context, conn net.Conn) error { +func (c *connection) InitGuest(conn net.Conn) error { c.initConn(conn) // Transition the protocol state to Ready. diff --git a/go/runtime/host/protocol/connection_test.go b/go/runtime/host/protocol/connection_test.go index d82282ffe6b..ebe2ab45951 100644 --- a/go/runtime/host/protocol/connection_test.go +++ b/go/runtime/host/protocol/connection_test.go @@ -19,7 +19,7 @@ type testHandler struct { } // Implements Handler. -func (h *testHandler) Handle(ctx context.Context, body *Body) (*Body, error) { +func (h *testHandler) Handle(_ context.Context, body *Body) (*Body, error) { // We need to handle RuntimeInfoRequest for initialization to complete. if body.RuntimeInfoRequest != nil { return &Body{ @@ -58,15 +58,15 @@ func TestEchoRequestResponse(t *testing.T) { protoB, err := NewConnection(logger, runtimeID, handlerB) require.NoError(err, "B.New()") - err = protoA.InitGuest(context.Background(), connA) + err = protoA.InitGuest(connA) require.NoError(err, "A.InitGuest()") _, err = protoB.InitHost(context.Background(), connB, &HostInfo{}) require.NoError(err, "B.InitHost()") require.Panics(func() { _, _ = protoA.InitHost(context.Background(), connA, &HostInfo{}) }, "connection reinit should panic") - require.Panics(func() { _ = protoA.InitGuest(context.Background(), connA) }, "connection reinit should panic") + require.Panics(func() { _ = protoA.InitGuest(connA) }, "connection reinit should panic") require.Panics(func() { _, _ = protoB.InitHost(context.Background(), connB, &HostInfo{}) }, "connection reinit should panic") - require.Panics(func() { _ = protoB.InitGuest(context.Background(), connB) }, "connection reinit should panic") + require.Panics(func() { _ = protoB.InitGuest(connB) }, "connection reinit should panic") reqA := Body{Empty: &Empty{}} respA, err := protoA.Call(context.Background(), &reqA) @@ -91,13 +91,13 @@ func TestEchoRequestResponse(t *testing.T) { require.Error(err, "B.Call() must error when connection is closed") require.Panics(func() { _, _ = protoA.InitHost(context.Background(), connA, &HostInfo{}) }, "connection reinit should panic") - require.Panics(func() { _ = protoA.InitGuest(context.Background(), connA) }, "connection reinit should panic") + require.Panics(func() { _ = protoA.InitGuest(connA) }, "connection reinit should panic") require.Panics(func() { _, _ = protoB.InitHost(context.Background(), connB, &HostInfo{}) }, "connection reinit should panic") - require.Panics(func() { _ = protoB.InitGuest(context.Background(), connB) }, "connection reinit should panic") + require.Panics(func() { _ = protoB.InitGuest(connB) }, "connection reinit should panic") - _, err = protoA.GetInfo(context.Background()) + _, err = protoA.GetInfo() require.Error(err, "GetInfo should fail for guest connections") - info, err := protoB.GetInfo(context.Background()) + info, err := protoB.GetInfo() require.NoError(err, "GetInfo should succeed for host connections") require.EqualValues(version.RuntimeHostProtocol, info.ProtocolVersion) } @@ -115,7 +115,7 @@ func TestBigMessage(t *testing.T) { protoB, err := NewConnection(logger, runtimeID, handlerB) require.NoError(err, "B.New()") - err = protoA.InitGuest(context.Background(), connA) + err = protoA.InitGuest(connA) require.NoError(err, "A.InitGuest()") _, err = protoB.InitHost(context.Background(), connB, &HostInfo{}) require.NoError(err, "B.InitHost()") diff --git a/go/runtime/host/sandbox/sandbox.go b/go/runtime/host/sandbox/sandbox.go index 2d381592160..241a8455264 100644 --- a/go/runtime/host/sandbox/sandbox.go +++ b/go/runtime/host/sandbox/sandbox.go @@ -78,7 +78,7 @@ type provisioner struct { } // Implements host.Provisioner. -func (p *provisioner) NewRuntime(ctx context.Context, cfg host.Config) (host.Runtime, error) { +func (p *provisioner) NewRuntime(cfg host.Config) (host.Runtime, error) { id := cfg.Bundle.Manifest.ID r := &sandboxedRuntime{ @@ -144,7 +144,7 @@ func (r *sandboxedRuntime) GetInfo(ctx context.Context) (rsp *protocol.RuntimeIn if r.conn == nil { return errRuntimeNotReady } - rsp, err = r.conn.GetInfo(ctx) + rsp, err = r.conn.GetInfo() return err } @@ -154,7 +154,7 @@ func (r *sandboxedRuntime) GetInfo(ctx context.Context) (rsp *protocol.RuntimeIn } // Implements host.Runtime. -func (r *sandboxedRuntime) GetCapabilityTEE(ctx context.Context) (*node.CapabilityTEE, error) { +func (r *sandboxedRuntime) GetCapabilityTEE() (*node.CapabilityTEE, error) { r.RLock() defer r.RUnlock() @@ -197,7 +197,7 @@ func (r *sandboxedRuntime) UpdateCapabilityTEE(ctx context.Context) error { } // Implements host.Runtime. -func (r *sandboxedRuntime) WatchEvents(ctx context.Context) (<-chan *host.Event, pubsub.ClosableSubscription, error) { +func (r *sandboxedRuntime) WatchEvents(context.Context) (<-chan *host.Event, pubsub.ClosableSubscription, error) { typedCh := make(chan *host.Event) sub := r.notifier.Subscribe() sub.Unwrap(typedCh) diff --git a/go/runtime/host/sgx/ecdsa.go b/go/runtime/host/sgx/ecdsa.go index a5300d4d809..12fb6206577 100644 --- a/go/runtime/host/sgx/ecdsa.go +++ b/go/runtime/host/sgx/ecdsa.go @@ -92,7 +92,7 @@ func (ec *teeStateECDSA) verifyBundle(quote pcs.Quote, quotePolicy *pcs.QuotePol } } -func (ec *teeStateECDSA) Update(ctx context.Context, sp *sgxProvisioner, conn protocol.Connection, report []byte, nonce string) ([]byte, error) { +func (ec *teeStateECDSA) Update(ctx context.Context, sp *sgxProvisioner, conn protocol.Connection, report []byte, _ string) ([]byte, error) { rawQuote, err := sp.aesm.GetQuoteEx(ctx, ec.key, report) if err != nil { return nil, fmt.Errorf("failed to get quote: %w", err) diff --git a/go/runtime/host/sgx/epid.go b/go/runtime/host/sgx/epid.go index e149f5b4184..c0024e1ab35 100644 --- a/go/runtime/host/sgx/epid.go +++ b/go/runtime/host/sgx/epid.go @@ -23,7 +23,7 @@ type teeStateEPID struct { quoteType *cmnIAS.SignatureType } -func (ep *teeStateEPID) Init(ctx context.Context, sp *sgxProvisioner, runtimeID common.Namespace, version version.Version) ([]byte, error) { +func (ep *teeStateEPID) Init(ctx context.Context, sp *sgxProvisioner, runtimeID common.Namespace, _ version.Version) ([]byte, error) { qi, err := sp.aesm.InitQuote(ctx) if err != nil { return nil, fmt.Errorf("error while getting quote info from AESMD: %w", err) diff --git a/go/runtime/host/sgx/sgx.go b/go/runtime/host/sgx/sgx.go index e70c9771e50..3c19e8f46aa 100644 --- a/go/runtime/host/sgx/sgx.go +++ b/go/runtime/host/sgx/sgx.go @@ -290,7 +290,7 @@ func (s *sgxProvisioner) hostInitializer(ctx context.Context, hp *sandbox.HostIn return nil, fmt.Errorf("failed to initialize TEE: %w", err) } var capabilityTEE *node.CapabilityTEE - if capabilityTEE, err = s.updateCapabilityTEE(ctx, s.logger, ts, hp.Connection); err != nil { + if capabilityTEE, err = s.updateCapabilityTEE(ctx, ts, hp.Connection); err != nil { return nil, fmt.Errorf("failed to initialize TEE: %w", err) } @@ -337,7 +337,7 @@ func (s *sgxProvisioner) updateTargetInfo(ctx context.Context, targetInfo []byte return err } -func (s *sgxProvisioner) updateCapabilityTEE(ctx context.Context, logger *logging.Logger, ts *teeState, conn protocol.Connection) (*node.CapabilityTEE, error) { +func (s *sgxProvisioner) updateCapabilityTEE(ctx context.Context, ts *teeState, conn protocol.Connection) (*node.CapabilityTEE, error) { ctx, cancel := context.WithTimeout(ctx, runtimeRAKTimeout) defer cancel() @@ -401,7 +401,7 @@ func (s *sgxProvisioner) attestationWorker(ts *teeState, hp *sandbox.HostInitial // Update CapabilityTEE. logger.Info("regenerating CapabilityTEE") - capabilityTEE, err := s.updateCapabilityTEE(context.Background(), logger, ts, hp.Connection) + capabilityTEE, err := s.updateCapabilityTEE(context.Background(), ts, hp.Connection) if err != nil { logger.Error("failed to regenerate CapabilityTEE", "err", err, @@ -418,13 +418,13 @@ func (s *sgxProvisioner) attestationWorker(ts *teeState, hp *sandbox.HostInitial } // Implements host.Provisioner. -func (s *sgxProvisioner) NewRuntime(ctx context.Context, cfg host.Config) (host.Runtime, error) { +func (s *sgxProvisioner) NewRuntime(cfg host.Config) (host.Runtime, error) { // Make sure to return an error early if the SGX runtime loader is not configured. if s.cfg.LoaderPath == "" { return nil, fmt.Errorf("SGX loader binary path is not configured") } - return s.sandbox.NewRuntime(ctx, cfg) + return s.sandbox.NewRuntime(cfg) } // Implements host.Provisioner. diff --git a/go/runtime/host/sgx/sgx_test.go b/go/runtime/host/sgx/sgx_test.go index fe8f561fd04..57190ae9941 100644 --- a/go/runtime/host/sgx/sgx_test.go +++ b/go/runtime/host/sgx/sgx_test.go @@ -103,7 +103,7 @@ func TestProvisionerSGX(t *testing.T) { func testAttestationWorker(t *testing.T, cfg host.Config, p host.Provisioner) { require := require.New(t) - r, err := p.NewRuntime(context.Background(), cfg) + r, err := p.NewRuntime(cfg) require.NoError(err, "NewRuntime") err = r.Start() require.NoError(err, "Start") diff --git a/go/runtime/host/tests/tester.go b/go/runtime/host/tests/tester.go index 9d8bce6472b..793988982f7 100644 --- a/go/runtime/host/tests/tester.go +++ b/go/runtime/host/tests/tester.go @@ -32,7 +32,7 @@ const ( type mockMessageHandler struct{} // Implements host.Handler. -func (h *mockMessageHandler) Handle(ctx context.Context, body *protocol.Body) (*protocol.Body, error) { +func (h *mockMessageHandler) Handle(context.Context, *protocol.Body) (*protocol.Body, error) { return nil, fmt.Errorf("method not supported") } @@ -104,7 +104,7 @@ func mockKeyManagerPolicyRequest() (*protocol.Body, error) { func testBasic(t *testing.T, cfg host.Config, p host.Provisioner) { require := require.New(t) - r, err := p.NewRuntime(context.Background(), cfg) + r, err := p.NewRuntime(cfg) require.NoError(err, "NewRuntime") err = r.Start() require.NoError(err, "Start") @@ -151,7 +151,7 @@ func testBasic(t *testing.T, cfg host.Config, p host.Provisioner) { func testRestart(t *testing.T, cfg host.Config, p host.Provisioner) { require := require.New(t) - r, err := p.NewRuntime(context.Background(), cfg) + r, err := p.NewRuntime(cfg) require.NoError(err, "NewRuntime") err = r.Start() require.NoError(err, "Start") diff --git a/go/runtime/registry/host.go b/go/runtime/registry/host.go index 1da4131aba3..e05cbda2689 100644 --- a/go/runtime/registry/host.go +++ b/go/runtime/registry/host.go @@ -75,7 +75,7 @@ func (n *RuntimeHostNode) ProvisionHostedRuntime(ctx context.Context) (host.Rich rtCfg.MessageHandler = msgHandler // Provision the runtime. - if rts[version], err = provisioner.NewRuntime(ctx, rtCfg); err != nil { + if rts[version], err = provisioner.NewRuntime(rtCfg); err != nil { return nil, nil, fmt.Errorf("failed to provision runtime version %s: %w", version, err) } } @@ -119,7 +119,7 @@ func (n *RuntimeHostNode) WaitHostedRuntime(ctx context.Context) (host.RichRunti } // GetHostedRuntimeCapabilityTEE returns the CapabilityTEE for a specific runtime version. -func (n *RuntimeHostNode) GetHostedRuntimeCapabilityTEE(ctx context.Context, version version.Version) (*node.CapabilityTEE, error) { +func (n *RuntimeHostNode) GetHostedRuntimeCapabilityTEE(version version.Version) (*node.CapabilityTEE, error) { n.Lock() agg := n.agg n.Unlock() @@ -128,15 +128,15 @@ func (n *RuntimeHostNode) GetHostedRuntimeCapabilityTEE(ctx context.Context, ver return nil, fmt.Errorf("runtime not available") } - rt, err := agg.GetVersion(ctx, version) + rt, err := agg.GetVersion(version) if err != nil { return nil, err } - return rt.GetCapabilityTEE(ctx) + return rt.GetCapabilityTEE() } // SetHostedRuntimeVersion sets the currently active and next versions for the hosted runtime. -func (n *RuntimeHostNode) SetHostedRuntimeVersion(ctx context.Context, active version.Version, next *version.Version) error { +func (n *RuntimeHostNode) SetHostedRuntimeVersion(active version.Version, next *version.Version) error { n.Lock() agg := n.agg n.Unlock() @@ -145,7 +145,7 @@ func (n *RuntimeHostNode) SetHostedRuntimeVersion(ctx context.Context, active ve return fmt.Errorf("runtime not available") } - return agg.SetVersion(ctx, active, next) + return agg.SetVersion(active, next) } // RuntimeHostHandlerFactory is an interface that can be used to create new runtime handlers and @@ -177,13 +177,13 @@ var ( // RuntimeHostHandlerEnvironment is the host environment interface. type RuntimeHostHandlerEnvironment interface { // GetKeyManagerClient returns the key manager client for this runtime. - GetKeyManagerClient(ctx context.Context) (runtimeKeymanager.Client, error) + GetKeyManagerClient() (runtimeKeymanager.Client, error) // GetTxPool returns the transaction pool for this runtime. - GetTxPool(ctx context.Context) (txpool.TransactionPool, error) + GetTxPool() (txpool.TransactionPool, error) // GetNodeIdentity returns the identity of a node running this runtime. - GetNodeIdentity(ctx context.Context) (*identity.Identity, error) + GetNodeIdentity() (*identity.Identity, error) // GetLightClient returns the consensus light client. GetLightClient() (consensus.LightClient, error) @@ -204,7 +204,7 @@ func (h *runtimeHostHandler) handleHostRPCCall( switch rq.Endpoint { case runtimeKeymanager.EnclaveRPCEndpoint: // Call into the remote key manager. - kmCli, err := h.env.GetKeyManagerClient(ctx) + kmCli, err := h.env.GetKeyManagerClient() if err != nil { return nil, err } @@ -267,7 +267,6 @@ func (h *runtimeHostHandler) handleHostStorageSync( } func (h *runtimeHostHandler) handleHostLocalStorageGet( - ctx context.Context, rq *protocol.HostLocalStorageGetRequest, ) (*protocol.HostLocalStorageGetResponse, error) { value, err := h.runtime.LocalStorage().Get(rq.Key) @@ -278,7 +277,6 @@ func (h *runtimeHostHandler) handleHostLocalStorageGet( } func (h *runtimeHostHandler) handleHostLocalStorageSet( - ctx context.Context, rq *protocol.HostLocalStorageSetRequest, ) (*protocol.Empty, error) { if err := h.runtime.LocalStorage().Set(rq.Key, rq.Value); err != nil { @@ -355,7 +353,6 @@ func (h *runtimeHostHandler) handleHostFetchConsensusEvents( func (h *runtimeHostHandler) handleHostFetchGenesisHeight( ctx context.Context, - rq *protocol.HostFetchGenesisHeightRequest, ) (*protocol.HostFetchGenesisHeightResponse, error) { doc, err := h.consensus.GetGenesisDocument(ctx) if err != nil { @@ -365,10 +362,9 @@ func (h *runtimeHostHandler) handleHostFetchGenesisHeight( } func (h *runtimeHostHandler) handleHostFetchTxBatch( - ctx context.Context, rq *protocol.HostFetchTxBatchRequest, ) (*protocol.HostFetchTxBatchResponse, error) { - txPool, err := h.env.GetTxPool(ctx) + txPool, err := h.env.GetTxPool() if err != nil { return nil, err } @@ -427,7 +423,7 @@ func (h *runtimeHostHandler) handleHostProveFreshness( ctx context.Context, rq *protocol.HostProveFreshnessRequest, ) (*protocol.HostProveFreshnessResponse, error) { - identity, err := h.env.GetNodeIdentity(ctx) + identity, err := h.env.GetNodeIdentity() if err != nil { return nil, err } @@ -443,11 +439,8 @@ func (h *runtimeHostHandler) handleHostProveFreshness( }, nil } -func (h *runtimeHostHandler) handleHostIdentity( - ctx context.Context, - rq *protocol.HostIdentityRequest, -) (*protocol.HostIdentityResponse, error) { - identity, err := h.env.GetNodeIdentity(ctx) +func (h *runtimeHostHandler) handleHostIdentity() (*protocol.HostIdentityResponse, error) { + identity, err := h.env.GetNodeIdentity() if err != nil { return nil, err } @@ -473,10 +466,10 @@ func (h *runtimeHostHandler) Handle(ctx context.Context, rq *protocol.Body) (*pr rsp.HostStorageSyncResponse, err = h.handleHostStorageSync(ctx, rq.HostStorageSyncRequest) case rq.HostLocalStorageGetRequest != nil: // Local storage get. - rsp.HostLocalStorageGetResponse, err = h.handleHostLocalStorageGet(ctx, rq.HostLocalStorageGetRequest) + rsp.HostLocalStorageGetResponse, err = h.handleHostLocalStorageGet(rq.HostLocalStorageGetRequest) case rq.HostLocalStorageSetRequest != nil: // Local storage set. - rsp.HostLocalStorageSetResponse, err = h.handleHostLocalStorageSet(ctx, rq.HostLocalStorageSetRequest) + rsp.HostLocalStorageSetResponse, err = h.handleHostLocalStorageSet(rq.HostLocalStorageSetRequest) case rq.HostFetchConsensusBlockRequest != nil: // Consensus light client. rsp.HostFetchConsensusBlockResponse, err = h.handleHostFetchConsensusBlock(ctx, rq.HostFetchConsensusBlockRequest) @@ -485,10 +478,10 @@ func (h *runtimeHostHandler) Handle(ctx context.Context, rq *protocol.Body) (*pr rsp.HostFetchConsensusEventsResponse, err = h.handleHostFetchConsensusEvents(ctx, rq.HostFetchConsensusEventsRequest) case rq.HostFetchGenesisHeightRequest != nil: // Consensus genesis height. - rsp.HostFetchGenesisHeightResponse, err = h.handleHostFetchGenesisHeight(ctx, rq.HostFetchGenesisHeightRequest) + rsp.HostFetchGenesisHeightResponse, err = h.handleHostFetchGenesisHeight(ctx) case rq.HostFetchTxBatchRequest != nil: // Transaction pool. - rsp.HostFetchTxBatchResponse, err = h.handleHostFetchTxBatch(ctx, rq.HostFetchTxBatchRequest) + rsp.HostFetchTxBatchResponse, err = h.handleHostFetchTxBatch(rq.HostFetchTxBatchRequest) case rq.HostFetchBlockMetadataTxRequest != nil: // Block metadata. rsp.HostFetchBlockMetadataTxResponse, err = h.handleHostFetchBlockMetadataTx(ctx, rq.HostFetchBlockMetadataTxRequest) @@ -497,7 +490,7 @@ func (h *runtimeHostHandler) Handle(ctx context.Context, rq *protocol.Body) (*pr rsp.HostProveFreshnessResponse, err = h.handleHostProveFreshness(ctx, rq.HostProveFreshnessRequest) case rq.HostIdentityRequest != nil: // Host identity. - rsp.HostIdentityResponse, err = h.handleHostIdentity(ctx, rq.HostIdentityRequest) + rsp.HostIdentityResponse, err = h.handleHostIdentity() default: err = errMethodNotSupported } diff --git a/go/runtime/registry/registry.go b/go/runtime/registry/registry.go index 7958c04198d..99b9fd5d100 100644 --- a/go/runtime/registry/registry.go +++ b/go/runtime/registry/registry.go @@ -60,7 +60,7 @@ type Registry interface { Cleanup() // FinishInitialization finalizes setup for all runtimes. - FinishInitialization(ctx context.Context) error + FinishInitialization() error } // Runtime is the running node's supported runtime interface. @@ -389,7 +389,7 @@ func (r *runtime) watchUpdates(ctx context.Context) { } } -func (r *runtime) finishInitialization(ctx context.Context) error { +func (r *runtime) finishInitialization() error { r.Lock() defer r.Unlock() @@ -467,12 +467,12 @@ func (r *runtimeRegistry) Cleanup() { } } -func (r *runtimeRegistry) FinishInitialization(ctx context.Context) error { +func (r *runtimeRegistry) FinishInitialization() error { r.RLock() defer r.RUnlock() for _, rt := range r.runtimes { - if err := rt.finishInitialization(ctx); err != nil { + if err := rt.finishInitialization(); err != nil { return err } } diff --git a/go/runtime/txpool/local_queue.go b/go/runtime/txpool/local_queue.go index 47c71f6feda..2b1caedb468 100644 --- a/go/runtime/txpool/local_queue.go +++ b/go/runtime/txpool/local_queue.go @@ -26,7 +26,7 @@ func newLocalQueue() *localQueue { } } -func (lq *localQueue) GetSchedulingSuggestion(countHint uint32) []*TxQueueMeta { +func (lq *localQueue) GetSchedulingSuggestion(uint32) []*TxQueueMeta { lq.l.Lock() defer lq.l.Unlock() return append([]*TxQueueMeta(nil), lq.txs...) diff --git a/go/runtime/txpool/rim_queue.go b/go/runtime/txpool/rim_queue.go index 1347b1a5382..5ddce0eebee 100644 --- a/go/runtime/txpool/rim_queue.go +++ b/go/runtime/txpool/rim_queue.go @@ -21,7 +21,7 @@ func newRimQueue() *rimQueue { } } -func (rq *rimQueue) GetSchedulingSuggestion(countHint uint32) []*TxQueueMeta { +func (rq *rimQueue) GetSchedulingSuggestion(uint32) []*TxQueueMeta { // Runtimes instead get transactions from the incoming messages. return nil } @@ -32,7 +32,7 @@ func (rq *rimQueue) GetTxByHash(h hash.Hash) *TxQueueMeta { return rq.txs[h] } -func (rq *rimQueue) HandleTxsUsed(hashes []hash.Hash) { +func (rq *rimQueue) HandleTxsUsed([]hash.Hash) { // The roothash module manages the incoming message queue on its own, so we don't do anything here. } diff --git a/go/runtime/txpool/txpool.go b/go/runtime/txpool/txpool.go index f982ca8510e..3802600a239 100644 --- a/go/runtime/txpool/txpool.go +++ b/go/runtime/txpool/txpool.go @@ -69,7 +69,7 @@ type TransactionPool interface { SubmitTx(ctx context.Context, tx []byte, meta *TransactionMeta) (*protocol.CheckTxResult, error) // SubmitTxNoWait adds the transaction into the transaction pool and returns immediately. - SubmitTxNoWait(ctx context.Context, tx []byte, meta *TransactionMeta) error + SubmitTxNoWait(tx []byte, meta *TransactionMeta) error // SubmitProposedBatch adds the given (possibly new) transaction batch into the current // proposal queue. @@ -224,7 +224,7 @@ func (t *txPool) Quit() <-chan struct{} { func (t *txPool) SubmitTx(ctx context.Context, rawTx []byte, meta *TransactionMeta) (*protocol.CheckTxResult, error) { notifyCh := make(chan *protocol.CheckTxResult, 1) - err := t.submitTx(ctx, rawTx, meta, notifyCh) + err := t.submitTx(rawTx, meta, notifyCh) if err != nil { close(notifyCh) return nil, err @@ -241,11 +241,11 @@ func (t *txPool) SubmitTx(ctx context.Context, rawTx []byte, meta *TransactionMe } } -func (t *txPool) SubmitTxNoWait(ctx context.Context, tx []byte, meta *TransactionMeta) error { - return t.submitTx(ctx, tx, meta, nil) +func (t *txPool) SubmitTxNoWait(tx []byte, meta *TransactionMeta) error { + return t.submitTx(tx, meta, nil) } -func (t *txPool) submitTx(ctx context.Context, rawTx []byte, meta *TransactionMeta, notifyCh chan *protocol.CheckTxResult) error { +func (t *txPool) submitTx(rawTx []byte, meta *TransactionMeta, notifyCh chan *protocol.CheckTxResult) error { tx := &TxQueueMeta{ raw: rawTx, hash: hash.NewFromBytes(rawTx), @@ -298,7 +298,7 @@ func (t *txPool) addToCheckQueue(pct *PendingCheckTransaction) error { func (t *txPool) SubmitProposedBatch(batch [][]byte) { // Also ingest into the regular pool (may fail). for _, rawTx := range batch { - _ = t.SubmitTxNoWait(context.Background(), rawTx, &TransactionMeta{Local: false}) + _ = t.SubmitTxNoWait(rawTx, &TransactionMeta{Local: false}) } t.proposedTxsLock.Lock() diff --git a/go/sentry/api/grpc.go b/go/sentry/api/grpc.go index 4f5211db8a4..23e1b575af4 100644 --- a/go/sentry/api/grpc.go +++ b/go/sentry/api/grpc.go @@ -32,7 +32,7 @@ var ( func handlerGetAddresses( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { diff --git a/go/sentry/sentry.go b/go/sentry/sentry.go index b614d5259a1..33cb33b8965 100644 --- a/go/sentry/sentry.go +++ b/go/sentry/sentry.go @@ -23,7 +23,7 @@ type backend struct { identity *identity.Identity } -func (b *backend) GetAddresses(ctx context.Context) (*api.SentryAddresses, error) { +func (b *backend) GetAddresses(context.Context) (*api.SentryAddresses, error) { // Consensus addresses. consensusAddrs, err := b.consensus.GetAddresses() if err != nil { @@ -38,8 +38,6 @@ func (b *backend) GetAddresses(ctx context.Context) (*api.SentryAddresses, error }, nil } -// func (b *backend) GetPolicyChecker(ctx context.Context, service cmnGrpc.ServiceName) (*policy.DynamicRuntimePolicyChecker, error) { - // New constructs a new sentry Backend instance. func New( consensusBackend consensus.Backend, diff --git a/go/staking/api/api.go b/go/staking/api/api.go index 5acedcf1bb9..e497d3d00a1 100644 --- a/go/staking/api/api.go +++ b/go/staking/api/api.go @@ -506,7 +506,7 @@ type ReclaimEscrow struct { // PrettyPrint writes a pretty-printed representation of ReclaimEscrow to the // given writer. -func (re ReclaimEscrow) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (re ReclaimEscrow) PrettyPrint(_ context.Context, prefix string, w io.Writer) { fmt.Fprintf(w, "%sFrom: %s\n", prefix, re.Account) fmt.Fprintf(w, "%sShares: %s\n", prefix, re.Shares) @@ -828,7 +828,7 @@ func (st StakeThreshold) String() string { // PrettyPrint writes a pretty-printed representation of StakeThreshold to the // given writer. -func (st StakeThreshold) PrettyPrint(ctx context.Context, prefix string, w io.Writer) { +func (st StakeThreshold) PrettyPrint(_ context.Context, prefix string, w io.Writer) { switch { case st.Global != nil: fmt.Fprintf(w, "%s- Global: %s\n", prefix, *st.Global) diff --git a/go/staking/api/grpc.go b/go/staking/api/grpc.go index aa82d04b2cb..64cebf479c5 100644 --- a/go/staking/api/grpc.go +++ b/go/staking/api/grpc.go @@ -157,7 +157,7 @@ var ( func handlerTokenSymbol( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { @@ -176,7 +176,7 @@ func handlerTokenSymbol( func handlerTokenValueExponent( srv interface{}, ctx context.Context, - dec func(interface{}) error, + _ func(interface{}) error, interceptor grpc.UnaryServerInterceptor, ) (interface{}, error) { if interceptor == nil { diff --git a/go/staking/tests/tester.go b/go/staking/tests/tester.go index 3ff3b979765..d4227af71bd 100644 --- a/go/staking/tests/tester.go +++ b/go/staking/tests/tester.go @@ -13,7 +13,6 @@ import ( beacon "github.com/oasisprotocol/oasis-core/go/beacon/api" beaconTests "github.com/oasisprotocol/oasis-core/go/beacon/tests" "github.com/oasisprotocol/oasis-core/go/common" - "github.com/oasisprotocol/oasis-core/go/common/crypto/signature" "github.com/oasisprotocol/oasis-core/go/common/entity" "github.com/oasisprotocol/oasis-core/go/common/identity" "github.com/oasisprotocol/oasis-core/go/common/quantity" @@ -40,7 +39,7 @@ type accountData struct { // update updates additional data about a staking account or returns a testing // error. -func (a *accountData) update(t *testing.T, backend api.Backend, consensus consensusAPI.Backend) { +func (a *accountData) update(t *testing.T, backend api.Backend) { require := require.New(t) require.NotNil(a.Address, "accountData update: address must be defined") @@ -83,12 +82,12 @@ func (a accountDataList) getAccount(index int) accountData { // update updates the i-th accountData in the list or panics. // // NOTE: Indexing is 1-based, NOT 0-based. -func (a accountDataList) update(index int, t *testing.T, backend api.Backend, consensus consensusAPI.Backend) { +func (a accountDataList) update(index int, t *testing.T, backend api.Backend) { i := index - 1 if i < 0 || i >= len(a) { panic(fmt.Sprintf("Account with index: %d doesn't exist", index)) } - a[i].update(t, backend, consensus) + a[i].update(t, backend) } // stakingTestsState holds the current state of staking tests. @@ -100,7 +99,7 @@ type stakingTestsState struct { } // update updates staking tests' state or returns a testing error. -func (s *stakingTestsState) update(t *testing.T, backend api.Backend, consensus consensusAPI.Backend) { +func (s *stakingTestsState) update(t *testing.T, backend api.Backend) { require := require.New(t) totalSupply, err := backend.TotalSupply(context.Background(), consensusAPI.HeightLatest) @@ -112,13 +111,13 @@ func (s *stakingTestsState) update(t *testing.T, backend api.Backend, consensus s.commonPool = commonPool for i := 1; i <= NumAccounts; i++ { - s.accounts.update(i, t, backend, consensus) + s.accounts.update(i, t, backend) } } // newStakingTestsState returns a new staking tests' state or returns a testing // error. -func newStakingTestsState(t *testing.T, backend api.Backend, consensus consensusAPI.Backend) (state *stakingTestsState) { +func newStakingTestsState(t *testing.T, backend api.Backend) (state *stakingTestsState) { state = &stakingTestsState{} accountDataList := make([]accountData, NumAccounts) for i := 0; i < NumAccounts; i++ { @@ -127,7 +126,7 @@ func newStakingTestsState(t *testing.T, backend api.Backend, consensus consensus } } state.accounts = accountDataList - state.update(t, backend, consensus) + state.update(t, backend) return } @@ -145,7 +144,6 @@ func StakingImplementationTests( consensus consensusAPI.Backend, identity *identity.Identity, entity *entity.Entity, - entitySigner signature.Signer, runtimeID common.Namespace, ) { for _, tc := range []struct { @@ -164,14 +162,14 @@ func StakingImplementationTests( {"EscrowSelf", testSelfEscrow}, {"Allowance", testAllowance}, } { - state := newStakingTestsState(t, backend, consensus) + state := newStakingTestsState(t, backend) t.Run(tc.n, func(t *testing.T) { tc.fn(t, state, backend, consensus) }) } // Separate test as it requires some arguments that others don't. t.Run("SlashConsensusEquivocation", func(t *testing.T) { - state := newStakingTestsState(t, backend, consensus) - testSlashConsensusEquivocation(t, state, backend, consensus, identity, entity, entitySigner, runtimeID) + state := newStakingTestsState(t, backend) + testSlashConsensusEquivocation(t, state, backend, consensus, identity, entity, runtimeID) }) } @@ -192,12 +190,12 @@ func StakingClientImplementationTests(t *testing.T, backend api.Backend, consens {"EscrowSelf", testSelfEscrow}, {"Allowance", testAllowance}, } { - state := newStakingTestsState(t, backend, consensus) + state := newStakingTestsState(t, backend) t.Run(tc.n, func(t *testing.T) { tc.fn(t, state, backend, consensus) }) } } -func testThresholds(t *testing.T, state *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend) { +func testThresholds(t *testing.T, _ *stakingTestsState, backend api.Backend, _ consensusAPI.Backend) { require := require.New(t) for _, kind := range []api.ThresholdKind{ @@ -214,7 +212,7 @@ func testThresholds(t *testing.T, state *stakingTestsState, backend api.Backend, } } -func testCommonPool(t *testing.T, state *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend) { +func testCommonPool(t *testing.T, _ *stakingTestsState, backend api.Backend, _ consensusAPI.Backend) { require := require.New(t) commonPool, err := backend.CommonPool(context.Background(), consensusAPI.HeightLatest) @@ -225,7 +223,7 @@ func testCommonPool(t *testing.T, state *stakingTestsState, backend api.Backend, require.EqualValues(commonPool, &commonPoolAcc.General.Balance, "CommonPool Account - initial value should match") } -func testLastBlockFees(t *testing.T, state *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend) { +func testLastBlockFees(t *testing.T, _ *stakingTestsState, backend api.Backend, _ consensusAPI.Backend) { require := require.New(t) lastBlockFees, err := backend.LastBlockFees(context.Background(), consensusAPI.HeightLatest) @@ -237,7 +235,7 @@ func testLastBlockFees(t *testing.T, state *stakingTestsState, backend api.Backe require.True(lastBlockFeesAcc.General.Balance.IsZero(), "LastBlockFees Account - initial value") } -func testGovernanceDeposits(t *testing.T, state *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend) { +func testGovernanceDeposits(t *testing.T, _ *stakingTestsState, backend api.Backend, _ consensusAPI.Backend) { require := require.New(t) governanceDeposits, err := backend.GovernanceDeposits(context.Background(), consensusAPI.HeightLatest) @@ -249,7 +247,7 @@ func testGovernanceDeposits(t *testing.T, state *stakingTestsState, backend api. require.True(governanceDepositsAcc.General.Balance.IsZero(), "GovernaceDeposits Account - initial value") } -func testDelegations(t *testing.T, state *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend) { +func testDelegations(t *testing.T, state *stakingTestsState, backend api.Backend, _ consensusAPI.Backend) { require := require.New(t) accts := state.accounts @@ -467,7 +465,7 @@ func testSelfTransfer(t *testing.T, state *stakingTestsState, backend api.Backen func testTransferHelper( t *testing.T, - state *stakingTestsState, + _ *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend, srcAccData, destAccData accountData, @@ -710,7 +708,7 @@ func testSelfEscrow(t *testing.T, state *stakingTestsState, backend api.Backend, func testEscrowHelper( // nolint: gocyclo t *testing.T, - state *stakingTestsState, + _ *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend, srcAccData, destAccData accountData, @@ -1040,7 +1038,7 @@ func testAllowance(t *testing.T, state *stakingTestsState, backend api.Backend, func testAllowanceHelper( t *testing.T, - state *stakingTestsState, + _ *stakingTestsState, backend api.Backend, consensus consensusAPI.Backend, srcAccData, destAccData accountData, @@ -1187,7 +1185,6 @@ func testSlashConsensusEquivocation( consensus consensusAPI.Backend, ident *identity.Identity, ent *entity.Entity, - entSigner signature.Signer, runtimeID common.Namespace, ) { ctx := context.Background() diff --git a/go/storage/api/root_cache.go b/go/storage/api/root_cache.go index f3d294607de..eaf5bb35b55 100644 --- a/go/storage/api/root_cache.go +++ b/go/storage/api/root_cache.go @@ -16,7 +16,7 @@ type RootCache struct { // GetTree gets a tree entry from the cache by the root iff present, or creates // a new tree with the specified root in the node database. -func (rc *RootCache) GetTree(ctx context.Context, root Root) (mkvs.Tree, error) { +func (rc *RootCache) GetTree(root Root) (mkvs.Tree, error) { return mkvs.NewWithRoot(nil, rc.localDB, root), nil } diff --git a/go/storage/database/database.go b/go/storage/database/database.go index 35cefc518a6..a91879cebb3 100644 --- a/go/storage/database/database.go +++ b/go/storage/database/database.go @@ -103,7 +103,7 @@ func (ba *databaseBackend) Initialized() <-chan struct{} { } func (ba *databaseBackend) SyncGet(ctx context.Context, request *api.GetRequest) (*api.ProofResponse, error) { - tree, err := ba.rootCache.GetTree(ctx, request.Tree.Root) + tree, err := ba.rootCache.GetTree(request.Tree.Root) if err != nil { return nil, err } @@ -113,7 +113,7 @@ func (ba *databaseBackend) SyncGet(ctx context.Context, request *api.GetRequest) } func (ba *databaseBackend) SyncGetPrefixes(ctx context.Context, request *api.GetPrefixesRequest) (*api.ProofResponse, error) { - tree, err := ba.rootCache.GetTree(ctx, request.Tree.Root) + tree, err := ba.rootCache.GetTree(request.Tree.Root) if err != nil { return nil, err } @@ -123,7 +123,7 @@ func (ba *databaseBackend) SyncGetPrefixes(ctx context.Context, request *api.Get } func (ba *databaseBackend) SyncIterate(ctx context.Context, request *api.IterateRequest) (*api.ProofResponse, error) { - tree, err := ba.rootCache.GetTree(ctx, request.Tree.Root) + tree, err := ba.rootCache.GetTree(request.Tree.Root) if err != nil { return nil, err } diff --git a/go/storage/mkvs/checkpoint/checkpoint_test.go b/go/storage/mkvs/checkpoint/checkpoint_test.go index 3bfa7cd36b0..1c9abace472 100644 --- a/go/storage/mkvs/checkpoint/checkpoint_test.go +++ b/go/storage/mkvs/checkpoint/checkpoint_test.go @@ -216,7 +216,7 @@ func TestFileCheckpointCreator(t *testing.T) { require.True(errors.Is(err, ErrChunkAlreadyRestored)) } } - err = ndb2.Finalize(ctx, []node.Root{root}) + err = ndb2.Finalize([]node.Root{root}) require.NoError(err, "Finalize") // Verify that everything has been restored. @@ -368,7 +368,7 @@ func TestPruneGapAfterCheckpointRestore(t *testing.T) { Type: node.RootTypeState, Hash: rootHash1, } - err = ndb1.Finalize(ctx, []node.Root{root1}) + err = ndb1.Finalize([]node.Root{root1}) require.NoError(err, "Finalize") tree1.Close() @@ -383,7 +383,7 @@ func TestPruneGapAfterCheckpointRestore(t *testing.T) { Type: node.RootTypeState, Hash: rootHash2, } - err = ndb2.Finalize(ctx, []node.Root{root2}) + err = ndb2.Finalize([]node.Root{root2}) require.NoError(err, "Finalize") tree2.Close() } @@ -420,7 +420,7 @@ func TestPruneGapAfterCheckpointRestore(t *testing.T) { _, err = rs.RestoreChunk(ctx, uint64(i), &buf) require.NoError(err, "RestoreChunk") } - err = ndb2.Finalize(ctx, []node.Root{root}) + err = ndb2.Finalize([]node.Root{root}) require.NoError(err, "Finalize") // Now attempt to prune everything up to (but excluding) the current root. @@ -452,7 +452,7 @@ func TestPruneGapAfterCheckpointRestore(t *testing.T) { Type: node.RootTypeState, Hash: rootHash1, } - err = ndb1.Finalize(ctx, []node.Root{root1}) + err = ndb1.Finalize([]node.Root{root1}) require.NoError(err, "Finalize") tree1.Close() @@ -466,7 +466,7 @@ func TestPruneGapAfterCheckpointRestore(t *testing.T) { Type: node.RootTypeState, Hash: rootHash2, } - err = ndb2.Finalize(ctx, []node.Root{root2}) + err = ndb2.Finalize([]node.Root{root2}) require.NoError(err, "Finalize") tree2.Close() diff --git a/go/storage/mkvs/checkpoint/checkpointer.go b/go/storage/mkvs/checkpoint/checkpointer.go index 98245e8a0cc..68f33e81740 100644 --- a/go/storage/mkvs/checkpoint/checkpointer.go +++ b/go/storage/mkvs/checkpoint/checkpointer.go @@ -137,7 +137,7 @@ func (c *checkpointer) checkpoint(ctx context.Context, version uint64, params *C var roots []node.Root if c.cfg.GetRoots == nil { - roots, err = c.ndb.GetRootsForVersion(ctx, version) + roots, err = c.ndb.GetRootsForVersion(version) } else { roots, err = c.cfg.GetRoots(ctx, version) } diff --git a/go/storage/mkvs/checkpoint/checkpointer_test.go b/go/storage/mkvs/checkpoint/checkpointer_test.go index 8ccb2535ef2..c3fdbd660bb 100644 --- a/go/storage/mkvs/checkpoint/checkpointer_test.go +++ b/go/storage/mkvs/checkpoint/checkpointer_test.go @@ -57,7 +57,7 @@ func testCheckpointer(t *testing.T, earliestVersion, interval uint64, preExistin root.Version = round root.Hash = rootHash - err = ndb.Finalize(ctx, []node.Root{root}) + err = ndb.Finalize([]node.Root{root}) require.NoError(err, "Finalize") } } else { @@ -85,7 +85,7 @@ func testCheckpointer(t *testing.T, earliestVersion, interval uint64, preExistin // Simulate early block fetch failing. return nil, fmt.Errorf("version not found") } - return ndb.GetRootsForVersion(ctx, version) + return ndb.GetRootsForVersion(version) }, }) require.NoError(err, "NewCheckpointer") @@ -108,7 +108,7 @@ func testCheckpointer(t *testing.T, earliestVersion, interval uint64, preExistin root.Version = round root.Hash = rootHash - err = ndb.Finalize(ctx, []node.Root{root}) + err = ndb.Finalize([]node.Root{root}) require.NoError(err, "Finalize") cp.NotifyNewVersion(round) diff --git a/go/storage/mkvs/checkpoint/file.go b/go/storage/mkvs/checkpoint/file.go index 3aaaa23bbc0..986898a8485 100644 --- a/go/storage/mkvs/checkpoint/file.go +++ b/go/storage/mkvs/checkpoint/file.go @@ -103,7 +103,7 @@ func (fc *fileCreator) CreateCheckpoint(ctx context.Context, root node.Root, chu return meta, nil } -func (fc *fileCreator) GetCheckpoints(ctx context.Context, request *GetCheckpointsRequest) ([]*Metadata, error) { +func (fc *fileCreator) GetCheckpoints(_ context.Context, request *GetCheckpointsRequest) ([]*Metadata, error) { // Currently we only support a single version so we report no checkpoints for other versions. if request.Version != checkpointVersion { return []*Metadata{}, nil @@ -137,7 +137,7 @@ func (fc *fileCreator) GetCheckpoints(ctx context.Context, request *GetCheckpoin return cps, nil } -func (fc *fileCreator) GetCheckpoint(ctx context.Context, version uint16, root node.Root) (*Metadata, error) { +func (fc *fileCreator) GetCheckpoint(_ context.Context, version uint16, root node.Root) (*Metadata, error) { // Currently we only support a single version. if version != checkpointVersion { return nil, ErrCheckpointNotFound @@ -161,7 +161,7 @@ func (fc *fileCreator) GetCheckpoint(ctx context.Context, version uint16, root n return &cp, nil } -func (fc *fileCreator) DeleteCheckpoint(ctx context.Context, version uint16, root node.Root) error { +func (fc *fileCreator) DeleteCheckpoint(_ context.Context, version uint16, root node.Root) error { // Currently we only support a single version. if version != checkpointVersion { return ErrCheckpointNotFound @@ -200,7 +200,7 @@ func (fc *fileCreator) DeleteCheckpoint(ctx context.Context, version uint16, roo return nil } -func (fc *fileCreator) GetCheckpointChunk(ctx context.Context, chunk *ChunkMetadata, w io.Writer) error { +func (fc *fileCreator) GetCheckpointChunk(_ context.Context, chunk *ChunkMetadata, w io.Writer) error { // Currently we only support a single version. if chunk.Version != checkpointVersion { return ErrChunkNotFound diff --git a/go/storage/mkvs/checkpoint/restorer.go b/go/storage/mkvs/checkpoint/restorer.go index 14f34c49385..e00a21d3ab8 100644 --- a/go/storage/mkvs/checkpoint/restorer.go +++ b/go/storage/mkvs/checkpoint/restorer.go @@ -23,7 +23,7 @@ type restorer struct { } // Implements Restorer. -func (rs *restorer) StartRestore(ctx context.Context, checkpoint *Metadata) error { +func (rs *restorer) StartRestore(_ context.Context, checkpoint *Metadata) error { rs.Lock() defer rs.Unlock() @@ -40,7 +40,7 @@ func (rs *restorer) StartRestore(ctx context.Context, checkpoint *Metadata) erro return nil } -func (rs *restorer) AbortRestore(ctx context.Context) error { +func (rs *restorer) AbortRestore(context.Context) error { rs.Lock() defer rs.Unlock() diff --git a/go/storage/mkvs/db/api/api.go b/go/storage/mkvs/db/api/api.go index 14f066d0668..47fb0a06183 100644 --- a/go/storage/mkvs/db/api/api.go +++ b/go/storage/mkvs/db/api/api.go @@ -96,7 +96,7 @@ type NodeDB interface { GetEarliestVersion() uint64 // GetRootsForVersion returns a list of roots stored under the given version. - GetRootsForVersion(ctx context.Context, version uint64) ([]node.Root, error) + GetRootsForVersion(version uint64) ([]node.Root, error) // StartMultipartInsert prepares the database for a batch insert job from multiple chunks. // Batches from this call onwards will keep track of inserted nodes so that they can be @@ -123,7 +123,7 @@ type NodeDB interface { // Finalize finalizes the version comprising the passed list of finalized roots. // All non-finalized roots can be discarded. - Finalize(ctx context.Context, roots []node.Root) error + Finalize(roots []node.Root) error // Prune removes all roots recorded under the given version. // @@ -194,7 +194,7 @@ func (b *BaseBatch) OnCommit(hook func()) { b.onCommitHooks = append(b.onCommitHooks, hook) } -func (b *BaseBatch) Commit(root node.Root) error { +func (b *BaseBatch) Commit(node.Root) error { for _, hook := range b.onCommitHooks { hook() } @@ -210,11 +210,11 @@ func NewNopNodeDB() (NodeDB, error) { return &nopNodeDB{}, nil } -func (d *nopNodeDB) GetNode(root node.Root, ptr *node.Pointer) (node.Node, error) { +func (d *nopNodeDB) GetNode(node.Root, *node.Pointer) (node.Node, error) { return nil, ErrNodeNotFound } -func (d *nopNodeDB) GetWriteLog(ctx context.Context, startRoot, endRoot node.Root) (writelog.Iterator, error) { +func (d *nopNodeDB) GetWriteLog(context.Context, node.Root, node.Root) (writelog.Iterator, error) { return nil, ErrWriteLogNotFound } @@ -226,15 +226,15 @@ func (d *nopNodeDB) GetEarliestVersion() uint64 { return 0 } -func (d *nopNodeDB) GetRootsForVersion(ctx context.Context, version uint64) ([]node.Root, error) { +func (d *nopNodeDB) GetRootsForVersion(uint64) ([]node.Root, error) { return nil, nil } -func (d *nopNodeDB) HasRoot(root node.Root) bool { +func (d *nopNodeDB) HasRoot(node.Root) bool { return false } -func (d *nopNodeDB) StartMultipartInsert(version uint64) error { +func (d *nopNodeDB) StartMultipartInsert(uint64) error { return nil } @@ -242,11 +242,11 @@ func (d *nopNodeDB) AbortMultipartInsert() error { return nil } -func (d *nopNodeDB) Finalize(ctx context.Context, roots []node.Root) error { +func (d *nopNodeDB) Finalize([]node.Root) error { return nil } -func (d *nopNodeDB) Prune(ctx context.Context, version uint64) error { +func (d *nopNodeDB) Prune(context.Context, uint64) error { return nil } @@ -266,19 +266,19 @@ type nopBatch struct { BaseBatch } -func (d *nopNodeDB) NewBatch(oldRoot node.Root, version uint64, chunk bool) (Batch, error) { +func (d *nopNodeDB) NewBatch(node.Root, uint64, bool) (Batch, error) { return &nopBatch{}, nil } -func (b *nopBatch) MaybeStartSubtree(subtree Subtree, depth node.Depth, subtreeRoot *node.Pointer) Subtree { +func (b *nopBatch) MaybeStartSubtree(Subtree, node.Depth, *node.Pointer) Subtree { return &nopSubtree{} } -func (b *nopBatch) PutWriteLog(writeLog writelog.WriteLog, logAnnotations writelog.Annotations) error { +func (b *nopBatch) PutWriteLog(writelog.WriteLog, writelog.Annotations) error { return nil } -func (b *nopBatch) RemoveNodes(nodes []node.Node) error { +func (b *nopBatch) RemoveNodes([]node.Node) error { return nil } @@ -288,11 +288,11 @@ func (b *nopBatch) Reset() { // nopSubtree is a no-op subtree. type nopSubtree struct{} -func (s *nopSubtree) PutNode(depth node.Depth, ptr *node.Pointer) error { +func (s *nopSubtree) PutNode(node.Depth, *node.Pointer) error { return nil } -func (s *nopSubtree) VisitCleanNode(depth node.Depth, ptr *node.Pointer) error { +func (s *nopSubtree) VisitCleanNode(node.Depth, *node.Pointer) error { return nil } diff --git a/go/storage/mkvs/db/badger/badger.go b/go/storage/mkvs/db/badger/badger.go index e0f1b7cfc83..763e24dcaa4 100644 --- a/go/storage/mkvs/db/badger/badger.go +++ b/go/storage/mkvs/db/badger/badger.go @@ -476,7 +476,7 @@ func (d *badgerNodeDB) GetEarliestVersion() uint64 { return d.meta.getEarliestVersion() } -func (d *badgerNodeDB) GetRootsForVersion(ctx context.Context, version uint64) (roots []node.Root, err error) { +func (d *badgerNodeDB) GetRootsForVersion(version uint64) (roots []node.Root, err error) { // If the version is earlier than the earliest version, we don't have the roots. if version < d.meta.getEarliestVersion() { return nil, nil @@ -528,7 +528,7 @@ func (d *badgerNodeDB) HasRoot(root node.Root) bool { return exists } -func (d *badgerNodeDB) Finalize(ctx context.Context, roots []node.Root) error { // nolint: gocyclo +func (d *badgerNodeDB) Finalize(roots []node.Root) error { // nolint: gocyclo if d.readOnly { return api.ErrReadOnly } @@ -949,7 +949,7 @@ type badgerBatch struct { updatedNodes []updatedNode } -func (ba *badgerBatch) MaybeStartSubtree(subtree api.Subtree, depth node.Depth, subtreeRoot *node.Pointer) api.Subtree { +func (ba *badgerBatch) MaybeStartSubtree(subtree api.Subtree, _ node.Depth, _ *node.Pointer) api.Subtree { if subtree == nil { return &badgerSubtree{batch: ba} } @@ -1125,7 +1125,7 @@ type badgerSubtree struct { batch *badgerBatch } -func (s *badgerSubtree) PutNode(depth node.Depth, ptr *node.Pointer) error { +func (s *badgerSubtree) PutNode(_ node.Depth, ptr *node.Pointer) error { data, err := ptr.Node.MarshalBinary() if err != nil { return err @@ -1148,7 +1148,7 @@ func (s *badgerSubtree) PutNode(depth node.Depth, ptr *node.Pointer) error { return nil } -func (s *badgerSubtree) VisitCleanNode(depth node.Depth, ptr *node.Pointer) error { +func (s *badgerSubtree) VisitCleanNode(node.Depth, *node.Pointer) error { return nil } diff --git a/go/storage/mkvs/db/badger/badger_test.go b/go/storage/mkvs/db/badger/badger_test.go index 990aa6c9f44..31b7ba825a7 100644 --- a/go/storage/mkvs/db/badger/badger_test.go +++ b/go/storage/mkvs/db/badger/badger_test.go @@ -245,15 +245,15 @@ func testFinalize(ctx *test) { restoreCheckpoint(ctx, ctx.ckMeta, ctx.ckNodes) // Test parameter sanity checking first. - err := ctx.badgerdb.Finalize(ctx.ctx, nil) + err := ctx.badgerdb.Finalize(nil) ctx.require.Error(err, "Finalize with no roots should fail") bogusRoot := ctx.ckMeta.Root bogusRoot.Version++ - err = ctx.badgerdb.Finalize(ctx.ctx, []node.Root{ctx.ckMeta.Root, bogusRoot}) + err = ctx.badgerdb.Finalize([]node.Root{ctx.ckMeta.Root, bogusRoot}) ctx.require.Error(err, "Finalize with roots from different versions should fail") - err = ctx.badgerdb.Finalize(ctx.ctx, []node.Root{ctx.ckMeta.Root}) + err = ctx.badgerdb.Finalize([]node.Root{ctx.ckMeta.Root}) ctx.require.NoError(err, "Finalize()") verifyNodes(ctx.require, ctx.badgerdb, ctx.ckNodes) @@ -280,7 +280,7 @@ func testExistingNodes(ctx *test) { // Restore first checkpoint. The database is empty. restoreCheckpoint(ctx, ctx.ckMeta, ctx.ckNodes) - err := ctx.badgerdb.Finalize(ctx.ctx, []node.Root{ctx.ckMeta.Root}) + err := ctx.badgerdb.Finalize([]node.Root{ctx.ckMeta.Root}) ctx.require.NoError(err, "Finalize()") verifyNodes(ctx.require, ctx.badgerdb, ctx.ckNodes) @@ -369,13 +369,13 @@ func TestFinalizeBasic(t *testing.T) { defer ndb.Close() root1 := fillDB(ctx, require, testValues, nil, 1, 2, ndb) - err = ndb.Finalize(ctx, []node.Root{root1}) + err = ndb.Finalize([]node.Root{root1}) require.NoError(err, "Finalize({root1})") // Finalize a corrupted root. currentValues := offset(testValues) root2 := fillDB(ctx, require, currentValues, &root1, 2, 3, ndb) root2.Hash[3]++ - err = ndb.Finalize(ctx, []node.Root{root2}) + err = ndb.Finalize([]node.Root{root2}) require.Errorf(err, "mkvs: root not found", "Finalize({root2-broken})") } diff --git a/go/storage/mkvs/db/badger/migrate_test.go b/go/storage/mkvs/db/badger/migrate_test.go index 8ee93d5726d..cd180d972df 100644 --- a/go/storage/mkvs/db/badger/migrate_test.go +++ b/go/storage/mkvs/db/badger/migrate_test.go @@ -86,23 +86,23 @@ func (mh *testMigrationHelper) GetRootForHash(root hash.Hash, version uint64) ([ }}, nil } -func (mh *testMigrationHelper) Display(msg string) { +func (mh *testMigrationHelper) Display(string) { // Nothing to do here for testing. } -func (mh *testMigrationHelper) DisplayStepBegin(msg string) { +func (mh *testMigrationHelper) DisplayStepBegin(string) { // Nothing to do here for testing. } -func (mh *testMigrationHelper) DisplayStepEnd(msg string) { +func (mh *testMigrationHelper) DisplayStepEnd(string) { // Nothing to do here for testing. } -func (mh *testMigrationHelper) DisplayStep(msg string) { +func (mh *testMigrationHelper) DisplayStep(string) { // Nothing to do here for testing. } -func (mh *testMigrationHelper) DisplayProgress(msg string, current, total uint64) { +func (mh *testMigrationHelper) DisplayProgress(string, uint64, uint64) { // Nothing to fo here for testing. } @@ -130,7 +130,7 @@ func TestBadgerV5MigrationSimple(t *testing.T) { Type: node.RootTypeState, Hash: tc.PendingRoot, } - err = ndb.Finalize(ctx, []node.Root{finalRoot}) + err = ndb.Finalize([]node.Root{finalRoot}) require.NoError(t, err, "Finalize") checkContents(ctx, t, ndb, finalRoot, testData) @@ -178,7 +178,7 @@ func TestBadgerV5MigrationChunks(t *testing.T) { Hash: tc.PendingRoot, } bdb.multipartVersion = 2 // Simulate state in the middle of a chunk restore. - err = ndb.Finalize(ctx, []node.Root{finalRoot}) + err = ndb.Finalize([]node.Root{finalRoot}) require.NoError(t, err, "Finalize") require.Equal(t, false, checkMultipart(), "checkMultipart-2") @@ -236,7 +236,7 @@ func TestBadgerV5MigrationCrashMeta(t *testing.T) { Type: node.RootTypeState, Hash: tc.PendingRoot, } - err = ndb.Finalize(ctx, []node.Root{finalRoot}) + err = ndb.Finalize([]node.Root{finalRoot}) require.NoError(t, err, "Finalize") checkContents(ctx, t, ndb, finalRoot, testData) @@ -286,7 +286,7 @@ func TestBadgerV5SharedRoots(t *testing.T) { // Finalize all the rounds first. for round := uint64(2); round < rounds; round++ { - err = ndb.Finalize(ctx, []node.Root{ + err = ndb.Finalize([]node.Root{ { Namespace: testNs, Version: round, @@ -362,7 +362,7 @@ func TestBadgerV5ToEmpty(t *testing.T) { // Finalize all the rounds first. for round := uint64(2); round < rounds; round++ { - err = ndb.Finalize(ctx, []node.Root{ + err = ndb.Finalize([]node.Root{ { Namespace: testNs, Version: round, diff --git a/go/storage/mkvs/interop/cmd/db_json_rpc.go b/go/storage/mkvs/interop/cmd/db_json_rpc.go index 2a1db7dfc2a..7b20a63056d 100644 --- a/go/storage/mkvs/interop/cmd/db_json_rpc.go +++ b/go/storage/mkvs/interop/cmd/db_json_rpc.go @@ -109,7 +109,7 @@ type ( type ApplyResponse struct{} -func (db *Database) Apply(request ApplyRequest, response *ApplyResponse) error { +func (db *Database) Apply(request ApplyRequest, _ *ApplyResponse) error { if l := len(request); l != 1 { return fmt.Errorf("Apply: invalid number of requests: %d", l) } diff --git a/go/storage/mkvs/interop/cmd/protocol_server.go b/go/storage/mkvs/interop/cmd/protocol_server.go index e31a8867a8f..161cbda9197 100644 --- a/go/storage/mkvs/interop/cmd/protocol_server.go +++ b/go/storage/mkvs/interop/cmd/protocol_server.go @@ -41,7 +41,7 @@ var ( logger = logging.GetLogger("cmd/protocol_server") ) -func doProtoServer(cmd *cobra.Command, args []string) { +func doProtoServer(*cobra.Command, []string) { svcMgr := background.NewServiceManager(logger) defer svcMgr.Cleanup() diff --git a/go/storage/mkvs/interop/fixtures/consensus_mock.go b/go/storage/mkvs/interop/fixtures/consensus_mock.go index 0a61b3b61ee..5557bab1a04 100644 --- a/go/storage/mkvs/interop/fixtures/consensus_mock.go +++ b/go/storage/mkvs/interop/fixtures/consensus_mock.go @@ -49,7 +49,7 @@ func (c *consensusMock) Populate(ctx context.Context, ndb db.NodeDB) (*node.Root if err != nil { return nil, fmt.Errorf("consensus-mock: failed to committ tree: %w", err) } - if err = ndb.Finalize(ctx, []node.Root{testRoot}); err != nil { + if err = ndb.Finalize([]node.Root{testRoot}); err != nil { return nil, fmt.Errorf("consensus-mock: failed to finalize test root: %w", err) } diff --git a/go/storage/mkvs/overlay.go b/go/storage/mkvs/overlay.go index 5c2652d0193..fb9ae5a3d30 100644 --- a/go/storage/mkvs/overlay.go +++ b/go/storage/mkvs/overlay.go @@ -34,7 +34,7 @@ func NewOverlay(inner KeyValueTree) OverlayTree { } // Implements KeyValueTree. -func (o *treeOverlay) Insert(ctx context.Context, key, value []byte) error { +func (o *treeOverlay) Insert(_ context.Context, key, value []byte) error { o.overlay.Set(string(key), value) o.dirty[string(key)] = true return nil @@ -73,7 +73,7 @@ func (o *treeOverlay) RemoveExisting(ctx context.Context, key []byte) ([]byte, e } // Implements KeyValueTree. -func (o *treeOverlay) Remove(ctx context.Context, key []byte) error { +func (o *treeOverlay) Remove(_ context.Context, key []byte) error { // Since we don't care about the previous value, we can just record an update. o.dirty[string(key)] = true o.overlay.Delete(string(key)) @@ -241,12 +241,12 @@ type treeOverlayWrapper struct { } // Implements OverlayTree. -func (tow *treeOverlayWrapper) Copy(inner KeyValueTree) OverlayTree { +func (tow *treeOverlayWrapper) Copy(KeyValueTree) OverlayTree { panic("copy not supported") } // Implements OverlayTree. -func (tow *treeOverlayWrapper) Commit(ctx context.Context) (KeyValueTree, error) { +func (tow *treeOverlayWrapper) Commit(context.Context) (KeyValueTree, error) { return tow.Tree, nil } diff --git a/go/storage/mkvs/syncer/syncer.go b/go/storage/mkvs/syncer/syncer.go index e748c782e0b..f3c75ca188b 100644 --- a/go/storage/mkvs/syncer/syncer.go +++ b/go/storage/mkvs/syncer/syncer.go @@ -76,14 +76,14 @@ type nopReadSyncer struct{} // NopReadSyncer is a no-op read syncer. var NopReadSyncer = &nopReadSyncer{} -func (r *nopReadSyncer) SyncGet(ctx context.Context, request *GetRequest) (*ProofResponse, error) { +func (r *nopReadSyncer) SyncGet(context.Context, *GetRequest) (*ProofResponse, error) { return nil, ErrUnsupported } -func (r *nopReadSyncer) SyncGetPrefixes(ctx context.Context, request *GetPrefixesRequest) (*ProofResponse, error) { +func (r *nopReadSyncer) SyncGetPrefixes(context.Context, *GetPrefixesRequest) (*ProofResponse, error) { return nil, ErrUnsupported } -func (r *nopReadSyncer) SyncIterate(ctx context.Context, request *IterateRequest) (*ProofResponse, error) { +func (r *nopReadSyncer) SyncIterate(context.Context, *IterateRequest) (*ProofResponse, error) { return nil, ErrUnsupported } diff --git a/go/storage/mkvs/tree_test.go b/go/storage/mkvs/tree_test.go index 006cff1c6db..8f3cb913b8f 100644 --- a/go/storage/mkvs/tree_test.go +++ b/go/storage/mkvs/tree_test.go @@ -129,7 +129,7 @@ func (s *dummySerialSyncer) SyncIterate(ctx context.Context, request *syncer.Ite return &rs, nil } -func testBasic(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testBasic(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -268,7 +268,7 @@ func testBasic(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.Equal(t, err, ErrClosed, "Commit must return ErrClosed after Close") } -func testLongKeys(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testLongKeys(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState, Capacity(0, 512)) @@ -314,7 +314,7 @@ func testLongKeys(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.True(t, root.IsEmpty()) } -func testEmptyKeys(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testEmptyKeys(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -485,7 +485,7 @@ func testEmptyKeys(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.True(t, root.IsEmpty()) } -func testInsertCommitBatch(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testInsertCommitBatch(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -504,7 +504,7 @@ func testInsertCommitBatch(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.Equal(t, allItemsRoot, root.String()) } -func testInsertCommitEach(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testInsertCommitEach(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -526,7 +526,7 @@ func testInsertCommitEach(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.Equal(t, allItemsRoot, root.String()) } -func testRemove(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testRemove(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -602,7 +602,7 @@ func testRemove(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.True(t, root.IsEmpty()) } -func testSyncerBasic(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSyncerBasic(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() keys, values, r, tree := generatePopulatedTree(t, ndb) @@ -623,7 +623,7 @@ func testSyncerBasic(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.Equal(t, 0, stats.SyncIterateCount, "SyncIterate count") } -func testSyncerRootEmptyLabelNeedsDeref(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSyncerRootEmptyLabelNeedsDeref(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -684,7 +684,7 @@ func testSyncerRootEmptyLabelNeedsDeref(t *testing.T, ndb db.NodeDB, factory Nod }) } -func testSyncerRemove(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSyncerRemove(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -722,7 +722,7 @@ func testSyncerRemove(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.Equal(t, 0, stats.SyncIterateCount, "SyncIterate count") } -func testSyncerInsert(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSyncerInsert(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -755,7 +755,7 @@ func testSyncerInsert(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.Equal(t, 0, stats.SyncIterateCount, "SyncIterate count") } -func testSyncerNilNodes(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSyncerNilNodes(t *testing.T, _ db.NodeDB, _ NodeDBFactory) { var err error ctx := context.Background() @@ -795,7 +795,7 @@ func testSyncerNilNodes(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.NoError(t, err, "Insert") } -func testSyncerPrefetchPrefixes(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSyncerPrefetchPrefixes(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() keys, values, root, tree := generatePopulatedTree(t, ndb) @@ -818,7 +818,7 @@ func testSyncerPrefetchPrefixes(t *testing.T, ndb db.NodeDB, factory NodeDBFacto require.EqualValues(t, 0, stats.SyncIterateCount, "SyncIterate should not be called") } -func testValueEviction(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testValueEviction(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState, Capacity(0, 512)).(*tree) @@ -836,7 +836,7 @@ func testValueEviction(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.EqualValues(t, 416, tree.cache.valueSize, "Cache.ValueSize") } -func testNodeEviction(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testNodeEviction(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState, Capacity(128, 0)).(*tree) @@ -863,7 +863,7 @@ func testNodeEviction(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.EqualValues(t, 14912, tree.cache.valueSize, "Cache.LeafValueSize") } -func testDoubleInsertWithEviction(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testDoubleInsertWithEviction(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState, Capacity(128, 0)) @@ -886,7 +886,7 @@ func testDoubleInsertWithEviction(t *testing.T, ndb db.NodeDB, factory NodeDBFac require.NoError(t, err, "Commit") } -func testDebugDumpLocal(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testDebugDumpLocal(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -904,7 +904,7 @@ func testDebugDumpLocal(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.True(t, len(buffer.Bytes()) > 0) } -func testApplyWriteLog(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testApplyWriteLog(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { keys, values := generateKeyValuePairsEx("", 100) // Insert some items first. @@ -941,7 +941,7 @@ func testApplyWriteLog(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.True(t, rootHash.IsEmpty(), "root hash must be empty after removal of all items") } -func testOnCommitHooks(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testOnCommitHooks(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { var emptyRoot hash.Hash emptyRoot.Empty() root := node.Root{ @@ -974,7 +974,7 @@ func testOnCommitHooks(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.EqualValues(t, calls, []int{1, 2, 3}, "OnCommit hooks should fire in order") } -func testCommitNoPersist(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testCommitNoPersist(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -1002,10 +1002,10 @@ func testCommitNoPersist(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: root, } - err = ndb.Finalize(ctx, []node.Root{nodeRoot}) + err = ndb.Finalize([]node.Root{nodeRoot}) require.NoError(t, err, "Finalize") - roots, err := ndb.GetRootsForVersion(ctx, 42) + roots, err := ndb.GetRootsForVersion(42) require.NoError(t, err, "GetRootsForVersion") require.Len(t, roots, 1, "there should only be one root") require.Equal(t, nodeRoot, roots[0], "the root hash should be correct") @@ -1022,7 +1022,7 @@ func testCommitNoPersist(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.EqualValues(t, []byte("we will persist everything"), value) } -func testHasRoot(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testHasRoot(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { // Test that an empty root is always implicitly present. root := node.Root{ Namespace: testNs, @@ -1048,7 +1048,7 @@ func testHasRoot(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { } // Finalize version 0. - err = ndb.Finalize(ctx, []node.Root{root}) + err = ndb.Finalize([]node.Root{root}) require.NoError(t, err, "Finalize") // Make sure that HasRoot returns true. @@ -1069,7 +1069,7 @@ func testHasRoot(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: rootHash2, } - err = ndb.Finalize(ctx, []node.Root{root2}) + err = ndb.Finalize([]node.Root{root2}) require.NoError(t, err, "Finalize") // Make sure that HasRoot for root hash from version 0 but with @@ -1085,7 +1085,7 @@ func testHasRoot(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.True(t, ndb.HasRoot(root), "HasRoot should return true for existing root") } -func testGetRootsForVersion(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testGetRootsForVersion(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() // Create two roots in version 10. @@ -1114,20 +1114,20 @@ func testGetRootsForVersion(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) Type: node.RootTypeState, Hash: rootHash2, } - err = ndb.Finalize(ctx, []node.Root{root1, root2}) + err = ndb.Finalize([]node.Root{root1, root2}) require.NoError(t, err, "Finalize") - roots, err := ndb.GetRootsForVersion(ctx, 10) + roots, err := ndb.GetRootsForVersion(10) require.NoError(t, err, "GetRootsForVersion") require.Len(t, roots, 2, "GetRootsForVersion should return the correct number of roots") require.Contains(t, roots, root1, "GetRootsForVersion should return the correct roots") require.Contains(t, roots, root2, "GetRootsForVersion should return the correct roots") - roots, err = ndb.GetRootsForVersion(ctx, 1) + roots, err = ndb.GetRootsForVersion(1) require.NoError(t, err, "GetRootsForVersion") require.Len(t, roots, 0, "GetRootsForVersion should return no roots for eaerlier versions") - roots, err = ndb.GetRootsForVersion(ctx, 11) + roots, err = ndb.GetRootsForVersion(11) require.NoError(t, err, "GetRootsForVersion") require.Len(t, roots, 0, "GetRootsForVersion should return no roots for later versions") } @@ -1150,7 +1150,7 @@ func testSize(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: rootHash1, } - err = ndb.Finalize(ctx, []node.Root{root1}) + err = ndb.Finalize([]node.Root{root1}) require.NoError(t, err, "Finalize") // Reopen database to force flush. @@ -1165,7 +1165,7 @@ func testSize(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.True(t, newSize > size, "Size should be greater than before") } -func testEmptyValueWriteLog(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testEmptyValueWriteLog(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() // Populate the tree. @@ -1206,7 +1206,7 @@ func testEmptyValueWriteLog(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) } } -func testMergeWriteLog(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testMergeWriteLog(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() keyZero := []byte("foo") @@ -1315,7 +1315,7 @@ func testPruneBasic(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: rootHash1, } - err = ndb.Finalize(ctx, []node.Root{root1}) + err = ndb.Finalize([]node.Root{root1}) require.NoError(t, err, "Finalize") // Remove key in version 1. @@ -1336,7 +1336,7 @@ func testPruneBasic(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: rootHash2, } - err = ndb.Finalize(ctx, []node.Root{root2}) + err = ndb.Finalize([]node.Root{root2}) require.NoError(t, err, "Finalize") // Add some keys in version 2. @@ -1355,7 +1355,7 @@ func testPruneBasic(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: rootHash3, } - err = ndb.Finalize(ctx, []node.Root{root3}) + err = ndb.Finalize([]node.Root{root3}) require.NoError(t, err, "Finalize") earliestVersion := ndb.GetEarliestVersion() @@ -1425,7 +1425,7 @@ func testPruneManyVersions(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: rootHash, } - err = ndb.Finalize(ctx, []node.Root{root}) + err = ndb.Finalize([]node.Root{root}) require.NoError(t, err, "Finalize") } @@ -1464,7 +1464,7 @@ func testPruneForkedRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { _, rootHashR0_1, err := tree.Commit(ctx, testNs, 0) require.NoError(t, err, "Commit") // Finalize version 0. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) require.NoError(t, err, "Finalize") // Create a derived root A in version 1. @@ -1485,7 +1485,7 @@ func testPruneForkedRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { // Finalize version 1. Only derived root B was finalized, so derived root A // should be discarded. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 1, Type: node.RootTypeState, Hash: rootHashR1_2}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 1, Type: node.RootTypeState, Hash: rootHashR1_2}}) require.NoError(t, err, "Finalize") // Make sure that the write log for the discarded root is gone. @@ -1505,7 +1505,7 @@ func testPruneForkedRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { _, rootHashR2_1, err := tree.Commit(ctx, testNs, 2) require.NoError(t, err, "Commit") // Finalize version 2. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 2, Type: node.RootTypeState, Hash: rootHashR2_1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 2, Type: node.RootTypeState, Hash: rootHashR2_1}}) require.NoError(t, err, "Finalize") // Prune version 1 (should fail as it is not the earliest version). @@ -1543,7 +1543,7 @@ func testPruneForkedRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { } } -func testPruneLoneRootsShared(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testPruneLoneRootsShared(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() // Create a lone root (e.g., not included among the finalized roots) @@ -1572,7 +1572,7 @@ func testPruneLoneRootsShared(t *testing.T, ndb db.NodeDB, factory NodeDBFactory _, _, err = tree.Commit(ctx, testNs, 0) require.NoError(t, err, "Commit") - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHash1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHash1}}) require.NoError(t, err, "Finalize") // Check that the shared nodes are still there. @@ -1588,7 +1588,7 @@ func testPruneLoneRootsShared(t *testing.T, ndb db.NodeDB, factory NodeDBFactory require.EqualValues(t, []byte("bar3"), value) } -func testPruneLoneRootsShared2(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testPruneLoneRootsShared2(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() type item struct { @@ -1715,7 +1715,7 @@ func testPruneLoneRootsShared2(t *testing.T, ndb db.NodeDB, factory NodeDBFactor } } - err := ndb.Finalize(ctx, finalizedRoots) + err := ndb.Finalize(finalizedRoots) require.NoError(t, err, "Finalize") tree := NewWithRoot(nil, ndb, finalizedRoots[0]) @@ -1731,7 +1731,7 @@ func testPruneLoneRootsShared2(t *testing.T, ndb db.NodeDB, factory NodeDBFactor require.NoError(t, it.Err(), "tree should still be consistent") } -func testPruneLoneRootsShared3(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testPruneLoneRootsShared3(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { require := require.New(t) ctx := context.Background() @@ -1757,7 +1757,7 @@ func testPruneLoneRootsShared3(t *testing.T, ndb db.NodeDB, factory NodeDBFactor require.NoError(err, "Commit") // Finalize version 0 with the second root. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_2}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_2}}) require.NoError(err, "Finalize") // Make sure that the first root in version 1 is still valid. @@ -1791,10 +1791,10 @@ func testPruneLoneRootsShared4(t *testing.T, ndb db.NodeDB, factory NodeDBFactor require.NoError(err, "Commit") // Finalize version 0. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) require.NoError(err, "Finalize") // Finalize version 1. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 1, Type: node.RootTypeState, Hash: rootHashR1_1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 1, Type: node.RootTypeState, Hash: rootHashR1_1}}) require.NoError(err, "Finalize") // Prune version 0. err = ndb.Prune(ctx, 0) @@ -1861,7 +1861,7 @@ func testPruneLoneRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Hash: hash, }) } - err = ndb.Finalize(ctx, finalRoots) + err = ndb.Finalize(finalRoots) require.NoError(t, err, "Finalize") // Create a distinct root in version 1. @@ -1948,7 +1948,7 @@ func testPruneLoneRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Hash: hash, }) } - err = ndb.Finalize(ctx, finalRoots) + err = ndb.Finalize(finalRoots) require.NoError(t, err, "Finalize") // Create a distinct root in version 2. @@ -1982,7 +1982,7 @@ func testPruneLoneRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Hash: hash, }) } - err = ndb.Finalize(ctx, finalRoots) + err = ndb.Finalize(finalRoots) require.NoError(t, err, "Finalize") // Prune versions 0 and 1, all of the lone root's node should have been removed. @@ -2017,7 +2017,7 @@ func testPruneLoneRoots(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { } } -func testErrors(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testErrors(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() // Commit root for version 0. @@ -2065,14 +2065,14 @@ func testErrors(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { require.Equal(t, db.ErrRootNotFound, err) // Finalizing a version twice should fail. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) require.NoError(t, err, "Finalize") - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 0, Type: node.RootTypeState, Hash: rootHashR0_1}}) require.Error(t, err, "Finalize should fail as version is already finalized") require.Equal(t, db.ErrAlreadyFinalized, err) // Finalize of version 2 should fail as version 1 is not finalized. - err = ndb.Finalize(ctx, []node.Root{{Namespace: testNs, Version: 2, Type: node.RootTypeState, Hash: rootHashR2_1}}) + err = ndb.Finalize([]node.Root{{Namespace: testNs, Version: 2, Type: node.RootTypeState, Hash: rootHashR2_1}}) require.Error(t, err, "Finalize should fail as previous version not finalized") require.Equal(t, db.ErrNotFinalized, err) @@ -2194,27 +2194,27 @@ func testSpecialCaseFromJSON(t *testing.T, ndb db.NodeDB, fixture string) { } } -func testSpecialCase1(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSpecialCase1(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { testSpecialCaseFromJSON(t, ndb, "case-1.json") } -func testSpecialCase2(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSpecialCase2(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { testSpecialCaseFromJSON(t, ndb, "case-2.json") } -func testSpecialCase3(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSpecialCase3(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { testSpecialCaseFromJSON(t, ndb, "case-3.json") } -func testSpecialCase4(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSpecialCase4(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { testSpecialCaseFromJSON(t, ndb, "case-4.json") } -func testSpecialCase5(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testSpecialCase5(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { testSpecialCaseFromJSON(t, ndb, "case-5.json") } -func testLargeUpdates(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { +func testLargeUpdates(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { ctx := context.Background() tree := New(nil, ndb, node.RootTypeState) @@ -2233,7 +2233,7 @@ func testLargeUpdates(t *testing.T, ndb db.NodeDB, factory NodeDBFactory) { Type: node.RootTypeState, Hash: rootHash, } - err = ndb.Finalize(ctx, []node.Root{root}) + err = ndb.Finalize([]node.Root{root}) require.NoError(t, err, "Finalize") } diff --git a/go/storage/tests/tester.go b/go/storage/tests/tester.go index 4458d44d59f..83ab9cf97c2 100644 --- a/go/storage/tests/tester.go +++ b/go/storage/tests/tester.go @@ -45,7 +45,7 @@ func makeWriteLogLess(wl api.WriteLog) func(i, j int) bool { func prepareWriteLog(values [][]byte) api.WriteLog { var wl api.WriteLog - for i, v := range testValues { + for i, v := range values { wl = append(wl, api.LogEntry{Key: []byte(strconv.Itoa(i)), Value: v}) } return wl diff --git a/go/upgrade/api/api.go b/go/upgrade/api/api.go index c3b1e3a999f..62b7832265c 100644 --- a/go/upgrade/api/api.go +++ b/go/upgrade/api/api.go @@ -233,21 +233,21 @@ func (pu *PendingUpgrade) PushStage(stage UpgradeStage) { type Backend interface { // SubmitDescriptor submits the serialized descriptor to the upgrade manager // which then schedules and manages the upgrade. - SubmitDescriptor(context.Context, *Descriptor) error + SubmitDescriptor(*Descriptor) error // PendingUpgrades returns pending upgrades. - PendingUpgrades(context.Context) ([]*PendingUpgrade, error) + PendingUpgrades() ([]*PendingUpgrade, error) // HasPendingUpgradeAt returns whether there is a pending upgrade at a specified height. - HasPendingUpgradeAt(context.Context, int64) (bool, error) + HasPendingUpgradeAt(int64) (bool, error) // CancelUpgrade cancels a specific pending upgrade, unless it is already in progress. - CancelUpgrade(context.Context, *Descriptor) error + CancelUpgrade(*Descriptor) error // GetUpgrade returns the pending upgrade (if any) that has the given descriptor. // // In case no such upgrade exists, this returns ErrUpgradeNotFound. - GetUpgrade(context.Context, *Descriptor) (*PendingUpgrade, error) + GetUpgrade(*Descriptor) (*PendingUpgrade, error) // StartupUpgrade performs the startup portion of the upgrade. // It is idempotent with respect to the current upgrade descriptor. diff --git a/go/upgrade/dummy.go b/go/upgrade/dummy.go index badb8005767..d8e8d6d0e6b 100644 --- a/go/upgrade/dummy.go +++ b/go/upgrade/dummy.go @@ -1,8 +1,6 @@ package upgrade import ( - "context" - beacon "github.com/oasisprotocol/oasis-core/go/beacon/api" "github.com/oasisprotocol/oasis-core/go/upgrade/api" ) @@ -11,23 +9,23 @@ var _ api.Backend = (*dummyUpgradeManager)(nil) type dummyUpgradeManager struct{} -func (u *dummyUpgradeManager) SubmitDescriptor(ctx context.Context, descriptor *api.Descriptor) error { +func (u *dummyUpgradeManager) SubmitDescriptor(*api.Descriptor) error { return nil } -func (u *dummyUpgradeManager) PendingUpgrades(ctx context.Context) ([]*api.PendingUpgrade, error) { +func (u *dummyUpgradeManager) PendingUpgrades() ([]*api.PendingUpgrade, error) { return nil, nil } -func (u *dummyUpgradeManager) HasPendingUpgradeAt(ctx context.Context, height int64) (bool, error) { +func (u *dummyUpgradeManager) HasPendingUpgradeAt(int64) (bool, error) { return false, nil } -func (u *dummyUpgradeManager) CancelUpgrade(ctx context.Context, descriptor *api.Descriptor) error { +func (u *dummyUpgradeManager) CancelUpgrade(*api.Descriptor) error { return nil } -func (u *dummyUpgradeManager) GetUpgrade(ctx context.Context, descriptor *api.Descriptor) (*api.PendingUpgrade, error) { +func (u *dummyUpgradeManager) GetUpgrade(*api.Descriptor) (*api.PendingUpgrade, error) { return nil, api.ErrUpgradeNotFound } @@ -35,7 +33,7 @@ func (u *dummyUpgradeManager) StartupUpgrade() error { return nil } -func (u *dummyUpgradeManager) ConsensusUpgrade(privateCtx interface{}, currentEpoch beacon.EpochTime, currentHeight int64) error { +func (u *dummyUpgradeManager) ConsensusUpgrade(interface{}, beacon.EpochTime, int64) error { return nil } diff --git a/go/upgrade/migrations/consensus_max_allowances.go b/go/upgrade/migrations/consensus_max_allowances.go index 35d9a4c2ff6..313aa87401f 100644 --- a/go/upgrade/migrations/consensus_max_allowances.go +++ b/go/upgrade/migrations/consensus_max_allowances.go @@ -17,11 +17,11 @@ var _ Handler = (*maxAllowances16Handler)(nil) type maxAllowances16Handler struct{} -func (th *maxAllowances16Handler) StartupUpgrade(ctx *Context) error { +func (th *maxAllowances16Handler) StartupUpgrade() error { return nil } -func (th *maxAllowances16Handler) ConsensusUpgrade(ctx *Context, privateCtx interface{}) error { +func (th *maxAllowances16Handler) ConsensusUpgrade(privateCtx interface{}) error { abciCtx := privateCtx.(*abciAPI.Context) switch abciCtx.Mode() { case abciAPI.ContextBeginBlock: diff --git a/go/upgrade/migrations/consensus_v62.go b/go/upgrade/migrations/consensus_v62.go index 5fa932605fe..d8f8883fd0a 100644 --- a/go/upgrade/migrations/consensus_v62.go +++ b/go/upgrade/migrations/consensus_v62.go @@ -21,11 +21,11 @@ var _ Handler = (*v62Handler)(nil) type v62Handler struct{} -func (th *v62Handler) StartupUpgrade(ctx *Context) error { +func (th *v62Handler) StartupUpgrade() error { return nil } -func (th *v62Handler) ConsensusUpgrade(ctx *Context, privateCtx interface{}) error { +func (th *v62Handler) ConsensusUpgrade(privateCtx interface{}) error { abciCtx := privateCtx.(*abciAPI.Context) switch abciCtx.Mode() { case abciAPI.ContextBeginBlock: diff --git a/go/upgrade/migrations/dummy.go b/go/upgrade/migrations/dummy.go index 5703c15e3b3..90343797895 100644 --- a/go/upgrade/migrations/dummy.go +++ b/go/upgrade/migrations/dummy.go @@ -38,11 +38,11 @@ func init() { type dummyMigrationHandler struct{} -func (th *dummyMigrationHandler) StartupUpgrade(ctx *Context) error { +func (th *dummyMigrationHandler) StartupUpgrade() error { return nil } -func (th *dummyMigrationHandler) ConsensusUpgrade(ctx *Context, privateCtx interface{}) error { +func (th *dummyMigrationHandler) ConsensusUpgrade(privateCtx interface{}) error { abciCtx := privateCtx.(*abciAPI.Context) switch abciCtx.Mode() { case abciAPI.ContextBeginBlock: diff --git a/go/upgrade/migrations/empty.go b/go/upgrade/migrations/empty.go index e1e5daea36d..f0c8f59f811 100644 --- a/go/upgrade/migrations/empty.go +++ b/go/upgrade/migrations/empty.go @@ -10,12 +10,12 @@ var _ Handler = (*emptyHandler)(nil) type emptyHandler struct{} -func (th *emptyHandler) StartupUpgrade(ctx *Context) error { +func (th *emptyHandler) StartupUpgrade() error { // Nothing to do. return nil } -func (th *emptyHandler) ConsensusUpgrade(ctx *Context, privateCtx interface{}) error { +func (th *emptyHandler) ConsensusUpgrade(interface{}) error { // Nothing to do. return nil } diff --git a/go/upgrade/migrations/migrations.go b/go/upgrade/migrations/migrations.go index ac5c50cbd62..826b882fdf4 100644 --- a/go/upgrade/migrations/migrations.go +++ b/go/upgrade/migrations/migrations.go @@ -25,7 +25,7 @@ var ( type Handler interface { // StartupUpgrade is called by the upgrade manager to perform // the node startup portion of the upgrade. - StartupUpgrade(*Context) error + StartupUpgrade() error // ConsensusUpgrade is called by the upgrade manager to perform // the consensus portion of the upgrade. The interface argument is @@ -34,7 +34,7 @@ type Handler interface { // // This method will be called twice, once in BeginBlock and once in // EndBlock. - ConsensusUpgrade(*Context, interface{}) error + ConsensusUpgrade(interface{}) error } // Context defines the common context used by migration handlers. diff --git a/go/upgrade/upgrade.go b/go/upgrade/upgrade.go index 34fead9a6c6..f6e9883e74d 100644 --- a/go/upgrade/upgrade.go +++ b/go/upgrade/upgrade.go @@ -7,7 +7,6 @@ package upgrade import ( - "context" "fmt" "sync" @@ -38,7 +37,7 @@ type upgradeManager struct { } // Implements api.Backend. -func (u *upgradeManager) SubmitDescriptor(ctx context.Context, descriptor *api.Descriptor) error { +func (u *upgradeManager) SubmitDescriptor(descriptor *api.Descriptor) error { if descriptor == nil { return api.ErrBadDescriptor } @@ -67,7 +66,7 @@ func (u *upgradeManager) SubmitDescriptor(ctx context.Context, descriptor *api.D } // Implements api.Backend. -func (u *upgradeManager) PendingUpgrades(ctx context.Context) ([]*api.PendingUpgrade, error) { +func (u *upgradeManager) PendingUpgrades() ([]*api.PendingUpgrade, error) { u.Lock() defer u.Unlock() @@ -75,7 +74,7 @@ func (u *upgradeManager) PendingUpgrades(ctx context.Context) ([]*api.PendingUpg } // Implements api.Backend. -func (u *upgradeManager) HasPendingUpgradeAt(ctx context.Context, height int64) (bool, error) { +func (u *upgradeManager) HasPendingUpgradeAt(height int64) (bool, error) { u.Lock() defer u.Unlock() @@ -93,7 +92,7 @@ func (u *upgradeManager) HasPendingUpgradeAt(ctx context.Context, height int64) } // Implements api.Backend. -func (u *upgradeManager) CancelUpgrade(ctx context.Context, descriptor *api.Descriptor) error { +func (u *upgradeManager) CancelUpgrade(descriptor *api.Descriptor) error { if descriptor == nil { return api.ErrBadDescriptor } @@ -126,7 +125,7 @@ func (u *upgradeManager) CancelUpgrade(ctx context.Context, descriptor *api.Desc } // Implements api.Backend. -func (u *upgradeManager) GetUpgrade(ctx context.Context, descriptor *api.Descriptor) (*api.PendingUpgrade, error) { +func (u *upgradeManager) GetUpgrade(descriptor *api.Descriptor) (*api.PendingUpgrade, error) { if descriptor == nil { return nil, api.ErrBadDescriptor } @@ -245,12 +244,11 @@ func (u *upgradeManager) StartupUpgrade() error { "handler", pu.Descriptor.Handler, logging.LogEvent, api.LogEventStartupUpgrade, ) - migrationCtx := migrations.NewContext(pu, u.dataDir) handler, err := migrations.GetHandler(pu.Descriptor.Handler) if err != nil { return err } - if err := handler.StartupUpgrade(migrationCtx); err != nil { + if err := handler.StartupUpgrade(); err != nil { return err } pu.PushStage(api.UpgradeStageStartup) @@ -301,12 +299,11 @@ func (u *upgradeManager) ConsensusUpgrade(privateCtx interface{}, currentEpoch b logging.LogEvent, api.LogEventConsensusUpgrade, ) - migrationCtx := migrations.NewContext(pu, u.dataDir) handler, err := migrations.GetHandler(pu.Descriptor.Handler) if err != nil { return err } - if err := handler.ConsensusUpgrade(migrationCtx, privateCtx); err != nil { + if err := handler.ConsensusUpgrade(privateCtx); err != nil { return err } } diff --git a/go/worker/beacon/worker.go b/go/worker/beacon/worker.go index 6fa7316c6e5..c67c6af231c 100644 --- a/go/worker/beacon/worker.go +++ b/go/worker/beacon/worker.go @@ -8,7 +8,6 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/identity" "github.com/oasisprotocol/oasis-core/go/common/logging" - "github.com/oasisprotocol/oasis-core/go/common/persistent" consensus "github.com/oasisprotocol/oasis-core/go/consensus/api" "github.com/oasisprotocol/oasis-core/go/worker/registration" ) @@ -61,7 +60,6 @@ func (w *Worker) Name() string { func New( identity *identity.Identity, consensus consensus.Backend, - store *persistent.CommonStore, registrationWorker *registration.Worker, ) (*Worker, error) { var ( diff --git a/go/worker/client/committee/node.go b/go/worker/client/committee/node.go index dc4ec5ddef0..b90252be22a 100644 --- a/go/worker/client/committee/node.go +++ b/go/worker/client/committee/node.go @@ -76,7 +76,7 @@ func (n *Node) Initialized() <-chan struct{} { return n.initCh } -func (n *Node) HandlePeerTx(ctx context.Context, tx []byte) error { +func (n *Node) HandlePeerTx(context.Context, []byte) error { // Nothing to do here. return nil } @@ -90,7 +90,7 @@ func (n *Node) HandleNewBlockEarlyLocked(*block.Block) { } // HandleNewBlockLocked is guarded by CrossNode. -func (n *Node) HandleNewBlockLocked(blk *block.Block) { +func (n *Node) HandleNewBlockLocked(*block.Block) { } // HandleNewEventLocked is guarded by CrossNode. diff --git a/go/worker/client/service.go b/go/worker/client/service.go index 5c9ea9e51ae..bc776d14f82 100644 --- a/go/worker/client/service.go +++ b/go/worker/client/service.go @@ -103,7 +103,7 @@ func (s *service) CheckTx(ctx context.Context, request *api.CheckTxRequest) erro } // Implements api.RuntimeClient. -func (s *service) WatchBlocks(ctx context.Context, runtimeID common.Namespace) (<-chan *roothash.AnnotatedBlock, pubsub.ClosableSubscription, error) { +func (s *service) WatchBlocks(_ context.Context, runtimeID common.Namespace) (<-chan *roothash.AnnotatedBlock, pubsub.ClosableSubscription, error) { rt, err := s.w.commonWorker.RuntimeRegistry.GetRuntime(runtimeID) if err != nil { return nil, nil, err diff --git a/go/worker/client/stateless.go b/go/worker/client/stateless.go index 6a48c12033c..fd331f601c4 100644 --- a/go/worker/client/stateless.go +++ b/go/worker/client/stateless.go @@ -30,15 +30,15 @@ func (s *statelessStorage) SyncIterate(ctx context.Context, request *storage.Ite return rsp, err } -func (s *statelessStorage) GetDiff(ctx context.Context, request *storage.GetDiffRequest) (storage.WriteLogIterator, error) { +func (s *statelessStorage) GetDiff(context.Context, *storage.GetDiffRequest) (storage.WriteLogIterator, error) { return nil, storage.ErrUnsupported } -func (s *statelessStorage) GetCheckpoints(ctx context.Context, request *checkpoint.GetCheckpointsRequest) ([]*checkpoint.Metadata, error) { +func (s *statelessStorage) GetCheckpoints(context.Context, *checkpoint.GetCheckpointsRequest) ([]*checkpoint.Metadata, error) { return nil, storage.ErrUnsupported } -func (s *statelessStorage) GetCheckpointChunk(ctx context.Context, chunk *checkpoint.ChunkMetadata, w io.Writer) error { +func (s *statelessStorage) GetCheckpointChunk(context.Context, *checkpoint.ChunkMetadata, io.Writer) error { return storage.ErrUnsupported } diff --git a/go/worker/common/committee/group.go b/go/worker/common/committee/group.go index 3a9ef986406..d623968bb9f 100644 --- a/go/worker/common/committee/group.go +++ b/go/worker/common/committee/group.go @@ -155,7 +155,7 @@ func (e *EpochSnapshot) Nodes() nodes.NodeDescriptorLookup { // Node looks up a node descriptor. // // Implements commitment.NodeLookup. -func (e *EpochSnapshot) Node(ctx context.Context, id signature.PublicKey) (*node.Node, error) { +func (e *EpochSnapshot) Node(_ context.Context, id signature.PublicKey) (*node.Node, error) { n := e.nodes.Lookup(id) if n == nil { return nil, registry.ErrNoSuchNode @@ -216,7 +216,7 @@ func (g *Group) RoundTransition() { // Suspend processes a runtime suspension that just happened. // // Resumption will be processed as a regular epoch transition. -func (g *Group) Suspend(ctx context.Context) { +func (g *Group) Suspend() { g.Lock() defer g.Unlock() diff --git a/go/worker/common/committee/keymanager.go b/go/worker/common/committee/keymanager.go index 499329ffc19..a5ba5be1bbb 100644 --- a/go/worker/common/committee/keymanager.go +++ b/go/worker/common/committee/keymanager.go @@ -77,7 +77,7 @@ func (km *KeyManagerClientWrapper) SetKeyManagerID(id *common.Namespace) { km.cli = nil km.nt = nil default: - km.cli = keymanagerP2P.NewClient(km.p2p, km.consensus, km.chainContext, *id) + km.cli = keymanagerP2P.NewClient(km.p2p, km.chainContext, *id) km.nt = newKeyManagerNodeTracker(km.p2p, km.consensus, *id) km.nt.Start() } diff --git a/go/worker/common/committee/node.go b/go/worker/common/committee/node.go index 4be618c1f1c..840b9af84c6 100644 --- a/go/worker/common/committee/node.go +++ b/go/worker/common/committee/node.go @@ -286,7 +286,7 @@ func (n *Node) AddHooks(hooks NodeHooks) { } // GetStatus returns the common committee node status. -func (n *Node) GetStatus(ctx context.Context) (*api.Status, error) { +func (n *Node) GetStatus() (*api.Status, error) { n.CrossNode.Lock() defer n.CrossNode.Unlock() @@ -372,11 +372,11 @@ func (n *Node) handleEpochTransitionLocked(height int64) { } // Guarded by n.CrossNode. -func (n *Node) handleSuspendLocked(height int64) { +func (n *Node) handleSuspendLocked(int64) { n.logger.Warn("runtime has been suspended") // Suspend group. - n.Group.Suspend(n.ctx) + n.Group.Suspend() epoch := n.Group.GetEpochSnapshot() for _, hooks := range n.hooks { @@ -445,7 +445,7 @@ func (n *Node) updateHostedRuntimeVersionLocked() { } } - if err := n.SetHostedRuntimeVersion(n.ctx, activeVersion, nextVersion); err != nil { + if err := n.SetHostedRuntimeVersion(activeVersion, nextVersion); err != nil { n.logger.Error("failed to activate runtime version(s)", "err", err, "version", activeVersion, diff --git a/go/worker/common/committee/p2p.go b/go/worker/common/committee/p2p.go index a498d241b6e..da015a16635 100644 --- a/go/worker/common/committee/p2p.go +++ b/go/worker/common/committee/p2p.go @@ -24,12 +24,12 @@ func (h *txMsgHandler) DecodeMessage(msg []byte) (interface{}, error) { return tx, nil } -func (h *txMsgHandler) AuthorizeMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}) error { +func (h *txMsgHandler) AuthorizeMessage(context.Context, signature.PublicKey, interface{}) error { // Everyone is allowed to publish transactions. return nil } -func (h *txMsgHandler) HandleMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}, isOwn bool) error { +func (h *txMsgHandler) HandleMessage(ctx context.Context, _ signature.PublicKey, msg interface{}, isOwn bool) error { // Ignore own messages as those are handled separately. if isOwn { return nil diff --git a/go/worker/common/committee/runtime_host.go b/go/worker/common/committee/runtime_host.go index 6e5d02d1818..5a9172389e7 100644 --- a/go/worker/common/committee/runtime_host.go +++ b/go/worker/common/committee/runtime_host.go @@ -28,17 +28,17 @@ type nodeEnvironment struct { } // GetKeyManagerClient implements RuntimeHostHandlerEnvironment. -func (env *nodeEnvironment) GetKeyManagerClient(ctx context.Context) (runtimeKeymanager.Client, error) { +func (env *nodeEnvironment) GetKeyManagerClient() (runtimeKeymanager.Client, error) { return env.n.KeyManagerClient, nil } // GetTxPool implements RuntimeHostHandlerEnvironment. -func (env *nodeEnvironment) GetTxPool(ctx context.Context) (txpool.TransactionPool, error) { +func (env *nodeEnvironment) GetTxPool() (txpool.TransactionPool, error) { return env.n.TxPool, nil } // GetIdentity implements RuntimeHostHandlerEnvironment. -func (env *nodeEnvironment) GetNodeIdentity(ctx context.Context) (*identity.Identity, error) { +func (env *nodeEnvironment) GetNodeIdentity() (*identity.Identity, error) { return env.n.Identity, nil } diff --git a/go/worker/common/p2p/txsync/server.go b/go/worker/common/p2p/txsync/server.go index 7cd8c562cc7..8b74e1409af 100644 --- a/go/worker/common/p2p/txsync/server.go +++ b/go/worker/common/p2p/txsync/server.go @@ -14,7 +14,7 @@ type service struct { txPool txpool.TransactionPool } -func (s *service) HandleRequest(ctx context.Context, method string, body cbor.RawMessage) (interface{}, error) { +func (s *service) HandleRequest(_ context.Context, method string, body cbor.RawMessage) (interface{}, error) { switch method { case MethodGetTxs: var rq GetTxsRequest @@ -22,13 +22,13 @@ func (s *service) HandleRequest(ctx context.Context, method string, body cbor.Ra return nil, rpc.ErrBadRequest } - return s.handleGetTxs(ctx, &rq) + return s.handleGetTxs(&rq) default: return nil, rpc.ErrMethodNotSupported } } -func (s *service) handleGetTxs(ctx context.Context, request *GetTxsRequest) (*GetTxsResponse, error) { +func (s *service) handleGetTxs(request *GetTxsRequest) (*GetTxsResponse, error) { var rsp GetTxsResponse switch { case len(request.Txs) == 0: diff --git a/go/worker/compute/executor/committee/node.go b/go/worker/compute/executor/committee/node.go index 7e0ce086e9f..46a9be0a96a 100644 --- a/go/worker/compute/executor/committee/node.go +++ b/go/worker/compute/executor/committee/node.go @@ -284,7 +284,7 @@ func (n *Node) HandleEpochTransitionLocked(epoch *committee.EpochSnapshot) { // HandleNewBlockEarlyLocked implements NodeHooks. // Guarded by n.commonNode.CrossNode. -func (n *Node) HandleNewBlockEarlyLocked(blk *block.Block) { +func (n *Node) HandleNewBlockEarlyLocked(*block.Block) { crash.Here(crashPointRoothashReceiveAfter) // If we have seen a new block while a batch was processing, we need to @@ -1306,7 +1306,7 @@ func (n *Node) nudgeAvailabilityLocked(force bool) { } // Obtain CapabilityTEE for the given runtime version. - capabilityTEE, err := n.commonNode.GetHostedRuntimeCapabilityTEE(n.ctx, version) + capabilityTEE, err := n.commonNode.GetHostedRuntimeCapabilityTEE(version) if err != nil { n.logger.Warn("failed to get CapabilityTEE for hosted runtime, skipping", "err", err, diff --git a/go/worker/compute/executor/committee/p2p.go b/go/worker/compute/executor/committee/p2p.go index dcac5cc9f71..f9bf821fbbd 100644 --- a/go/worker/compute/executor/committee/p2p.go +++ b/go/worker/compute/executor/committee/p2p.go @@ -23,7 +23,7 @@ func (h *committeeMsgHandler) DecodeMessage(msg []byte) (interface{}, error) { return &dec, nil } -func (h *committeeMsgHandler) AuthorizeMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}) error { +func (h *committeeMsgHandler) AuthorizeMessage(_ context.Context, peerID signature.PublicKey, msg interface{}) error { cm := msg.(*p2p.CommitteeMessage) // Ensured by DecodeMessage. epoch := h.n.commonNode.Group.GetEpochSnapshot() @@ -56,7 +56,7 @@ func (h *committeeMsgHandler) AuthorizeMessage(ctx context.Context, peerID signa return nil } -func (h *committeeMsgHandler) HandleMessage(ctx context.Context, peerID signature.PublicKey, msg interface{}, isOwn bool) error { +func (h *committeeMsgHandler) HandleMessage(ctx context.Context, _ signature.PublicKey, msg interface{}, isOwn bool) error { cm := msg.(*p2p.CommitteeMessage) // Ensured by DecodeMessage. switch { @@ -89,7 +89,7 @@ func (h *committeeMsgHandler) HandleMessage(ctx context.Context, peerID signatur } // HandlePeerTx implements NodeHooks. -func (n *Node) HandlePeerTx(ctx context.Context, tx []byte) error { +func (n *Node) HandlePeerTx(context.Context, []byte) error { // Nothing to do here. return nil } diff --git a/go/worker/compute/executor/committee/status.go b/go/worker/compute/executor/committee/status.go index 7e1ba91eaa1..09ef0eabb3c 100644 --- a/go/worker/compute/executor/committee/status.go +++ b/go/worker/compute/executor/committee/status.go @@ -1,13 +1,11 @@ package committee import ( - "context" - "github.com/oasisprotocol/oasis-core/go/worker/compute/executor/api" ) // GetStatus returns the executor committee node status. -func (n *Node) GetStatus(ctx context.Context) (*api.Status, error) { +func (n *Node) GetStatus() (*api.Status, error) { n.commonNode.CrossNode.Lock() defer n.commonNode.CrossNode.Unlock() diff --git a/go/worker/compute/executor/tests/tester.go b/go/worker/compute/executor/tests/tester.go index f19639ac08d..cacd703c7b0 100644 --- a/go/worker/compute/executor/tests/tester.go +++ b/go/worker/compute/executor/tests/tester.go @@ -86,7 +86,7 @@ func testQueueTx( runtimeID common.Namespace, stateCh <-chan committee.NodeState, commonNode *commonCommittee.Node, - rtNode *committee.Node, + _ *committee.Node, roothash roothash.Backend, st storage.Backend, ) { diff --git a/go/worker/keymanager/handler.go b/go/worker/keymanager/handler.go index 70e7b56976d..fd00b9b8f14 100644 --- a/go/worker/keymanager/handler.go +++ b/go/worker/keymanager/handler.go @@ -31,17 +31,17 @@ type workerEnvironment struct { } // GetKeyManagerClient implements RuntimeHostHandlerEnvironment. -func (env *workerEnvironment) GetKeyManagerClient(ctx context.Context) (runtimeKeymanager.Client, error) { +func (env *workerEnvironment) GetKeyManagerClient() (runtimeKeymanager.Client, error) { return env.kmCli, nil } // GetTxPool implements RuntimeHostHandlerEnvironment. -func (env *workerEnvironment) GetTxPool(ctx context.Context) (txpool.TransactionPool, error) { +func (env *workerEnvironment) GetTxPool() (txpool.TransactionPool, error) { return nil, fmt.Errorf("method not supported") } // GetIdentity implements RuntimeHostHandlerEnvironment. -func (env *workerEnvironment) GetNodeIdentity(ctx context.Context) (*identity.Identity, error) { +func (env *workerEnvironment) GetNodeIdentity() (*identity.Identity, error) { return env.w.commonWorker.Identity, nil } diff --git a/go/worker/keymanager/init.go b/go/worker/keymanager/init.go index 19d56b90382..31779745c6f 100644 --- a/go/worker/keymanager/init.go +++ b/go/worker/keymanager/init.go @@ -14,7 +14,6 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/logging" "github.com/oasisprotocol/oasis-core/go/common/node" "github.com/oasisprotocol/oasis-core/go/config" - ias "github.com/oasisprotocol/oasis-core/go/ias/api" "github.com/oasisprotocol/oasis-core/go/keymanager/api" p2pAPI "github.com/oasisprotocol/oasis-core/go/p2p/api" runtimeRegistry "github.com/oasisprotocol/oasis-core/go/runtime/registry" @@ -26,7 +25,6 @@ import ( // New constructs a new key manager worker. func New( commonWorker *workerCommon.Worker, - ias ias.Endpoint, r *registration.Worker, backend api.Backend, ) (*Worker, error) { diff --git a/go/worker/keymanager/p2p/client.go b/go/worker/keymanager/p2p/client.go index ecd87d8de80..63bbcf9745a 100644 --- a/go/worker/keymanager/p2p/client.go +++ b/go/worker/keymanager/p2p/client.go @@ -6,7 +6,6 @@ import ( "github.com/libp2p/go-libp2p/core" "github.com/oasisprotocol/oasis-core/go/common" - consensus "github.com/oasisprotocol/oasis-core/go/consensus/api" p2p "github.com/oasisprotocol/oasis-core/go/p2p/api" "github.com/oasisprotocol/oasis-core/go/p2p/protocol" "github.com/oasisprotocol/oasis-core/go/p2p/rpc" @@ -46,7 +45,7 @@ func (c *client) CallEnclave(ctx context.Context, request *CallEnclaveRequest, p } // NewClient creates a new keymanager protocol client. -func NewClient(p2p p2p.Service, consensus consensus.Backend, chainContext string, keymanagerID common.Namespace) Client { +func NewClient(p2p p2p.Service, chainContext string, keymanagerID common.Namespace) Client { pid := protocol.NewRuntimeProtocolID(chainContext, keymanagerID, KeyManagerProtocolID, KeyManagerProtocolVersion) mgr := rpc.NewPeerManager(p2p, pid, rpc.WithStickyPeers(true)) rc := rpc.NewClient(p2p.Host(), pid) diff --git a/go/worker/keymanager/status.go b/go/worker/keymanager/status.go index 2ad16d50f90..3d24d93143a 100644 --- a/go/worker/keymanager/status.go +++ b/go/worker/keymanager/status.go @@ -1,8 +1,6 @@ package keymanager import ( - "context" - "github.com/libp2p/go-libp2p/core/peer" "github.com/oasisprotocol/oasis-core/go/common" @@ -11,7 +9,7 @@ import ( ) // GetStatus returns the key manager worker status. -func (w *Worker) GetStatus(ctx context.Context) (*api.Status, error) { +func (w *Worker) GetStatus() (*api.Status, error) { var initialized, stopped bool select { case <-w.Initialized(): diff --git a/go/worker/keymanager/worker.go b/go/worker/keymanager/worker.go index 663debfbbde..2462fce53d5 100644 --- a/go/worker/keymanager/worker.go +++ b/go/worker/keymanager/worker.go @@ -1414,7 +1414,7 @@ func (w *Worker) worker() { // Key managers always need to use the enclave version given to them in the bundle // as they need to make sure that replication is possible during upgrades. activeVersion := w.runtime.HostVersions()[0] // Init made sure we have exactly one. - if err = w.SetHostedRuntimeVersion(w.ctx, activeVersion, nil); err != nil { + if err = w.SetHostedRuntimeVersion(activeVersion, nil); err != nil { w.logger.Error("failed to activate key manager runtime version", "err", err, "version", activeVersion, diff --git a/go/worker/registration/worker.go b/go/worker/registration/worker.go index 5d2adb95a39..f532e613cf7 100644 --- a/go/worker/registration/worker.go +++ b/go/worker/registration/worker.go @@ -1003,7 +1003,7 @@ func (w *Worker) WillNeverRegister() bool { } // GetRegistrationSigner loads the signing credentials as configured by this package's flags. -func GetRegistrationSigner(logger *logging.Logger, dataDir string, identity *identity.Identity) (signature.PublicKey, signature.Signer, error) { +func GetRegistrationSigner(identity *identity.Identity) (signature.PublicKey, signature.Signer, error) { var defaultPk signature.PublicKey // If the test entity is enabled, use the entity signing key for signing @@ -1035,7 +1035,6 @@ func GetRegistrationSigner(logger *logging.Logger, dataDir string, identity *ide // New constructs a new worker node registration service. func New( - dataDir string, beacon beacon.Backend, registry registry.Backend, identity *identity.Identity, @@ -1050,7 +1049,7 @@ func New( serviceStore := store.GetServiceStore(DBBucketName) - entityID, registrationSigner, err := GetRegistrationSigner(logger, dataDir, identity) + entityID, registrationSigner, err := GetRegistrationSigner(identity) if err != nil { return nil, err } diff --git a/go/worker/storage/committee/checkpoint_sync.go b/go/worker/storage/committee/checkpoint_sync.go index 39a47e18801..c06f9b41285 100644 --- a/go/worker/storage/committee/checkpoint_sync.go +++ b/go/worker/storage/committee/checkpoint_sync.go @@ -405,7 +405,7 @@ func (n *Node) syncCheckpoints(genesisRound uint64, wantOnlyGenesis bool) (*bloc syncState.Roots = append(syncState.Roots, check.Root) remainingRoots.remove(check.Root.Type) if remainingRoots.isEmpty() { - if err = n.localStorage.NodeDB().Finalize(n.ctx, syncState.Roots); err != nil { + if err = n.localStorage.NodeDB().Finalize(syncState.Roots); err != nil { n.logger.Error("can't finalize version after all checkpoints restored", "err", err, "version", prevVersion, diff --git a/go/worker/storage/committee/node.go b/go/worker/storage/committee/node.go index 98725bc13c0..fc7d5e2b9e8 100644 --- a/go/worker/storage/committee/node.go +++ b/go/worker/storage/committee/node.go @@ -308,7 +308,7 @@ func (n *Node) Initialized() <-chan struct{} { } // GetStatus returns the storage committee node status. -func (n *Node) GetStatus(ctx context.Context) (*api.Status, error) { +func (n *Node) GetStatus(context.Context) (*api.Status, error) { n.syncedLock.RLock() defer n.syncedLock.RUnlock() @@ -336,13 +336,13 @@ func (n *Node) GetLocalStorage() storageApi.LocalBackend { // NodeHooks implementation. -func (n *Node) HandlePeerTx(ctx context.Context, tx []byte) error { +func (n *Node) HandlePeerTx(context.Context, []byte) error { // Nothing to do here. return nil } // HandleEpochTransitionLocked is guarded by CrossNode. -func (n *Node) HandleEpochTransitionLocked(snapshot *committee.EpochSnapshot) { +func (n *Node) HandleEpochTransitionLocked(*committee.EpochSnapshot) { // Nothing to do here. } @@ -363,7 +363,7 @@ func (n *Node) HandleNewEventLocked(*roothashApi.Event) { } // HandleRuntimeHostEventLocked is guarded by CrossNode. -func (n *Node) HandleRuntimeHostEventLocked(ev *host.Event) { +func (n *Node) HandleRuntimeHostEventLocked(*host.Event) { // Nothing to do here. } @@ -433,7 +433,7 @@ func (n *Node) fetchDiff(round uint64, prevRoot, thisRoot storageApi.Root) { } func (n *Node) finalize(summary *blockSummary) { - err := n.localStorage.NodeDB().Finalize(n.ctx, summary.Roots) + err := n.localStorage.NodeDB().Finalize(summary.Roots) switch err { case nil: n.logger.Debug("storage round finalized", @@ -506,7 +506,7 @@ func (n *Node) initGenesis(rt *registryApi.Runtime, genesisBlock *block.Block) e return fmt.Errorf("failed to fill in version %d: %w", v, err) } - err = n.localStorage.NodeDB().Finalize(n.ctx, []storageApi.Root{{ + err = n.localStorage.NodeDB().Finalize([]storageApi.Root{{ Namespace: rt.ID, Version: v + 1, Type: storageApi.RootTypeState, @@ -551,7 +551,7 @@ func (n *Node) flushSyncedState(summary *blockSummary) (uint64, error) { defer n.syncedLock.Unlock() n.syncedState = *summary - if err := n.commonNode.Runtime.History().StorageSyncCheckpoint(n.ctx, n.syncedState.Round); err != nil { + if err := n.commonNode.Runtime.History().StorageSyncCheckpoint(n.syncedState.Round); err != nil { return 0, err } @@ -879,7 +879,7 @@ func (n *Node) worker() { // nolint: gocyclo return } - err = n.localStorage.NodeDB().Finalize(n.ctx, []storageApi.Root{{ + err = n.localStorage.NodeDB().Finalize([]storageApi.Root{{ Namespace: n.commonNode.Runtime.ID(), Version: v + 1, Type: storageApi.RootTypeState, diff --git a/go/worker/storage/init.go b/go/worker/storage/init.go index 19c139f0570..6678f5e436c 100644 --- a/go/worker/storage/init.go +++ b/go/worker/storage/init.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/viper" "github.com/oasisprotocol/oasis-core/go/common" - "github.com/oasisprotocol/oasis-core/go/common/identity" "github.com/oasisprotocol/oasis-core/go/config" cmdFlags "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common/flags" @@ -32,7 +31,6 @@ func GetLocalBackendDBDir(dataDir, backend string) string { func NewLocalBackend( dataDir string, namespace common.Namespace, - identity *identity.Identity, ) (api.LocalBackend, error) { cfg := &api.Config{ Backend: strings.ToLower(config.GlobalConfig.Storage.Backend), diff --git a/go/worker/storage/service_internal.go b/go/worker/storage/service_internal.go index 7ee553fd0a3..cf5d0ecf064 100644 --- a/go/worker/storage/service_internal.go +++ b/go/worker/storage/service_internal.go @@ -8,7 +8,7 @@ import ( var _ api.StorageWorker = (*Worker)(nil) -func (w *Worker) GetLastSyncedRound(ctx context.Context, request *api.GetLastSyncedRoundRequest) (*api.GetLastSyncedRoundResponse, error) { +func (w *Worker) GetLastSyncedRound(_ context.Context, request *api.GetLastSyncedRoundRequest) (*api.GetLastSyncedRoundResponse, error) { node := w.runtimes[request.RuntimeID] if node == nil { return nil, api.ErrRuntimeNotFound @@ -22,7 +22,7 @@ func (w *Worker) GetLastSyncedRound(ctx context.Context, request *api.GetLastSyn }, nil } -func (w *Worker) PauseCheckpointer(ctx context.Context, request *api.PauseCheckpointerRequest) error { +func (w *Worker) PauseCheckpointer(_ context.Context, request *api.PauseCheckpointerRequest) error { node := w.runtimes[request.RuntimeID] if node == nil { return api.ErrRuntimeNotFound diff --git a/go/worker/storage/worker.go b/go/worker/storage/worker.go index b12db60a364..3c7707b4e55 100644 --- a/go/worker/storage/worker.go +++ b/go/worker/storage/worker.go @@ -9,7 +9,6 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/node" "github.com/oasisprotocol/oasis-core/go/common/workerpool" "github.com/oasisprotocol/oasis-core/go/config" - genesis "github.com/oasisprotocol/oasis-core/go/genesis/api" "github.com/oasisprotocol/oasis-core/go/storage/mkvs/checkpoint" workerCommon "github.com/oasisprotocol/oasis-core/go/worker/common" committeeCommon "github.com/oasisprotocol/oasis-core/go/worker/common/committee" @@ -38,7 +37,6 @@ func New( grpcInternal *grpc.Server, commonWorker *workerCommon.Worker, registration *registration.Worker, - genesis genesis.Provider, ) (*Worker, error) { enabled := config.GlobalConfig.Mode.HasLocalStorage() if config.GlobalConfig.Mode == config.ModeArchive && len(commonWorker.GetRuntimes()) > 0 { @@ -71,7 +69,7 @@ func New( // Start storage node for every runtime. for id, rt := range s.commonWorker.GetRuntimes() { - if err := s.registerRuntime(commonWorker.DataDir, rt, checkpointerCfg); err != nil { + if err := s.registerRuntime(rt, checkpointerCfg); err != nil { return nil, fmt.Errorf("failed to create storage worker for runtime %s: %w", id, err) } } @@ -82,7 +80,7 @@ func New( return s, nil } -func (w *Worker) registerRuntime(dataDir string, commonNode *committeeCommon.Node, checkpointerCfg *checkpoint.CheckpointerConfig) error { +func (w *Worker) registerRuntime(commonNode *committeeCommon.Node, checkpointerCfg *checkpoint.CheckpointerConfig) error { id := commonNode.Runtime.ID() w.logger.Info("registering new runtime", "runtime_id", id, @@ -100,7 +98,7 @@ func (w *Worker) registerRuntime(dataDir string, commonNode *committeeCommon.Nod } } - localStorage, err := NewLocalBackend(commonNode.Runtime.DataDir(), id, commonNode.Identity) + localStorage, err := NewLocalBackend(commonNode.Runtime.DataDir(), id) if err != nil { return fmt.Errorf("can't create local storage backend: %w", err) } From cc724b77b34986bfbe78bdc451e25b86cd620389 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 22:10:01 +0200 Subject: [PATCH 05/11] go-lint: Remove unused functions --- go/oasis-node/cmd/debug/byzantine/grpc.go | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 go/oasis-node/cmd/debug/byzantine/grpc.go diff --git a/go/oasis-node/cmd/debug/byzantine/grpc.go b/go/oasis-node/cmd/debug/byzantine/grpc.go deleted file mode 100644 index 95d1a33db26..00000000000 --- a/go/oasis-node/cmd/debug/byzantine/grpc.go +++ /dev/null @@ -1,19 +0,0 @@ -package byzantine - -import ( - "net" - - "github.com/spf13/viper" - - "github.com/oasisprotocol/oasis-core/go/common/node" - cmdGrpc "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common/grpc" -) - -func getGrpcAddress() []node.Address { - return []node.Address{ - { - IP: net.IPv4(127, 0, 0, 1), - Port: viper.GetInt64(cmdGrpc.CfgServerPort), - }, - } -} From c6a4078085e9a20b12fc12369754794513f92156 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 15:26:43 +0200 Subject: [PATCH 06/11] go-lint: Ignore hardcoded credentials --- go/keymanager/api/api.go | 2 +- go/oasis-test-runner/scenario/e2e/genesis_file.go | 4 ++-- .../scenario/e2e/runtime/multiple_runtimes.go | 2 +- go/oasis-test-runner/scenario/e2e/stake_cli.go | 4 ++-- go/p2p/protocol/protocol_test.go | 2 +- go/storage/mkvs/tree_test.go | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go/keymanager/api/api.go b/go/keymanager/api/api.go index 9926415bbcc..c115d73612a 100644 --- a/go/keymanager/api/api.go +++ b/go/keymanager/api/api.go @@ -83,7 +83,7 @@ var ( RPCMethodGetPublicKey = "get_public_key" // RPCMethodGetPublicEphemeralKey is the name of the `get_public_ephemeral_key` method. - RPCMethodGetPublicEphemeralKey = "get_public_ephemeral_key" + RPCMethodGetPublicEphemeralKey = "get_public_ephemeral_key" // #nosec G101 // RPCMethodGenerateMasterSecret is the name of the `generate_master_secret` RPC method. RPCMethodGenerateMasterSecret = "generate_master_secret" diff --git a/go/oasis-test-runner/scenario/e2e/genesis_file.go b/go/oasis-test-runner/scenario/e2e/genesis_file.go index e455359968f..8d5ecb0670a 100644 --- a/go/oasis-test-runner/scenario/e2e/genesis_file.go +++ b/go/oasis-test-runner/scenario/e2e/genesis_file.go @@ -23,11 +23,11 @@ import ( const ( // Mainnet genesis dump at height: 11645601. genesisURL = "https://oasis-artifacts.s3.us-east-2.amazonaws.com/genesis_mainnet_dump_11645601.json" - genesisSHA256 = "16386902d822227d0ba1e011ab84a754a48c61457e06240986f9c00e84895459" + genesisSHA256 = "16386902d822227d0ba1e011ab84a754a48c61457e06240986f9c00e84895459" // #nosec G101 genesisNeedsUpgrade = true // Only relevant if genesis file doesn't need upgrade. - genesisDocumentHash = "b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535" + genesisDocumentHash = "b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535" // #nosec G101 ) // GenesisFile is the scenario for testing the correctness of marshalled genesis diff --git a/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go b/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go index 676d3a9a3c1..f79db8b72ee 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/multiple_runtimes.go @@ -18,7 +18,7 @@ const ( // cfgNumComputeRuntimes is the number of runtimes, all with common runtimeBinary registered. cfgNumComputeRuntimes = "num_compute_runtimes" // cfgNumComputeRuntimeTxns is the number of insert test transactions sent to each runtime. - cfgNumComputeRuntimeTxns = "num_compute_runtime_txns" + cfgNumComputeRuntimeTxns = "num_compute_runtime_txns" // #nosec G101 // cfgNumComputeWorkers is the number of compute workers. cfgNumComputeWorkers = "num_compute_workers" // cfgExecutorGroupSize is the number of executor nodes. diff --git a/go/oasis-test-runner/scenario/e2e/stake_cli.go b/go/oasis-test-runner/scenario/e2e/stake_cli.go index 6be4a01a9b5..f7dd24e6c7e 100644 --- a/go/oasis-test-runner/scenario/e2e/stake_cli.go +++ b/go/oasis-test-runner/scenario/e2e/stake_cli.go @@ -59,10 +59,10 @@ const ( feeGas = 10000 // Testing source account public key (hex-encoded). - srcPubkeyHex = "4ea5328f943ef6f66daaed74cb0e99c3b1c45f76307b425003dbc7cb3638ed35" + srcPubkeyHex = "4ea5328f943ef6f66daaed74cb0e99c3b1c45f76307b425003dbc7cb3638ed35" // #nosec G101 // Testing escrow account public key (hex-encoded). - escrowPubkeyHex = "6ea5328f943ef6f66daaed74cb0e99c3b1c45f76307b425003dbc7cb3638ed35" + escrowPubkeyHex = "6ea5328f943ef6f66daaed74cb0e99c3b1c45f76307b425003dbc7cb3638ed35" // #nosec G101 ) var ( diff --git a/go/p2p/protocol/protocol_test.go b/go/p2p/protocol/protocol_test.go index 72784437639..e2898d1af07 100644 --- a/go/p2p/protocol/protocol_test.go +++ b/go/p2p/protocol/protocol_test.go @@ -12,7 +12,7 @@ import ( ) func TestProtocolID(t *testing.T) { - chainContext := "d19ea2397fde0eba4b429f05443cced640c1f866c6df43f07132f1cdf6516c84" + chainContext := "d19ea2397fde0eba4b429f05443cced640c1f866c6df43f07132f1cdf6516c84" // #nosec G101 version := version.Version{Major: 1, Minor: 2, Patch: 3} t.Run("NewProtocolID", func(t *testing.T) { diff --git a/go/storage/mkvs/tree_test.go b/go/storage/mkvs/tree_test.go index 8f3cb913b8f..a3b7cbcd2af 100644 --- a/go/storage/mkvs/tree_test.go +++ b/go/storage/mkvs/tree_test.go @@ -25,14 +25,14 @@ import ( const ( insertItems = 1000 - allItemsRoot = "2187c55627819b60069888ba86f83dc2a9f50c827624b0e31e31261806300ede" + allItemsRoot = "2187c55627819b60069888ba86f83dc2a9f50c827624b0e31e31261806300ede" // #nosec G101 insertItemsShort = 500 - allItemsRootShort = "cf6e9b6a26e10a8218b8658ac9302af1a4c1ae4e1b1a7633860a0f81fb759495" + allItemsRootShort = "cf6e9b6a26e10a8218b8658ac9302af1a4c1ae4e1b1a7633860a0f81fb759495" // #nosec G101 longKey = "Unlock the potential of your data without compromising security or privacy" longValue = "The platform that puts data privacy first. From sharing medical records, to analyzing personal financial information, to training machine learning models, the Oasis platform supports applications that use even the most sensitive data without compromising privacy or performance." - allLongItemsRoot = "d829bb244a709bacf33bc2d8b4a016592e5310a10910aa980ef91cb3b4347dcb" + allLongItemsRoot = "d829bb244a709bacf33bc2d8b4a016592e5310a10910aa980ef91cb3b4347dcb" // #nosec G101 ) var ( From 0da7fabfdce5dfd3b219cc339e9f95fed34bd3fc Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 22:06:49 +0200 Subject: [PATCH 07/11] go-lint: Ignore implicit memory aliasing in for loops --- go/consensus/cometbft/apps/governance/genesis_test.go | 2 +- go/consensus/cometbft/apps/governance/governance.go | 8 ++++---- .../cometbft/apps/governance/state/state_test.go | 4 ++-- .../cometbft/apps/governance/transactions_test.go | 2 +- go/consensus/cometbft/apps/scheduler/scheduler_test.go | 2 +- go/consensus/cometbft/apps/staking/genesis.go | 10 +++++----- go/consensus/cometbft/apps/staking/messages.go | 6 +++--- .../cometbft/apps/staking/transactions_test.go | 2 +- go/consensus/cometbft/roothash/roothash.go | 2 +- go/governance/api/proposal.go | 2 +- go/governance/api/sanity_check.go | 2 +- go/oasis-node/cmd/debug/txsource/workload/queries.go | 2 +- go/oasis-test-runner/scenario/e2e/gas_fees_staking.go | 2 +- .../scenario/e2e/runtime/storage_sync.go | 2 +- go/p2p/peermgmt/registry.go | 2 +- go/registry/api/api.go | 2 +- go/registry/api/api_test.go | 2 +- go/registry/api/runtime_test.go | 2 +- go/registry/tests/tester.go | 2 +- go/runtime/txpool/main_queue.go | 8 ++++---- go/staking/api/api_test.go | 4 ++-- go/staking/api/commission.go | 2 +- go/staking/api/sanity_check.go | 8 ++++---- go/staking/tests/state.go | 10 +++++----- 24 files changed, 45 insertions(+), 45 deletions(-) diff --git a/go/consensus/cometbft/apps/governance/genesis_test.go b/go/consensus/cometbft/apps/governance/genesis_test.go index 519c5d6c104..035f9819414 100644 --- a/go/consensus/cometbft/apps/governance/genesis_test.go +++ b/go/consensus/cometbft/apps/governance/genesis_test.go @@ -427,7 +427,7 @@ func TestGenesis(t *testing.T) { require.NoError(err, "SetActiveProposal") case governance.StatePassed: if p.Content.Upgrade != nil && p.Content.Upgrade.Descriptor.Epoch > currentEpoch { - err = state.SetPendingUpgrade(ctx, p.ID, &p.Content.Upgrade.Descriptor) + err = state.SetPendingUpgrade(ctx, p.ID, &p.Content.Upgrade.Descriptor) //nolint:gosec require.NoError(err, "SetPendingUpgrade") } fallthrough diff --git a/go/consensus/cometbft/apps/governance/governance.go b/go/consensus/cometbft/apps/governance/governance.go index c468a737681..a220abefa30 100644 --- a/go/consensus/cometbft/apps/governance/governance.go +++ b/go/consensus/cometbft/apps/governance/governance.go @@ -392,7 +392,7 @@ func (app *governanceApplication) closeProposal( // Skip non-validator votes. continue } - validatorVotes[vote.Voter] = &vote.Vote + validatorVotes[vote.Voter] = &vote.Vote //nolint:gosec if err = addShares(validatorVoteShares[vote.Voter], vote.Vote, escrow.TotalShares); err != nil { return fmt.Errorf("failed to add shares: %w", err) } @@ -416,7 +416,7 @@ func (app *governanceApplication) closeProposal( } delegationToValidator = true validatorVote := validatorVotes[to] - if validatorVote == &vote.Vote { + if validatorVote == &vote.Vote { //nolint:gosec // Vote matches the delegated validator vote. continue } @@ -612,7 +612,7 @@ func (app *governanceApplication) EndBlock(ctx *api.Context) (types.ResponseEndB if err = stakingState.TransferFromGovernanceDeposits( ctx, proposal.Submitter, - &proposal.Deposit, + &proposal.Deposit, //nolint:gosec ); err != nil { ctx.Logger().Error("failed to transfer from governance deposits", "err", err, @@ -626,7 +626,7 @@ func (app *governanceApplication) EndBlock(ctx *api.Context) (types.ResponseEndB // Proposal rejected, deposit is transferred into the common pool. if err = stakingState.DiscardGovernanceDeposit( ctx, - &proposal.Deposit, + &proposal.Deposit, //nolint:gosec ); err != nil { return types.ResponseEndBlock{}, fmt.Errorf("consensus/governance: failed to discard proposal deposit: %w", err) diff --git a/go/consensus/cometbft/apps/governance/state/state_test.go b/go/consensus/cometbft/apps/governance/state/state_test.go index e9818c9b59c..9f731d725bf 100644 --- a/go/consensus/cometbft/apps/governance/state/state_test.go +++ b/go/consensus/cometbft/apps/governance/state/state_test.go @@ -270,9 +270,9 @@ func TestPendingUpgrades(t *testing.T) { if proposal.Content.Upgrade == nil { continue } - err := s.SetPendingUpgrade(ctx, proposal.ID, &proposal.Content.Upgrade.Descriptor) + err := s.SetPendingUpgrade(ctx, proposal.ID, &proposal.Content.Upgrade.Descriptor) //nolint:gosec require.NoError(err, "SetPendingUpgrade()") - expectedPendingUpgrades = append(expectedPendingUpgrades, &proposal.Content.Upgrade.Descriptor) + expectedPendingUpgrades = append(expectedPendingUpgrades, &proposal.Content.Upgrade.Descriptor) //nolint:gosec } pendingUpgrades, err := s.PendingUpgrades(ctx) diff --git a/go/consensus/cometbft/apps/governance/transactions_test.go b/go/consensus/cometbft/apps/governance/transactions_test.go index 6d0a56665a3..9e104304de3 100644 --- a/go/consensus/cometbft/apps/governance/transactions_test.go +++ b/go/consensus/cometbft/apps/governance/transactions_test.go @@ -249,7 +249,7 @@ func TestSubmitProposal(t *testing.T) { err = governanceDepositsAfter.Sub(governanceDepositsBefore) require.NoError(err, "quantity.Sub") - require.EqualValues(&tc.params.MinProposalDeposit, governanceDepositsAfter, tc.msg) + require.EqualValues(&tc.params.MinProposalDeposit, governanceDepositsAfter, tc.msg) //nolint:gosec } } diff --git a/go/consensus/cometbft/apps/scheduler/scheduler_test.go b/go/consensus/cometbft/apps/scheduler/scheduler_test.go index 95f37ea851f..c65c98b3cc4 100644 --- a/go/consensus/cometbft/apps/scheduler/scheduler_test.go +++ b/go/consensus/cometbft/apps/scheduler/scheduler_test.go @@ -799,7 +799,7 @@ func TestElectCommittee(t *testing.T) { nil, nil, tc.validatorEntities, - &tc.rt, + &tc.rt, //nolint:gosec nodes, tc.kind, ) diff --git a/go/consensus/cometbft/apps/staking/genesis.go b/go/consensus/cometbft/apps/staking/genesis.go index b696f06ae97..1fce6eab8d9 100644 --- a/go/consensus/cometbft/apps/staking/genesis.go +++ b/go/consensus/cometbft/apps/staking/genesis.go @@ -124,19 +124,19 @@ func (app *stakingApplication) initLedger( return fmt.Errorf("cometbft/staking: non-empty stake accumulator in genesis for account %s", addr) } - if err := totalSupply.Add(&acct.General.Balance); err != nil { + if err := totalSupply.Add(&acct.General.Balance); err != nil { //nolint:gosec ctx.Logger().Error("InitChain: failed to add general balance", "err", err, ) return fmt.Errorf("cometbft/staking: failed to add general balance: %w", err) } - if err := totalSupply.Add(&acct.Escrow.Active.Balance); err != nil { + if err := totalSupply.Add(&acct.Escrow.Active.Balance); err != nil { //nolint:gosec ctx.Logger().Error("InitChain: failed to add active escrow balance", "err", err, ) return fmt.Errorf("cometbft/staking: failed to add active escrow balance: %w", err) } - if err := totalSupply.Add(&acct.Escrow.Debonding.Balance); err != nil { + if err := totalSupply.Add(&acct.Escrow.Debonding.Balance); err != nil { //nolint:gosec ctx.Logger().Error("InitChain: failed to add debonding escrow balance", "err", err, ) @@ -194,7 +194,7 @@ func (app *stakingApplication) initDelegations(ctx *abciAPI.Context, state *stak delegatorAddr, escrowAddr, ) } - if err := delegationShares.Add(&delegation.Shares); err != nil { + if err := delegationShares.Add(&delegation.Shares); err != nil { //nolint:gosec ctx.Logger().Error("InitChain: failed to add delegation shares", "err", err, ) @@ -250,7 +250,7 @@ func (app *stakingApplication) initDebondingDelegations(ctx *abciAPI.Context, st delegatorAddr, escrowAddr, idx, ) } - if err := debondingShares.Add(&delegation.Shares); err != nil { + if err := debondingShares.Add(&delegation.Shares); err != nil { //nolint:gosec ctx.Logger().Error("InitChain: failed to add debonding delegation shares", "err", err, ) diff --git a/go/consensus/cometbft/apps/staking/messages.go b/go/consensus/cometbft/apps/staking/messages.go index f1c85683f39..77bfb3f8f29 100644 --- a/go/consensus/cometbft/apps/staking/messages.go +++ b/go/consensus/cometbft/apps/staking/messages.go @@ -64,19 +64,19 @@ func (app *stakingApplication) changeParameters(ctx *api.Context, msg interface{ } var updated bool for i, bound := range acc.Escrow.CommissionSchedule.Bounds { - if changes.MinCommissionRate.Cmp(&bound.RateMin) > 0 { + if changes.MinCommissionRate.Cmp(&bound.RateMin) > 0 { //nolint:gosec // Update the minimum rate bound, to be at least the minimum bound. acc.Escrow.CommissionSchedule.Bounds[i].RateMin = *changes.MinCommissionRate.Clone() updated = true } - if changes.MinCommissionRate.Cmp(&bound.RateMax) > 0 { + if changes.MinCommissionRate.Cmp(&bound.RateMax) > 0 { //nolint:gosec // Update the maximum rate bound, to be at least the minimum bound. acc.Escrow.CommissionSchedule.Bounds[i].RateMax = *changes.MinCommissionRate.Clone() updated = true } } for i, rate := range acc.Escrow.CommissionSchedule.Rates { - if changes.MinCommissionRate.Cmp(&rate.Rate) > 0 { + if changes.MinCommissionRate.Cmp(&rate.Rate) > 0 { //nolint:gosec // Update the rate, to be at least the minimum bound. acc.Escrow.CommissionSchedule.Rates[i].Rate = *changes.MinCommissionRate.Clone() updated = true diff --git a/go/consensus/cometbft/apps/staking/transactions_test.go b/go/consensus/cometbft/apps/staking/transactions_test.go index e047fcf900b..38e5defd069 100644 --- a/go/consensus/cometbft/apps/staking/transactions_test.go +++ b/go/consensus/cometbft/apps/staking/transactions_test.go @@ -615,7 +615,7 @@ func TestWithdraw(t *testing.T) { expectedBalance := beforeAcct.General.Balance switch tc.err { case nil: - err = expectedBalance.Sub(&tc.withdraw.Amount) + err = expectedBalance.Sub(&tc.withdraw.Amount) //nolint:gosec require.NoError(err, "computing expected balance should not fail") if expectedBalance.IsZero() { diff --git a/go/consensus/cometbft/roothash/roothash.go b/go/consensus/cometbft/roothash/roothash.go index 8b64732abbf..65eb5da5ab9 100644 --- a/go/consensus/cometbft/roothash/roothash.go +++ b/go/consensus/cometbft/roothash/roothash.go @@ -588,7 +588,7 @@ func (sc *serviceClient) DeliverEvent(ctx context.Context, height int64, tx cmtt if sc.trackedRuntime[ev.RuntimeID] == nil { continue } - if err = sc.processFinalizedEvent(ctx, height, ev.RuntimeID, &ev.Finalized.Round, false); err != nil { + if err = sc.processFinalizedEvent(ctx, height, ev.RuntimeID, &ev.Finalized.Round, false); err != nil { //nolint:gosec return fmt.Errorf("roothash: failed to process finalized event: %w", err) } } diff --git a/go/governance/api/proposal.go b/go/governance/api/proposal.go index e2f47e22acf..add8aaa7401 100644 --- a/go/governance/api/proposal.go +++ b/go/governance/api/proposal.go @@ -271,7 +271,7 @@ func PendingUpgradesFromProposals(proposals []*Proposal, epoch beacon.EpochTime) var pendingUpgrades []*upgrade.Descriptor var proposalIDs []uint64 for _, p := range acceptedProposals { - pendingUpgrades = append(pendingUpgrades, &p.Content.Upgrade.Descriptor) + pendingUpgrades = append(pendingUpgrades, &p.Content.Upgrade.Descriptor) //nolint:gosec proposalIDs = append(proposalIDs, p.ID) } return pendingUpgrades, proposalIDs diff --git a/go/governance/api/sanity_check.go b/go/governance/api/sanity_check.go index 498839fdbe2..23486ee82c5 100644 --- a/go/governance/api/sanity_check.go +++ b/go/governance/api/sanity_check.go @@ -80,7 +80,7 @@ func SanityCheckProposals(proposals []*Proposal, epoch beacon.EpochTime, governa if p.Content.Upgrade != nil && p.Content.Upgrade.Epoch < epoch { return fmt.Errorf("proposal %v: active proposal with past upgrade epoch", p.ID) } - if err := activeProposalDeposits.Add(&p.Deposit); err != nil { + if err := activeProposalDeposits.Add(&p.Deposit); err != nil { //nolint:gosec return fmt.Errorf("activeProposalDeposits.Add(Deposit): %w", err) } diff --git a/go/oasis-node/cmd/debug/txsource/workload/queries.go b/go/oasis-node/cmd/debug/txsource/workload/queries.go index 3bc1005f573..358179401e9 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/queries.go +++ b/go/oasis-node/cmd/debug/txsource/workload/queries.go @@ -417,7 +417,7 @@ func (q *queries) doRegistryQueries(ctx context.Context, height int64) error { node, err = q.registry.GetNodeByConsensusAddress( ctx, ®istry.ConsensusAddressQuery{ - Address: []byte(tmcrypto.PublicKeyToCometBFT(&nod.Consensus.ID).Address()), Height: height, + Address: []byte(tmcrypto.PublicKeyToCometBFT(&nod.Consensus.ID).Address()), Height: height, //nolint:gosec }, ) if err != nil { diff --git a/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go b/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go index 645936f4e21..79fb7295a12 100644 --- a/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go +++ b/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go @@ -425,7 +425,7 @@ func (sc *gasFeesImpl) testStakingGas( } if t.checkOk { - _ = totalFees.Add(&t.fee.Amount) + _ = totalFees.Add(&t.fee.Amount) //nolint:gosec } } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/storage_sync.go b/go/oasis-test-runner/scenario/e2e/runtime/storage_sync.go index 712589d2c88..78e817a7386 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/storage_sync.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/storage_sync.go @@ -155,7 +155,7 @@ func (sc *storageSyncImpl) Run(ctx context.Context, childEnv *env.Env) error { / } var found bool for _, root := range blk.Header.StorageRoots() { - if root.Equal(&cp.Root) { + if root.Equal(&cp.Root) { //nolint:gosec found = true break } diff --git a/go/p2p/peermgmt/registry.go b/go/p2p/peermgmt/registry.go index b95fc04d3b0..0636ea322b6 100644 --- a/go/p2p/peermgmt/registry.go +++ b/go/p2p/peermgmt/registry.go @@ -185,7 +185,7 @@ func (r *peerRegistry) handleNodes(nodes []*node.Node, reset bool) { peers := make(map[core.PeerID]*peerData) for _, n := range nodes { - info, err := p2pInfoToAddrInfo(&n.P2P) + info, err := p2pInfoToAddrInfo(&n.P2P) //nolint:gosec if err != nil { r.logger.Error("failed to convert node to node info", "err", err, diff --git a/go/registry/api/api.go b/go/registry/api/api.go index 5aae4f2d285..28575043af9 100644 --- a/go/registry/api/api.go +++ b/go/registry/api/api.go @@ -980,7 +980,7 @@ func verifyNodeRuntimeChanges( return false } - if !verifyRuntimeCapabilities(logger, ¤tRuntime.Capabilities, &newRuntime.Capabilities) { + if !verifyRuntimeCapabilities(logger, ¤tRuntime.Capabilities, &newRuntime.Capabilities) { //nolint:gosec curRtJSON, _ := json.Marshal(currentRuntime) newRtJSON, _ := json.Marshal(newRuntime) logger.Error("RegisterNode: trying to update runtimes, runtime Capabilities changed", diff --git a/go/registry/api/api_test.go b/go/registry/api/api_test.go index 326bcf22f97..684423cfb13 100644 --- a/go/registry/api/api_test.go +++ b/go/registry/api/api_test.go @@ -204,7 +204,7 @@ func TestVerifyRegisterNodeArgs(t *testing.T) { signedNode, err := node.MultiSignNode( nodeSigners, RegisterGenesisNodeSignatureContext, - &tc.n, + &tc.n, //nolint:gosec ) require.NoError(err, "singing node") _, _, err = VerifyRegisterNodeArgs(context.Background(), params, logger, signedNode, entity, time.Now(), 1, false, false, beacon.EpochTime(10), rtLookup, ndLookup) diff --git a/go/registry/api/runtime_test.go b/go/registry/api/runtime_test.go index d1d7c693d02..bdc81cf5ed0 100644 --- a/go/registry/api/runtime_test.go +++ b/go/registry/api/runtime_test.go @@ -656,7 +656,7 @@ func TestVerifyRuntime(t *testing.T) { tc.cpFn(&cp) } - err := VerifyRuntime(&cp, logging.GetLogger("runtime/tests"), &tc.rr, false, true, beacon.EpochTime(10)) + err := VerifyRuntime(&cp, logging.GetLogger("runtime/tests"), &tc.rr, false, true, beacon.EpochTime(10)) //nolint:gosec switch { case tc.err == nil: require.NoError(err, tc.msg) diff --git a/go/registry/tests/tester.go b/go/registry/tests/tester.go index a5f621c1e88..25b1957f916 100644 --- a/go/registry/tests/tester.go +++ b/go/registry/tests/tester.go @@ -338,7 +338,7 @@ func testRegistryEntityNodes( // nolint: gocyclo nodeByConsensus, err = backend.GetNodeByConsensusAddress( ctx, &api.ConsensusAddressQuery{ - Address: []byte(tmcrypto.PublicKeyToCometBFT(&tn.Node.Consensus.ID).Address()), + Address: []byte(tmcrypto.PublicKeyToCometBFT(&tn.Node.Consensus.ID).Address()), //nolint:gosec Height: consensusAPI.HeightLatest, }, ) diff --git a/go/runtime/txpool/main_queue.go b/go/runtime/txpool/main_queue.go index 4598ce5606f..76bf84908ee 100644 --- a/go/runtime/txpool/main_queue.go +++ b/go/runtime/txpool/main_queue.go @@ -88,7 +88,7 @@ func (mq *mainQueue) GetSchedulingSuggestion(countHint uint32) []*TxQueueMeta { txMetas := mq.inner.getPrioritizedBatch(nil, countHint) var txs []*TxQueueMeta for _, txMeta := range txMetas { - txs = append(txs, &txMeta.TxQueueMeta) + txs = append(txs, &txMeta.TxQueueMeta) //nolint:gosec } return txs } @@ -109,7 +109,7 @@ func (mq *mainQueue) GetSchedulingExtra(offset *hash.Hash, limit uint32) []*TxQu txMetas := mq.inner.getPrioritizedBatch(offset, limit) var txs []*TxQueueMeta for _, txMeta := range txMetas { - txs = append(txs, &txMeta.TxQueueMeta) + txs = append(txs, &txMeta.TxQueueMeta) //nolint:gosec } return txs } @@ -119,7 +119,7 @@ func (mq *mainQueue) TakeAll() []*TxQueueMeta { mq.inner.clear() var txs []*TxQueueMeta for _, txMeta := range txMetas { - txs = append(txs, &txMeta.TxQueueMeta) + txs = append(txs, &txMeta.TxQueueMeta) //nolint:gosec } return txs } @@ -135,7 +135,7 @@ func (mq *mainQueue) GetTxsToPublish() []*TxQueueMeta { txMetas := mq.inner.getAll() var txs []*TxQueueMeta for _, txMeta := range txMetas { - txs = append(txs, &txMeta.TxQueueMeta) + txs = append(txs, &txMeta.TxQueueMeta) //nolint:gosec } return txs } diff --git a/go/staking/api/api_test.go b/go/staking/api/api_test.go index 8b3128165a2..668218edcfd 100644 --- a/go/staking/api/api_test.go +++ b/go/staking/api/api_test.go @@ -194,8 +194,8 @@ func TestStakeThreshold(t *testing.T) { {StakeThreshold{}, StakeThreshold{Constant: &c2}, false}, {StakeThreshold{}, StakeThreshold{}, false}, } { - require.True(t.a.Equal(&t.b) == t.equal, "stake threshold equality should work (a == b)") - require.True(t.b.Equal(&t.a) == t.equal, "stake threshold equality should work (b == a)") + require.True(t.a.Equal(&t.b) == t.equal, "stake threshold equality should work (a == b)") //nolint:gosec + require.True(t.b.Equal(&t.a) == t.equal, "stake threshold equality should work (b == a)") //nolint:gosec } } diff --git a/go/staking/api/commission.go b/go/staking/api/commission.go index b8a57c66cd8..e874e9f175d 100644 --- a/go/staking/api/commission.go +++ b/go/staking/api/commission.go @@ -180,7 +180,7 @@ func (cs *CommissionSchedule) validateNondegenerate(rules *CommissionScheduleRul if step.RateMax.Cmp(CommissionRateDenominator) > 0 { return fmt.Errorf("bound step %d maximum rate %v/%v over unity", i, step.RateMax, CommissionRateDenominator) } - if step.RateMax.Cmp(&step.RateMin) < 0 { + if step.RateMax.Cmp(&step.RateMin) < 0 { //nolint:gosec return fmt.Errorf("bound step %d maximum rate %v/%v less than minimum rate %v/%v", i, step.RateMax, CommissionRateDenominator, step.RateMin, CommissionRateDenominator) } if step.RateMax.Cmp(&rules.MinCommissionRate) < 0 { diff --git a/go/staking/api/sanity_check.go b/go/staking/api/sanity_check.go index 4d69e282690..7506142c458 100644 --- a/go/staking/api/sanity_check.go +++ b/go/staking/api/sanity_check.go @@ -154,7 +154,7 @@ func SanityCheckDelegations(addr Address, account *Account, delegations map[Addr delegatorAddr, addr, ) } - _ = shares.Add(&delegation.Shares) + _ = shares.Add(&delegation.Shares) //nolint:gosec numDelegations++ } @@ -195,7 +195,7 @@ func SanityCheckDebondingDelegations(addr Address, account *Account, delegations ) } for _, delegation := range dels { - _ = shares.Add(&delegation.Shares) + _ = shares.Add(&delegation.Shares) //nolint:gosec numDebondingDelegations++ } } @@ -232,7 +232,7 @@ func SanityCheckAccountShares( var shares quantity.Quantity var numDelegations uint64 for _, d := range delegations { - _ = shares.Add(&d.Shares) + _ = shares.Add(&d.Shares) //nolint:gosec numDelegations++ } // Account's total active shares in escrow should match delegations. @@ -257,7 +257,7 @@ func SanityCheckAccountShares( var numDebondingDelegations uint64 for _, dels := range debondingDelegations { for _, d := range dels { - _ = debondingShares.Add(&d.Shares) + _ = debondingShares.Add(&d.Shares) //nolint:gosec numDebondingDelegations++ } } diff --git a/go/staking/tests/state.go b/go/staking/tests/state.go index fa0d7701113..fbf965af162 100644 --- a/go/staking/tests/state.go +++ b/go/staking/tests/state.go @@ -246,13 +246,13 @@ func GenesisState() api.Genesis { // Adjust common pool for the remaining balance. remainingBalance := state.TotalSupply.Clone() for _, acc := range state.Ledger { - if err := remainingBalance.Sub(&acc.General.Balance); err != nil { + if err := remainingBalance.Sub(&acc.General.Balance); err != nil { //nolint:gosec panic(err) } - if err := remainingBalance.Sub(&acc.Escrow.Active.Balance); err != nil { + if err := remainingBalance.Sub(&acc.Escrow.Active.Balance); err != nil { //nolint:gosec panic(err) } - if err := remainingBalance.Sub(&acc.Escrow.Debonding.Balance); err != nil { + if err := remainingBalance.Sub(&acc.Escrow.Debonding.Balance); err != nil { //nolint:gosec panic(err) } } @@ -262,7 +262,7 @@ func GenesisState() api.Genesis { for addr, dels := range state.Delegations { totalShares := quantity.NewQuantity() for _, del := range dels { - if err := totalShares.Add(&del.Shares); err != nil { + if err := totalShares.Add(&del.Shares); err != nil { //nolint:gosec panic(err) } } @@ -272,7 +272,7 @@ func GenesisState() api.Genesis { totalShares := quantity.NewQuantity() for _, debDelList := range debDelLists { for _, debDel := range debDelList { - if err := totalShares.Add(&debDel.Shares); err != nil { + if err := totalShares.Add(&debDel.Shares); err != nil { //nolint:gosec panic(err) } } From 1266457c75cfbc0cbca0c3673aff65b572fceb54 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Thu, 24 Aug 2023 22:27:30 +0200 Subject: [PATCH 08/11] go-lint: Remove redundant if-return block --- go/common/crypto/signature/signature.go | 5 +-- go/common/sgx/aesm/aesm.go | 4 +- go/common/sgx/ias/quote.go | 5 +-- go/common/sgx/pcs/tcb.go | 6 +-- go/common/workerpool/workerpool.go | 2 +- go/consensus/cometbft/abci/state.go | 6 +-- .../cometbft/apps/beacon/backend_insecure.go | 5 +-- .../apps/beacon/state/interop/interop.go | 6 +-- .../cometbft/apps/governance/governance.go | 6 +-- .../apps/staking/state/interop/interop.go | 6 +-- go/consensus/cometbft/full/common.go | 6 +-- go/genesis/api/sanity_check.go | 6 +-- go/keymanager/api/sanity_check.go | 6 +-- go/keymanager/api/secret.go | 12 +----- go/oasis-node/cmd/control/control.go | 6 +-- .../cmd/debug/txsource/workload/queries.go | 2 +- go/oasis-node/cmd/genesis/genesis.go | 6 +-- go/oasis-test-runner/oasis/cli/cli.go | 5 +-- .../e2e/consensus_parameter_upgrade.go | 6 +-- .../scenario/e2e/gas_fees_staking.go | 6 +-- .../scenario/e2e/helpers_consensus.go | 5 +-- .../scenario/e2e/min_transact_balance.go | 7 +--- .../scenario/e2e/runtime/byzantine.go | 2 +- .../e2e/runtime/helpers_keymanager.go | 6 +-- .../scenario/e2e/runtime/helpers_runtime.go | 41 +++++++------------ .../e2e/runtime/keymanager_dump_restore.go | 6 +-- .../e2e/runtime/keymanager_replicate.go | 6 +-- .../e2e/runtime/test_client_scenario.go | 6 +-- .../scenario/e2e/runtime/trust_root_change.go | 17 ++------ .../scenario/e2e/runtime/txsource.go | 6 +-- .../scenario/e2e/stake_cli.go | 14 ++----- .../scenario/pluginsigner/basic.go | 6 +-- go/p2p/backup/cstore.go | 6 +-- go/runtime/bundle/bundle.go | 6 +-- go/runtime/host/multi/multi.go | 5 +-- go/staking/api/api.go | 6 +-- go/storage/mkvs/checkpoint/checkpoint_test.go | 4 +- go/storage/mkvs/db/badger/badger.go | 6 +-- go/storage/mkvs/db/badger/migrate.go | 6 +-- go/storage/mkvs/node/key.go | 2 +- go/storage/mkvs/syncer/merge.go | 5 +-- go/storage/mkvs/tree_test.go | 2 +- go/worker/compute/executor/committee/node.go | 4 +- 43 files changed, 68 insertions(+), 218 deletions(-) diff --git a/go/common/crypto/signature/signature.go b/go/common/crypto/signature/signature.go index b483e8d2146..568b2a0f29c 100644 --- a/go/common/crypto/signature/signature.go +++ b/go/common/crypto/signature/signature.go @@ -406,11 +406,8 @@ func (s *Signature) UnmarshalPEM(data []byte) error { if blk.Type != sigPEMType { return fmt.Errorf("signature: expected different PEM block (expected: %s got: %s)", sigPEMType, blk.Type) } - if err := s.Signature.UnmarshalBinary(blk.Bytes); err != nil { - return err - } - return nil + return s.Signature.UnmarshalBinary(blk.Bytes) } // Signed is a signed blob. diff --git a/go/common/sgx/aesm/aesm.go b/go/common/sgx/aesm/aesm.go index 183a487569a..779ad420293 100644 --- a/go/common/sgx/aesm/aesm.go +++ b/go/common/sgx/aesm/aesm.go @@ -82,8 +82,8 @@ func (c *Client) transact(ctx context.Context, request *Request) (*Response, err rsp <- err return } - len := binary.LittleEndian.Uint32(buf) - buf = make([]byte, len) + length := binary.LittleEndian.Uint32(buf) + buf = make([]byte, length) if _, err := io.ReadFull(conn, buf); err != nil { rsp <- err return diff --git a/go/common/sgx/ias/quote.go b/go/common/sgx/ias/quote.go index d1aab2973b3..7ffdc6f784c 100644 --- a/go/common/sgx/ias/quote.go +++ b/go/common/sgx/ias/quote.go @@ -210,9 +210,6 @@ func (q *Quote) UnmarshalBinary(data []byte) error { if err := q.Body.UnmarshalBinary(data[:quoteBodyLen]); err != nil { return err } - if err := q.Report.UnmarshalBinary(data[quoteBodyLen:]); err != nil { - return err - } - return nil + return q.Report.UnmarshalBinary(data[quoteBodyLen:]) } diff --git a/go/common/sgx/pcs/tcb.go b/go/common/sgx/pcs/tcb.go index 11a3ae5c84f..ea99dbbbf06 100644 --- a/go/common/sgx/pcs/tcb.go +++ b/go/common/sgx/pcs/tcb.go @@ -74,11 +74,7 @@ func (bnd *TCBBundle) verifyQEIdentity( if err != nil { return fmt.Errorf("pcs/tcb: invalid QE identity: %w", err) } - if err = qeInfo.verify(qe); err != nil { - return err - } - - return nil + return qeInfo.verify(qe) } // verifyTCBInfo verifies the TCB level and the FMSPC. diff --git a/go/common/workerpool/workerpool.go b/go/common/workerpool/workerpool.go index 12efdf186b3..ca9de903c5d 100644 --- a/go/common/workerpool/workerpool.go +++ b/go/common/workerpool/workerpool.go @@ -80,7 +80,7 @@ func (p *Pool) Stop() { close(p.stopCh) }) - for range p.jobCh.Out() { + for range p.jobCh.Out() { //nolint:revive // Clear the channel to close all go routines and prevent memory leaks. } } diff --git a/go/consensus/cometbft/abci/state.go b/go/consensus/cometbft/abci/state.go index e3c29ce5e6c..caa7e65db0b 100644 --- a/go/consensus/cometbft/abci/state.go +++ b/go/consensus/cometbft/abci/state.go @@ -388,11 +388,7 @@ func (s *applicationState) doApplyStateSync(root storage.Root) error { s.checkState.Close() s.checkState = mkvs.NewWithRoot(nil, s.storage.NodeDB(), root, mkvs.WithoutWriteLog()) - if err := s.doCommitOrInitChainLocked(); err != nil { - return err - } - - return nil + return s.doCommitOrInitChainLocked() } func (s *applicationState) workingStateRoot() (hash.Hash, error) { diff --git a/go/consensus/cometbft/apps/beacon/backend_insecure.go b/go/consensus/cometbft/apps/beacon/backend_insecure.go index 5547470e929..07357c9d143 100644 --- a/go/consensus/cometbft/apps/beacon/backend_insecure.go +++ b/go/consensus/cometbft/apps/beacon/backend_insecure.go @@ -176,8 +176,5 @@ func (impl *backendInsecure) doTxSetEpoch( "is_check_only", ctx.IsCheckOnly(), ) - if err := state.SetFutureEpoch(ctx, epoch, height+1); err != nil { - return err - } - return nil + return state.SetFutureEpoch(ctx, epoch, height+1) } diff --git a/go/consensus/cometbft/apps/beacon/state/interop/interop.go b/go/consensus/cometbft/apps/beacon/state/interop/interop.go index 9b09777325a..3ccb566702c 100644 --- a/go/consensus/cometbft/apps/beacon/state/interop/interop.go +++ b/go/consensus/cometbft/apps/beacon/state/interop/interop.go @@ -15,9 +15,5 @@ func InitializeTestBeaconState(ctx context.Context, mkvs mkvs.Tree) error { if err := state.SetEpoch(ctx, 42, 13); err != nil { return err } - if err := state.SetFutureEpoch(ctx, 43, 15); err != nil { - return err - } - - return nil + return state.SetFutureEpoch(ctx, 43, 15) } diff --git a/go/consensus/cometbft/apps/governance/governance.go b/go/consensus/cometbft/apps/governance/governance.go index a220abefa30..35caa8ffd2f 100644 --- a/go/consensus/cometbft/apps/governance/governance.go +++ b/go/consensus/cometbft/apps/governance/governance.go @@ -474,11 +474,7 @@ func (app *governanceApplication) closeProposal( "invalid_votes", proposal.InvalidVotes, "stake_threshold", params.StakeThreshold, ) - if err := proposal.CloseProposal(totalVotingStake, params.StakeThreshold); err != nil { - return err - } - - return nil + return proposal.CloseProposal(totalVotingStake, params.StakeThreshold) } func addShares(validatorVoteShares map[governance.Vote]quantity.Quantity, vote governance.Vote, amount quantity.Quantity) error { diff --git a/go/consensus/cometbft/apps/staking/state/interop/interop.go b/go/consensus/cometbft/apps/staking/state/interop/interop.go index 4d172825105..66fdebb03e5 100644 --- a/go/consensus/cometbft/apps/staking/state/interop/interop.go +++ b/go/consensus/cometbft/apps/staking/state/interop/interop.go @@ -185,11 +185,7 @@ func InitializeTestStakingState(ctx context.Context, mkvs mkvs.Tree) error { if err := state.SetLastBlockFees(ctx, quantity.NewFromUint64(33)); err != nil { return err } - if err := state.SetGovernanceDeposits(ctx, quantity.NewFromUint64(12)); err != nil { - return err - } - - return nil + return state.SetGovernanceDeposits(ctx, quantity.NewFromUint64(12)) } func init() { diff --git a/go/consensus/cometbft/full/common.go b/go/consensus/cometbft/full/common.go index d00815a925b..1fa99580b17 100644 --- a/go/consensus/cometbft/full/common.go +++ b/go/consensus/cometbft/full/common.go @@ -145,11 +145,7 @@ func (n *commonNode) start() error { return fmt.Errorf("cometbft/common_node: not in initialized state") } - if err := n.mux.Start(); err != nil { - return err - } - - return nil + return n.mux.Start() } func (n *commonNode) finishStart() { diff --git a/go/genesis/api/sanity_check.go b/go/genesis/api/sanity_check.go index 4ef39c43db4..fc87a6ff2b5 100644 --- a/go/genesis/api/sanity_check.go +++ b/go/genesis/api/sanity_check.go @@ -45,9 +45,5 @@ func (d *Document) SanityCheck() error { if err := d.Scheduler.SanityCheck(&d.Staking.TotalSupply); err != nil { return err } - if err := d.Governance.SanityCheck(epoch, &d.Staking.GovernanceDeposits); err != nil { - return err - } - - return nil + return d.Governance.SanityCheck(epoch, &d.Staking.GovernanceDeposits) } diff --git a/go/keymanager/api/sanity_check.go b/go/keymanager/api/sanity_check.go index 2feabf6ac9e..b39f493dae6 100644 --- a/go/keymanager/api/sanity_check.go +++ b/go/keymanager/api/sanity_check.go @@ -35,11 +35,7 @@ func (g *Genesis) SanityCheck() error { return fmt.Errorf("keymanager: sanity check failed: %w", err) } - if err := SanityCheckStatuses(g.Statuses); err != nil { - return err - } - - return nil + return SanityCheckStatuses(g.Statuses) } // SanityCheck performs a sanity check on the consensus parameters. diff --git a/go/keymanager/api/secret.go b/go/keymanager/api/secret.go index 77327a5228a..dc935ccc25f 100644 --- a/go/keymanager/api/secret.go +++ b/go/keymanager/api/secret.go @@ -81,11 +81,7 @@ func (s *EncryptedMasterSecret) SanityCheck(generation uint64, epoch beacon.Epoc return fmt.Errorf("keymanager: sanity check failed: master secret contains an invalid epoch: (expected: %d, got: %d)", epoch, s.Epoch) } - if err := s.Secret.SanityCheck(reks); err != nil { - return err - } - - return nil + return s.Secret.SanityCheck(reks) } // EncryptedEphemeralSecret is an encrypted ephemeral secret. @@ -106,11 +102,7 @@ func (s *EncryptedEphemeralSecret) SanityCheck(epoch beacon.EpochTime, reks map[ return fmt.Errorf("keymanager: sanity check failed: ephemeral secret contains an invalid epoch: (expected: %d, got: %d)", epoch, s.Epoch) } - if err := s.Secret.SanityCheck(reks); err != nil { - return err - } - - return nil + return s.Secret.SanityCheck(reks) } // SignedEncryptedMasterSecret is a RAK signed encrypted master secret. diff --git a/go/oasis-node/cmd/control/control.go b/go/oasis-node/cmd/control/control.go index 5bcdf918a3a..aad5e10b5ec 100644 --- a/go/oasis-node/cmd/control/control.go +++ b/go/oasis-node/cmd/control/control.go @@ -119,10 +119,10 @@ func doIsSynced(cmd *cobra.Command, _ []string) { if synced { fmt.Println("node completed initial syncing") os.Exit(0) - } else { - fmt.Println("node has not completed initial syncing") - os.Exit(1) } + + fmt.Println("node has not completed initial syncing") + os.Exit(1) } func doWaitSync(cmd *cobra.Command, _ []string) { diff --git a/go/oasis-node/cmd/debug/txsource/workload/queries.go b/go/oasis-node/cmd/debug/txsource/workload/queries.go index 358179401e9..07ae2b4c4a0 100644 --- a/go/oasis-node/cmd/debug/txsource/workload/queries.go +++ b/go/oasis-node/cmd/debug/txsource/workload/queries.go @@ -296,7 +296,7 @@ func (q *queries) doConsensusQueries(ctx context.Context, rng *rand.Rand, height it := state.NewIterator(ctx, mkvs.IteratorPrefetch(100)) defer it.Close() - for it.Rewind(); it.Valid(); it.Next() { + for it.Rewind(); it.Valid(); it.Next() { //nolint:revive } if err := it.Err(); err != nil { return fmt.Errorf("consensus state iteration failed: %w", err) diff --git a/go/oasis-node/cmd/genesis/genesis.go b/go/oasis-node/cmd/genesis/genesis.go index bb57a700f34..91ffe9275a1 100644 --- a/go/oasis-node/cmd/genesis/genesis.go +++ b/go/oasis-node/cmd/genesis/genesis.go @@ -619,11 +619,7 @@ func appendStakingState(doc *genesis.Document, statePath string) error { st.State.TokenValueExponent = tokenValueExponent } - if err = st.AppendTo(doc); err != nil { - return err - } - - return nil + return st.AppendTo(doc) } func doDumpGenesis(cmd *cobra.Command, _ []string) { diff --git a/go/oasis-test-runner/oasis/cli/cli.go b/go/oasis-test-runner/oasis/cli/cli.go index 938a9823e03..8c948a96bed 100644 --- a/go/oasis-test-runner/oasis/cli/cli.go +++ b/go/oasis-test-runner/oasis/cli/cli.go @@ -134,10 +134,7 @@ func RunSubCommand(env *env.Env, logger *logging.Logger, name, binary string, ar if err != nil { return err } - if err = cmd.Wait(); err != nil { - return err - } - return nil + return cmd.Wait() } // RunSubCommandWithOutput launches an oasis-node subcommand and waits for it to complete. diff --git a/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go b/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go index 77d1482b254..acb97b7cb71 100644 --- a/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go +++ b/go/oasis-test-runner/scenario/e2e/consensus_parameter_upgrade.go @@ -381,9 +381,5 @@ func (sc *consensusParameterUpgradeImpl) Run(ctx context.Context, _ *env.Env) er // Do one final epoch transition. sc.Logger.Info("final epoch transition") - if err = sc.nextEpoch(ctx); err != nil { - return err - } - - return nil + return sc.nextEpoch(ctx) } diff --git a/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go b/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go index 79fb7295a12..2ebdee812c8 100644 --- a/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go +++ b/go/oasis-test-runner/scenario/e2e/gas_fees_staking.go @@ -245,11 +245,7 @@ func (sc *gasFeesImpl) runTests(ctx context.Context) error { ) } - if err := sc.Net.CheckLogWatchers(); err != nil { - return err - } - - return nil + return sc.Net.CheckLogWatchers() } func (sc *gasFeesImpl) getInitialCommonPoolBalance(ctx context.Context) (*quantity.Quantity, error) { diff --git a/go/oasis-test-runner/scenario/e2e/helpers_consensus.go b/go/oasis-test-runner/scenario/e2e/helpers_consensus.go index 79a079fab5a..518e6686013 100644 --- a/go/oasis-test-runner/scenario/e2e/helpers_consensus.go +++ b/go/oasis-test-runner/scenario/e2e/helpers_consensus.go @@ -64,10 +64,7 @@ func (sc *Scenario) WaitEpochs(ctx context.Context, n beacon.EpochTime) error { if err != nil { return err } - if err := sc.Net.ClientController().Beacon.WaitEpoch(ctx, epoch+n); err != nil { - return err - } - return nil + return sc.Net.ClientController().Beacon.WaitEpoch(ctx, epoch+n) } // ChainContext returns the consensus chain context. diff --git a/go/oasis-test-runner/scenario/e2e/min_transact_balance.go b/go/oasis-test-runner/scenario/e2e/min_transact_balance.go index f8ce91a2c6a..7f41361d6f7 100644 --- a/go/oasis-test-runner/scenario/e2e/min_transact_balance.go +++ b/go/oasis-test-runner/scenario/e2e/min_transact_balance.go @@ -60,15 +60,12 @@ func (mtb *minTransactBalanceImpl) fundFromTestEntity(ctx context.Context, nonce if err != nil { return fmt.Errorf("test entity: %w", err) } - if err = mtb.signAndSubmitTx(ctx, teSigner, staking.NewTransferTx(nonce, &transaction.Fee{ + return mtb.signAndSubmitTx(ctx, teSigner, staking.NewTransferTx(nonce, &transaction.Fee{ Gas: 1300, }, &staking.Transfer{ To: to, Amount: *quantity.NewFromUint64(amount), - })); err != nil { - return err - } - return nil + })) } func (mtb *minTransactBalanceImpl) getAccountAndCheckNonce(ctx context.Context, addr staking.Address, _ uint64) (*staking.Account, error) { diff --git a/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go b/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go index f339b752df1..b411a0f13bf 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/byzantine.go @@ -582,7 +582,7 @@ ComputeWorkerSyncLoop: state := mkvs.NewWithRoot(ctrl.Storage, nil, root) it := state.NewIterator(storageCtx) - for it.Rewind(); it.Valid(); it.Next() { + for it.Rewind(); it.Valid(); it.Next() { //nolint:revive } err = it.Err() it.Close() diff --git a/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go b/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go index 88f79dcb9d4..0ccf77bcfcd 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/helpers_keymanager.go @@ -137,11 +137,7 @@ func (sc *Scenario) UpdateRotationInterval(ctx context.Context, childEnv *env.En policies = status.Policy.Policy.Enclaves } - if err := sc.ApplyKeyManagerPolicy(ctx, childEnv, cli, rotationInterval, policies, nonce); err != nil { - return err - } - - return nil + return sc.ApplyKeyManagerPolicy(ctx, childEnv, cli, rotationInterval, policies, nonce) } // CompareLongtermPublicKeys compares long-term public keys generated by the specified diff --git a/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go b/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go index 465720a4ea6..6984545084c 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/helpers_runtime.go @@ -392,11 +392,7 @@ func (sc *Scenario) UpgradeComputeRuntime(ctx context.Context, childEnv *env.Env } // Make sure the new version is active. - if err := sc.EnsureActiveVersionForComputeWorkers(ctx, newRt, version.MustFromString("0.1.0")); err != nil { - return err - } - - return nil + return sc.EnsureActiveVersionForComputeWorkers(ctx, newRt, version.MustFromString("0.1.0")) } // UpgradeKeyManagerFixture select the first key manager runtime and prepares it for the upgrade. @@ -506,11 +502,7 @@ OUTER: } // Make sure the new version is active on the second key manager node. - if err := sc.EnsureActiveVersionForKeyManager(ctx, newKm, newRt.ID(), version.MustFromString("0.1.0")); err != nil { - return err - } - - return nil + return sc.EnsureActiveVersionForKeyManager(ctx, newKm, newRt.ID(), version.MustFromString("0.1.0")) } func (sc *Scenario) ensureReplicationWorked(ctx context.Context, km *oasis.Keymanager, rt *oasis.Runtime) error { @@ -542,23 +534,18 @@ func (sc *Scenario) ensureReplicationWorked(ctx context.Context, km *oasis.Keyma if err != nil { return fmt.Errorf("failed to obtain consensus state: %w", err) } - if err = func() error { - for _, status := range doc.KeyManager.Statuses { - if !status.ID.Equal(&nodeRt.ID) { - continue - } - if !status.IsInitialized { - return fmt.Errorf("key manager failed to initialize") - } - if !bytes.Equal(status.Checksum, signedInitResponse.InitResponse.Checksum) { - return fmt.Errorf("key manager failed to replicate, checksum mismatch") - } - return nil + + for _, status := range doc.KeyManager.Statuses { + if !status.ID.Equal(&nodeRt.ID) { + continue } - return fmt.Errorf("consensus state missing km status") - }(); err != nil { - return err + if !status.IsInitialized { + return fmt.Errorf("key manager failed to initialize") + } + if !bytes.Equal(status.Checksum, signedInitResponse.InitResponse.Checksum) { + return fmt.Errorf("key manager failed to replicate, checksum mismatch") + } + return nil } - - return nil + return fmt.Errorf("consensus state missing km status") } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_dump_restore.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_dump_restore.go index 0f079024207..68e9a495a77 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_dump_restore.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_dump_restore.go @@ -126,9 +126,5 @@ func (sc *kmDumpRestoreImpl) Run(ctx context.Context, childEnv *env.Env) (err er } // Test if all key managers can derive keys from all master secrets. - if err = sc.CompareLongtermPublicKeys(ctx, []int{0, 1}); err != nil { - return err - } - - return nil + return sc.CompareLongtermPublicKeys(ctx, []int{0, 1}) } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go index e6d7fa6f36f..d915ad13008 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/keymanager_replicate.go @@ -147,11 +147,7 @@ func (sc *kmReplicateImpl) Run(ctx context.Context, _ *env.Env) error { // If we came this far than all key managers should have the same state. // Let's test if they replicated the same secrets by fetching long-term // public keys for all generations. - if err := sc.CompareLongtermPublicKeys(ctx, []int{0, 1, 2, 3}); err != nil { - return err - } - - return nil + return sc.CompareLongtermPublicKeys(ctx, []int{0, 1, 2, 3}) } func (sc *kmReplicateImpl) waitKeymanagerStatuses(ctx context.Context, n int) (*keymanager.Status, error) { diff --git a/go/oasis-test-runner/scenario/e2e/runtime/test_client_scenario.go b/go/oasis-test-runner/scenario/e2e/runtime/test_client_scenario.go index 4b3c8ca2920..8800a720125 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/test_client_scenario.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/test_client_scenario.go @@ -112,11 +112,7 @@ func newSimpleKeyValueScenario(repeat bool, encrypted bool) TestClientScenario { if err := submit(GetKeyValueTx{inMsgKey, inMsgValue, encrypted, 0}); err != nil { return err } - if err := submit(ConsensusAccountsTx{}); err != nil { - return err - } - - return nil + return submit(ConsensusAccountsTx{}) } } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go b/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go index 591a635c679..11fa2b0bbab 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/trust_root_change.go @@ -156,11 +156,7 @@ func (sc *trustRootChangeImpl) happyRun(ctx context.Context, childEnv *env.Env) } // Check logs whether any issues were detected. - if err := sc.Net.CheckLogWatchers(); err != nil { - return err - } - - return nil + return sc.Net.CheckLogWatchers() } // unhappyRun tests that trust is never transferred to untrusted or invalid @@ -342,19 +338,12 @@ func (sc *trustRootChangeImpl) dumpRestoreNetwork(childEnv *env.Env, f func(*oas e2e.PreserveComputeWorkerRuntimeStorage: true, // default, needed e2e.PreserveKeymanagerLocalStorage: true, // default, needed } - if err = sc.DumpRestoreNetwork(childEnv, fixture, false, g, resetFlags); err != nil { - return err - } - - return nil + return sc.DumpRestoreNetwork(childEnv, fixture, false, g, resetFlags) } func (sc *trustRootChangeImpl) startRestoredStateTestClient(ctx context.Context, childEnv *env.Env, round int64) error { // Check that everything works with restored state. seed := fmt.Sprintf("seed %d", round) sc.Scenario.TestClient = NewTestClient().WithSeed(seed).WithScenario(RemoveKeyValueEncScenario) - if err := sc.Scenario.Run(ctx, childEnv); err != nil { - return err - } - return nil + return sc.Scenario.Run(ctx, childEnv) } diff --git a/go/oasis-test-runner/scenario/e2e/runtime/txsource.go b/go/oasis-test-runner/scenario/e2e/runtime/txsource.go index dc200dfbd11..953a3798f8b 100644 --- a/go/oasis-test-runner/scenario/e2e/runtime/txsource.go +++ b/go/oasis-test-runner/scenario/e2e/runtime/txsource.go @@ -912,9 +912,5 @@ func (sc *txSourceImpl) Run(ctx context.Context, childEnv *env.Env) error { return err } - if err = sc.Net.CheckLogWatchers(); err != nil { - return err - } - - return nil + return sc.Net.CheckLogWatchers() } diff --git a/go/oasis-test-runner/scenario/e2e/stake_cli.go b/go/oasis-test-runner/scenario/e2e/stake_cli.go index f7dd24e6c7e..f43b86d068a 100644 --- a/go/oasis-test-runner/scenario/e2e/stake_cli.go +++ b/go/oasis-test-runner/scenario/e2e/stake_cli.go @@ -629,11 +629,7 @@ func (sc *stakeCLIImpl) testAmendCommissionSchedule(ctx context.Context, childEn if err := sc.checkCommissionScheduleRates(ctx, childEnv, src, rates); err != nil { return err } - if err := sc.checkCommissionScheduleRateBounds(ctx, childEnv, src, bounds); err != nil { - return err - } - - return nil + return sc.checkCommissionScheduleRateBounds(ctx, childEnv, src, bounds) } // testAllowWithdraw tests setting an allowance and withdrawing. @@ -691,13 +687,9 @@ func (sc *stakeCLIImpl) testAllowWithdraw(ctx context.Context, childEnv *env.Env expectedGeneralBalance = mustInitQuantity( transferAmount - feeAmount + withdrawAmount, ) - if err = sc.checkGeneralAccount( + return sc.checkGeneralAccount( ctx, childEnv, beneficiary, &api.GeneralAccount{Balance: expectedGeneralBalance, Nonce: 1}, - ); err != nil { - return err - } - - return nil + ) } func (sc *stakeCLIImpl) getInfo(childEnv *env.Env) error { diff --git a/go/oasis-test-runner/scenario/pluginsigner/basic.go b/go/oasis-test-runner/scenario/pluginsigner/basic.go index 231a61b858b..48ef51e36c6 100644 --- a/go/oasis-test-runner/scenario/pluginsigner/basic.go +++ b/go/oasis-test-runner/scenario/pluginsigner/basic.go @@ -64,9 +64,5 @@ func (sc *basicImpl) Run(_ context.Context, _ *env.Env) error { } // Run basic common signer tests. - if err = signerTests.BasicTests(sf, sc.logger, roles); err != nil { - return err - } - - return nil + return signerTests.BasicTests(sf, sc.logger, roles) } diff --git a/go/p2p/backup/cstore.go b/go/p2p/backup/cstore.go index a67bbd20377..4155d5bad63 100644 --- a/go/p2p/backup/cstore.go +++ b/go/p2p/backup/cstore.go @@ -79,11 +79,7 @@ func (b *commonStoreBackend) Backup(_ context.Context, nsPeers map[string][]peer } // Store addresses. - if err := b.bucket.PutCBOR([]byte(b.key), data); err != nil { - return err - } - - return nil + return b.bucket.PutCBOR([]byte(b.key), data) } // Restore implements PeerBackup. diff --git a/go/runtime/bundle/bundle.go b/go/runtime/bundle/bundle.go index f59346b2e91..f7a259b69de 100644 --- a/go/runtime/bundle/bundle.go +++ b/go/runtime/bundle/bundle.go @@ -90,11 +90,7 @@ func (bnd *Bundle) Validate() error { _ = f.Close() // Make sure the SGX signature is valid if it exists. - if err := bnd.verifySgxSignature(); err != nil { - return err - } - - return nil + return bnd.verifySgxSignature() } // Add adds/overwrites a file to/in the bundle. diff --git a/go/runtime/host/multi/multi.go b/go/runtime/host/multi/multi.go index c7c52f949a3..6c91d7f0eb3 100644 --- a/go/runtime/host/multi/multi.go +++ b/go/runtime/host/multi/multi.go @@ -266,10 +266,7 @@ func (agg *Aggregate) SetVersion(active version.Version, next *version.Version) if err := agg.setActiveVersionLocked(active); err != nil { return err } - if err := agg.setNextVersionLocked(next); err != nil { - return err - } - return nil + return agg.setNextVersionLocked(next) } func (agg *Aggregate) setActiveVersionLocked(version version.Version) error { diff --git a/go/staking/api/api.go b/go/staking/api/api.go index e497d3d00a1..e0058839e54 100644 --- a/go/staking/api/api.go +++ b/go/staking/api/api.go @@ -719,11 +719,7 @@ func (p *SharePool) Withdraw(stakeDst, shareSrc, shareAmount *quantity.Quantity) return err } - if err = quantity.Move(stakeDst, &p.Balance, baseUnits); err != nil { - return err - } - - return nil + return quantity.Move(stakeDst, &p.Balance, baseUnits) } // ThresholdKind is the kind of staking threshold. diff --git a/go/storage/mkvs/checkpoint/checkpoint_test.go b/go/storage/mkvs/checkpoint/checkpoint_test.go index 1c9abace472..d7c2fffca29 100644 --- a/go/storage/mkvs/checkpoint/checkpoint_test.go +++ b/go/storage/mkvs/checkpoint/checkpoint_test.go @@ -173,9 +173,9 @@ func TestFileCheckpointCreator(t *testing.T) { require.True(errors.Is(err, ErrChunkProofVerificationFailed)) // Restorer should be reset. break - } else { - require.NoError(err, "RestoreChunk") } + + require.NoError(err, "RestoreChunk") } // Try to correctly restore. diff --git a/go/storage/mkvs/db/badger/badger.go b/go/storage/mkvs/db/badger/badger.go index 763e24dcaa4..04df00fe988 100644 --- a/go/storage/mkvs/db/badger/badger.go +++ b/go/storage/mkvs/db/badger/badger.go @@ -1142,10 +1142,8 @@ func (s *badgerSubtree) PutNode(_ node.Depth, ptr *node.Pointer) error { } } } - if err = s.batch.bat.Set(nodeKey, data); err != nil { - return err - } - return nil + + return s.batch.bat.Set(nodeKey, data) } func (s *badgerSubtree) VisitCleanNode(node.Depth, *node.Pointer) error { diff --git a/go/storage/mkvs/db/badger/migrate.go b/go/storage/mkvs/db/badger/migrate.go index 70c9fd2c480..a0d6efd05c2 100644 --- a/go/storage/mkvs/db/badger/migrate.go +++ b/go/storage/mkvs/db/badger/migrate.go @@ -1224,11 +1224,7 @@ func (v5 *v5Migrator) pruneVersion(version uint64) error { // Save progress. v5.meta.LastPrunedVersion = &version - if err = v5.flush(false); err != nil { - return err - } - - return nil + return v5.flush(false) } func (v5 *v5Migrator) pruneWriteLog(version uint64, oldRoot typedHash) error { diff --git a/go/storage/mkvs/node/key.go b/go/storage/mkvs/node/key.go index c3471786e77..1038951d8a5 100644 --- a/go/storage/mkvs/node/key.go +++ b/go/storage/mkvs/node/key.go @@ -189,7 +189,7 @@ func (k Key) CommonPrefixLen(keyBitLen Depth, k2 Key, k2bitLen Depth) (bitLength // Compute the common prefix byte-wise. i := Depth(0) - for ; i < Depth(minKeyLen) && k[i] == k2[i]; i++ { + for ; i < Depth(minKeyLen) && k[i] == k2[i]; i++ { //nolint:revive } // Prefixes match i bytes and maybe some more bits below. diff --git a/go/storage/mkvs/syncer/merge.go b/go/storage/mkvs/syncer/merge.go index f0595d04dfd..cd8d31ec68e 100644 --- a/go/storage/mkvs/syncer/merge.go +++ b/go/storage/mkvs/syncer/merge.go @@ -46,10 +46,7 @@ func (m *SubtreeMerger) MergeVerifiedSubtree( // If destination node is nil, we can simply replace the whole subtree. if dst.Node == nil { dst.Node = subtree.Node - if err := committer(dst); err != nil { - return err - } - return nil + return committer(dst) } switch n := dst.Node.(type) { diff --git a/go/storage/mkvs/tree_test.go b/go/storage/mkvs/tree_test.go index a3b7cbcd2af..05fed5a0078 100644 --- a/go/storage/mkvs/tree_test.go +++ b/go/storage/mkvs/tree_test.go @@ -1724,7 +1724,7 @@ func testPruneLoneRootsShared2(t *testing.T, ndb db.NodeDB, _ NodeDBFactory) { it := tree.NewIterator(ctx) defer it.Close() - for it.Rewind(); it.Valid(); it.Next() { + for it.Rewind(); it.Valid(); it.Next() { //nolint:revive // Just iterate over the whole tree. If the tree is not consistent // this iteration will throw an error that a node is missing. } diff --git a/go/worker/compute/executor/committee/node.go b/go/worker/compute/executor/committee/node.go index 46a9be0a96a..0ad9879d849 100644 --- a/go/worker/compute/executor/committee/node.go +++ b/go/worker/compute/executor/committee/node.go @@ -1260,9 +1260,9 @@ func (n *Node) handleProposalLocked(batch *unresolvedBatch) error { // TODO: Handle proposal equivocation. - if _, ok := n.state.(StateWaitingForBatch); !ok { + if _, ok := n.state.(StateWaitingForBatch); !ok { //nolint:revive // Currently not waiting for batch. - } else if epoch := n.commonNode.Group.GetEpochSnapshot(); !epoch.IsExecutorMember() { + } else if epoch := n.commonNode.Group.GetEpochSnapshot(); !epoch.IsExecutorMember() { //nolint:revive // Currently not an executor committee member. } else { // Maybe process if we have the correct block. From 02bdbd7fc0947d31484b0bc967ee94c8902ab439 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Fri, 25 Aug 2023 00:38:51 +0200 Subject: [PATCH 09/11] go-lint: Ignore deprecated function elliptic.Unmarshal --- go/common/sgx/pcs/quote.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/common/sgx/pcs/quote.go b/go/common/sgx/pcs/quote.go index e69091271b2..1185de6d85a 100644 --- a/go/common/sgx/pcs/quote.go +++ b/go/common/sgx/pcs/quote.go @@ -489,7 +489,7 @@ func (qs *QuoteSignatureECDSA_P256) Verify( // Verify quote header and ISV report body signature. attPkWithTag := append([]byte{0x04}, qs.AttestationPublicKey[:]...) // Add SEC 1 tag (uncompressed). - x, y := elliptic.Unmarshal(elliptic.P256(), attPkWithTag) + x, y := elliptic.Unmarshal(elliptic.P256(), attPkWithTag) //nolint:staticcheck if x == nil { return fmt.Errorf("pcs/quote: invalid attestation public key") } From 2a45502445fc4c3ec0687c9a76c779f601362c97 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Fri, 25 Aug 2023 14:25:35 +0200 Subject: [PATCH 10/11] tests/upgrade/pre: Upgrade to the latest stable/22.2.x --- tests/upgrade/pre/go.mod | 47 ++++++++++----------- tests/upgrade/pre/go.sum | 90 ++++++++++++++++++++-------------------- 2 files changed, 67 insertions(+), 70 deletions(-) diff --git a/tests/upgrade/pre/go.mod b/tests/upgrade/pre/go.mod index 3cd6f13abe4..c6d01c73fa6 100644 --- a/tests/upgrade/pre/go.mod +++ b/tests/upgrade/pre/go.mod @@ -15,19 +15,16 @@ replace ( github.com/tendermint/tendermint => github.com/oasisprotocol/tendermint v0.34.21-oasis1 - // Required because of https://github.com/libp2p/go-libp2p-pubsub/issues/467. - github.com/whyrusleeping/timecache => github.com/oasisprotocol/timecache v0.0.0-20220102191729-558b1c931038 - golang.org/x/crypto/curve25519 => github.com/oasisprotocol/curve25519-voi/primitives/x25519 v0.0.0-20210505121811-294cf0fbfb43 golang.org/x/crypto/ed25519 => github.com/oasisprotocol/curve25519-voi/primitives/ed25519 v0.0.0-20210505121811-294cf0fbfb43 ) require ( github.com/hashicorp/go-multierror v1.1.1 - github.com/oasisprotocol/oasis-core/go v0.2202.10-0.20230714074355-207dcba037bb + github.com/oasisprotocol/oasis-core/go v0.2202.12-0.20230814124622-de57b1395983 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.15.0 - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 + golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 ) require ( @@ -77,7 +74,7 @@ require ( github.com/google/flatbuffers v1.12.1 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect + github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/gtank/merlin v0.1.1 // indirect @@ -98,27 +95,27 @@ require ( github.com/jbenet/goprocess v0.1.4 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.16.5 // indirect + github.com/klauspost/compress v1.16.7 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/koron/go-ssdp v0.0.4 // indirect github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.28.1 // indirect + github.com/libp2p/go-libp2p v0.29.2 // indirect github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect github.com/libp2p/go-libp2p-pubsub v0.9.3 // indirect github.com/libp2p/go-msgio v0.3.0 // indirect github.com/libp2p/go-nat v0.2.0 // indirect github.com/libp2p/go-netroute v0.2.1 // indirect github.com/libp2p/go-reuseport v0.3.0 // indirect - github.com/libp2p/go-yamux/v4 v4.0.0 // indirect + github.com/libp2p/go-yamux/v4 v4.0.1 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/miekg/dns v1.1.54 // indirect + github.com/miekg/dns v1.1.55 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect @@ -131,18 +128,18 @@ require ( github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.9.0 // indirect + github.com/multiformats/go-multiaddr v0.10.1 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect - github.com/multiformats/go-multihash v0.2.2 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-multistream v0.4.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230110094441-db37f07504ce // indirect github.com/oasisprotocol/safeopen v0.0.0-20200528085122-e01cfdfc7661 // indirect github.com/oklog/run v1.0.0 // indirect - github.com/onsi/ginkgo/v2 v2.9.7 // indirect + github.com/onsi/ginkgo/v2 v2.11.0 // indirect github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect @@ -154,9 +151,9 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-19 v0.3.2 // indirect - github.com/quic-go/qtls-go1-20 v0.2.2 // indirect - github.com/quic-go/quic-go v0.33.0 // indirect + github.com/quic-go/qtls-go1-19 v0.3.3 // indirect + github.com/quic-go/qtls-go1-20 v0.2.3 // indirect + github.com/quic-go/quic-go v0.36.4 // indirect github.com/quic-go/webtransport-go v0.5.3 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect @@ -168,7 +165,7 @@ require ( github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/stretchr/testify v1.8.2 // indirect + github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect @@ -179,16 +176,16 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.0 // indirect - go.uber.org/fx v1.19.2 // indirect + go.uber.org/fx v1.20.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.7.0 // indirect - golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - golang.org/x/tools v0.9.1 // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.13.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect + golang.org/x/tools v0.11.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.53.0 // indirect google.golang.org/grpc/security/advancedtls v0.0.0-20221004221323-12db695f1648 // indirect diff --git a/tests/upgrade/pre/go.sum b/tests/upgrade/pre/go.sum index c58e75191ec..d4a54d5fa15 100644 --- a/tests/upgrade/pre/go.sum +++ b/tests/upgrade/pre/go.sum @@ -288,8 +288,8 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 h1:hR7/MlvK23p6+lIw9SN1TigNLn9ZnF3W4SYRKq2gAHs= -github.com/google/pprof v0.0.0-20230602150820-91b7bce49751/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= +github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 h1:n6vlPhxsA+BW/XsS5+uqi7GyzaLa5MH7qlSLBZtRdiA= +github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8/go.mod h1:Jh3hGz2jkYak8qXPD19ryItVnUgpgeqzdkY/D0EaeuA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -368,8 +368,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= -github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= @@ -392,8 +392,8 @@ github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38y github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.28.1 h1:YurK+ZAI6cKfASLJBVFkpVBdl3wGhFi6fusOt725ii8= -github.com/libp2p/go-libp2p v0.28.1/go.mod h1:s3Xabc9LSwOcnv9UD4nORnXKTsWkPMkIMB/JIGXVnzk= +github.com/libp2p/go-libp2p v0.29.2 h1:uPw/c8hOxoLP/KhFnzlc5Ejqf+OmAL1dwIsqE31WBtY= +github.com/libp2p/go-libp2p v0.29.2/go.mod h1:OU7nSq0aEZMsV2wY8nXn1+XNNt9q2UiR8LjW3Kmp2UE= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-pubsub v0.9.3 h1:ihcz9oIBMaCK9kcx+yHWm3mLAFBMAUsM4ux42aikDxo= @@ -407,8 +407,8 @@ github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9t github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= github.com/libp2p/go-reuseport v0.3.0 h1:iiZslO5byUYZEg9iCwJGf5h+sf1Agmqx2V2FDjPyvUw= github.com/libp2p/go-reuseport v0.3.0/go.mod h1:laea40AimhtfEqysZ71UpYj4S+R9VpH8PgqLo7L+SwI= -github.com/libp2p/go-yamux/v4 v4.0.0 h1:+Y80dV2Yx/kv7Y7JKu0LECyVdMXm1VUoko+VQ9rBfZQ= -github.com/libp2p/go-yamux/v4 v4.0.0/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= +github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= +github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -430,8 +430,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/miekg/dns v1.1.54 h1:5jon9mWcb0sFJGpnI99tOMhCPyJ+RPVz5b63MQG0VWI= -github.com/miekg/dns v1.1.54/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= +github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo= +github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= @@ -468,8 +468,8 @@ github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9 github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= -github.com/multiformats/go-multiaddr v0.9.0 h1:3h4V1LHIk5w4hJHekMKWALPXErDfz/sggzwC/NcqbDQ= -github.com/multiformats/go-multiaddr v0.9.0/go.mod h1:mI67Lb1EeTOYb8GQfL/7wpIZwc46ElrvzhYnoJOmTT0= +github.com/multiformats/go-multiaddr v0.10.1 h1:HghtFrWyZEPrpTvgAMFJi6gFdgHfs2cb0pyfDsk+lqU= +github.com/multiformats/go-multiaddr v0.10.1/go.mod h1:jLEZsA61rwWNZQTHHnqq2HNa+4os/Hz54eqiRnsRqYQ= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -479,8 +479,8 @@ github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6o github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.2.2 h1:Uu7LWs/PmWby1gkj1S1DXx3zyd3aVabA4FiMKn/2tAc= -github.com/multiformats/go-multihash v0.2.2/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= @@ -495,8 +495,8 @@ github.com/oasisprotocol/cast v0.0.0-20220606122631-eba453e69641 h1:8vZBx878kg60 github.com/oasisprotocol/cast v0.0.0-20220606122631-eba453e69641/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/oasisprotocol/curve25519-voi v0.0.0-20230110094441-db37f07504ce h1:/pEpMk55wH0X+E5zedGEMOdLuWmV8P4+4W3+LZaM6kg= github.com/oasisprotocol/curve25519-voi v0.0.0-20230110094441-db37f07504ce/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= -github.com/oasisprotocol/oasis-core/go v0.2202.10-0.20230714074355-207dcba037bb h1:ZofjuPbWxRpEvZek8uJnMvJ5+me6lwNYEgzE9hG6als= -github.com/oasisprotocol/oasis-core/go v0.2202.10-0.20230714074355-207dcba037bb/go.mod h1:GqDdcN8IusIShM8K6DGHPHNaJoAMwqqifTNkWr4tRgM= +github.com/oasisprotocol/oasis-core/go v0.2202.12-0.20230814124622-de57b1395983 h1:t6wt/ftsgAvRl1qvwjlrTjvJ0BomBszRlphr+JyBJx8= +github.com/oasisprotocol/oasis-core/go v0.2202.12-0.20230814124622-de57b1395983/go.mod h1:kjlpQ7TWOeYXlolEcO+B20XQpCfnXsKlRha0qsKo6XI= github.com/oasisprotocol/safeopen v0.0.0-20200528085122-e01cfdfc7661 h1:MB73kGMtuMGS+6VDoU/mitzff7Cu+aZo9ta5wabuxVA= github.com/oasisprotocol/safeopen v0.0.0-20200528085122-e01cfdfc7661/go.mod h1:SwBxaVibf6Sr2IZ6M3WnUue0yp8dPLAo1riQRNQ60+g= github.com/oasisprotocol/tendermint v0.34.21-oasis1 h1:k1R9AAeYRh2uQqI/D6cTIE8DZ0eWjR4upLJhWh3QtSs= @@ -508,12 +508,12 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss= -github.com/onsi/ginkgo/v2 v2.9.7/go.mod h1:cxrmXWykAwTwhQsJOPfdIDiJ+l2RYq7U8hFU+M/1uw0= +github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= +github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= +github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= @@ -551,12 +551,12 @@ github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5 github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/qtls-go1-19 v0.3.2 h1:tFxjCFcTQzK+oMxG6Zcvp4Dq8dx4yD3dDiIiyc86Z5U= -github.com/quic-go/qtls-go1-19 v0.3.2/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI= -github.com/quic-go/qtls-go1-20 v0.2.2 h1:WLOPx6OY/hxtTxKV1Zrq20FtXtDEkeY00CGQm8GEa3E= -github.com/quic-go/qtls-go1-20 v0.2.2/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM= -github.com/quic-go/quic-go v0.33.0 h1:ItNoTDN/Fm/zBlq769lLJc8ECe9gYaW40veHCCco7y0= -github.com/quic-go/quic-go v0.33.0/go.mod h1:YMuhaAV9/jIu0XclDXwZPAsP/2Kgr5yMYhe9oxhhOFA= +github.com/quic-go/qtls-go1-19 v0.3.3 h1:wznEHvJwd+2X3PqftRha0SUKmGsnb6dfArMhy9PeJVE= +github.com/quic-go/qtls-go1-19 v0.3.3/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI= +github.com/quic-go/qtls-go1-20 v0.2.3 h1:m575dovXn1y2ATOb1XrRFcrv0F+EQmlowTkoraNkDPI= +github.com/quic-go/qtls-go1-20 v0.2.3/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM= +github.com/quic-go/quic-go v0.36.4 h1:CXn/ZLN5Vntlk53fjR+kUMC8Jt7flfQe+I5Ty5A+k0o= +github.com/quic-go/quic-go v0.36.4/go.mod h1:qxQumdeKw5GmWs1OsTZZnOxzSI+RJWuhf1O8FN35L2o= github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= @@ -636,8 +636,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +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/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= @@ -679,8 +679,8 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= -go.uber.org/fx v1.19.2 h1:SyFgYQFr1Wl0AYstE8vyYIzP4bFz2URrScjwC4cwUvY= -go.uber.org/fx v1.19.2/go.mod h1:43G1VcqSzbIv77y00p1DRAsyZS8WdzuYdhZXmEUkMyQ= +go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= +go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -706,8 +706,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= 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= @@ -718,8 +718,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw= +golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -745,8 +745,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -787,8 +787,8 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= +golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -813,8 +813,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-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.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -877,8 +877,8 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/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/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -886,8 +886,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -948,8 +948,8 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= +golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= 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= From 3ce917b3c1c977b034639c4bdd43e5dd7eeeb7b4 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Fri, 25 Aug 2023 11:37:37 +0200 Subject: [PATCH 11/11] go: Install and use legacy packages for upgrade tests --- .buildkite/go/build.sh | 2 +- .buildkite/go/lint.sh | 8 +++++--- .buildkite/scripts/test_upgrade.sh | 5 ----- common.mk | 6 ++++++ docker/oasis-core-dev/Dockerfile | 7 +++++++ go/Makefile | 2 +- tests/upgrade/post/Makefile | 2 +- tests/upgrade/pre/Makefile | 2 +- 8 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.buildkite/go/build.sh b/.buildkite/go/build.sh index 145b12a6431..2f22cf22f05 100755 --- a/.buildkite/go/build.sh +++ b/.buildkite/go/build.sh @@ -30,5 +30,5 @@ pushd go popd pushd tests/upgrade - make all + OASIS_GO=go1.20.2 make all popd diff --git a/.buildkite/go/lint.sh b/.buildkite/go/lint.sh index 06321208b24..ab34e00d5dc 100755 --- a/.buildkite/go/lint.sh +++ b/.buildkite/go/lint.sh @@ -18,6 +18,8 @@ pushd go make lint popd -pushd tests/upgrade - make lint -popd +# Lint doesn't work. +# See: https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions +#pushd tests/upgrade +# make lint +#popd diff --git a/.buildkite/scripts/test_upgrade.sh b/.buildkite/scripts/test_upgrade.sh index caa616b8fe2..956b9a2079d 100755 --- a/.buildkite/scripts/test_upgrade.sh +++ b/.buildkite/scripts/test_upgrade.sh @@ -11,11 +11,6 @@ # https://buildkite.com/docs/pipelines/writing-build-scripts set -euxo pipefail -# Install Go version needed to build the stable branch. -# See: https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions -go install golang.org/dl/go1.19.10@latest -go1.19.10 download - # Branches to test. pre_upgrade_git_branch="stable/22.2.x" post_upgrade_git_branch="master" diff --git a/common.mk b/common.mk index 3bdfaee2e92..9697ac503fb 100644 --- a/common.mk +++ b/common.mk @@ -124,6 +124,12 @@ define ENSURE_GIT_VERSION_EQUALS_PUNCH_VERSION = fi endef +# Golangci-lint binary to use for all Golangci-lint commands. +export OASIS_GOLANGCI_LINT ?= golangci-lint + +# Golangci-lint command prefix to use in all Golangci-lint commands. +GOLANGCI_LINT := env -u GOPATH $(OASIS_GOLANGCI_LINT) + # Go binary to use for all Go commands. export OASIS_GO ?= go diff --git a/docker/oasis-core-dev/Dockerfile b/docker/oasis-core-dev/Dockerfile index 89d0ecd1281..1cea4b1cb5a 100644 --- a/docker/oasis-core-dev/Dockerfile +++ b/docker/oasis-core-dev/Dockerfile @@ -14,6 +14,9 @@ ARG RUST_NIGHTLY_VERSION=2023-01-16 ARG JEMALLOC_VERSION=5.2.1 ARG JEMALLOC_CHECKSUM=34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6 +# Legacy package versions (upgrade tests). +ARG LEGACY_GO_VERSION=1.20.2 + ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -qq && apt-get upgrade -qq && apt-get install -qq \ @@ -57,6 +60,10 @@ RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \ RUN wget https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \ tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz && \ rm go${GO_VERSION}.linux-amd64.tar.gz && \ + # Install legacy Go version. + go install golang.org/dl/go${LEGACY_GO_VERSION}@latest && \ + go${LEGACY_GO_VERSION} download && \ + # Prepare folder for binaries. mkdir -p /go/bin && \ # Install a specific version of protoc-gen-go. go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GO_PROTOC_GEN_GO_VERSION} && \ diff --git a/go/Makefile b/go/Makefile index 133fdacf7a0..eaa1c2daacf 100644 --- a/go/Makefile +++ b/go/Makefile @@ -69,7 +69,7 @@ fmt: # Lint. lint: @$(ECHO) "$(CYAN)*** Running Go linters...$(OFF)" - @env -u GOPATH golangci-lint run --timeout 4m + @$(GOLANGCI_LINT) run --timeout 4m lint-mod-tidy: @$(ECHO) "$(CYAN)*** Checking go mod tidy...$(OFF)" diff --git a/tests/upgrade/post/Makefile b/tests/upgrade/post/Makefile index 6b49ec2af68..817b1aed1b3 100644 --- a/tests/upgrade/post/Makefile +++ b/tests/upgrade/post/Makefile @@ -27,7 +27,7 @@ fmt: # Lint. lint: @$(ECHO) "$(CYAN)*** Running Go linters...$(OFF)" - @env -u GOPATH golangci-lint run --timeout 4m + @$(GOLANGCI_LINT) run --timeout 4m lint-mod-tidy: @$(ECHO) "$(CYAN)*** Checking go mod tidy...$(OFF)" diff --git a/tests/upgrade/pre/Makefile b/tests/upgrade/pre/Makefile index dbecc44f183..d45920d4727 100644 --- a/tests/upgrade/pre/Makefile +++ b/tests/upgrade/pre/Makefile @@ -27,7 +27,7 @@ fmt: # Lint. lint: @$(ECHO) "$(CYAN)*** Running Go linters...$(OFF)" - @env -u GOPATH golangci-lint run --timeout 4m + @$(GOLANGCI_LINT) run --timeout 4m lint-mod-tidy: @$(ECHO) "$(CYAN)*** Checking go mod tidy...$(OFF)"