diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..191381e --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git \ No newline at end of file diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..03a3513 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,28 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + docker-build: + name: Run docker build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - id: vars + name: Output SHA and version tag + run: | + echo "sha=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT + echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: Build and tag image + run: | + docker build . \ + -t cerc-io/eth-statediff-service \ + -t git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} \ + -t git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.tag}} + - name: Push image tags + run: | + echo ${{ secrets.GITEA_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin + docker push git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} + docker push git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.tag}} diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml new file mode 100644 index 0000000..8f1f1e9 --- /dev/null +++ b/.gitea/workflows/tests.yml @@ -0,0 +1,133 @@ +name: Tests + +on: + pull_request: + branches: '*' + push: + branches: + - main + - ci-test + workflow_call: + +# Needed until we can incorporate docker startup into the executor container +env: + DOCKER_HOST: unix:///var/run/dind.sock + +jobs: + integration-tests: + name: Run integration tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version-file: go.mod + check-latest: true + - name: Run dockerd + run: | + dockerd -H $DOCKER_HOST --userland-proxy=false & + sleep 5 + - name: Run DB container + run: docker compose -f test/compose.yml up --wait + - name: Configure Gitea access + env: + TOKEN: ${{ secrets.CICD_REPO_TOKEN }} + run: | + git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/" + + - name: Build package + run: go build . + - name: Install test fixtures + uses: actions/checkout@v3 + with: + repository: cerc-io/eth-testing + path: ./fixtures + ref: v0.3.1 + # Run a sanity test against the fixture data + # Complete integration tests are TODO + - name: Run basic integration test + env: + DATABASE_TYPE: postgres + LEVELDB_PATH: ./fixtures/chaindata/_data/small + LEVELDB_ANCIENT: ./fixtures/chaindata/_data/small/ancient + LOG_FILE: ./server-log + ETH_GENESIS_BLOCK: "0x37cbb63c7150a7b60f2878433963ed8ba7e5f82fb2683ec7a945c974e1cf4e05" + timeout-minutes: 30 + run: | + ./eth-statediff-service --config ./test/ci-config.toml serve & + sleep 10 + + ./scripts/request-range.sh 0 32 || (E=$?; cat $LOG_FILE; exit $E) + + until grep "Finished processing block 32" $LOG_FILE + do sleep 1; done + + count_results() { + query="select count(*) from $1;" + docker exec -e PGPASSWORD=password test-ipld-eth-db-1 \ + psql -tA cerc_testing -U vdbm -c "$query" + } + set -x + [[ "$(count_results eth.header_cids)" = 33 ]] + [[ "$(count_results eth.state_cids)" = 21 ]] + [[ "$(count_results eth.storage_cids)" = 18 ]] + + compliance-test: + name: Run compliance tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + path: ./eth-statediff-service + - uses: actions/setup-go@v3 + with: + go-version-file: ./eth-statediff-service/go.mod + check-latest: true + - name: Install test fixtures + uses: actions/checkout@v3 + with: + repository: cerc-io/eth-testing + path: ./fixtures + ref: v0.3.1 + - name: Configure Gitea access + env: + TOKEN: ${{ secrets.CICD_REPO_TOKEN }} + run: | + git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/ + - name: Build current version + working-directory: ./eth-statediff-service + run: go build -o ../service-current . + + - name: Checkout canonical version + uses: actions/checkout@v3 + with: + path: ./eth-statediff-service-canonical + ref: ${{ env.CANONICAL_VERSION }} + - name: Build canonical version + working-directory: ./eth-statediff-service-canonical + run: go build -o ../service-canonical . + + - name: Run dockerd + run: | + dockerd -H $DOCKER_HOST --userland-proxy=false & + sleep 5 + - name: Run DB container + working-directory: ./eth-statediff-service + run: docker compose -f test/compose.yml up --wait + - name: Compare statediff output + timeout-minutes: 10 + env: + LEVELDB_PATH: ./fixtures/chaindata/_data/small2 + LEVELDB_ANCIENT: ./fixtures/chaindata/_data/small2/ancient + ETH_GENESIS_BLOCK: "0x8a3c7cddacbd1ab4ec1b03805fa2a287f3a75e43d87f4f987fcc399f5c042614" + ETH_CHAIN_CONFIG: ./eth-statediff-service/test/ci-chain.json + run: | + until + ready_query='select max(version_id) from goose_db_version;' + version=$(docker exec -e PGPASSWORD=password test-ipld-eth-db-1 \ + psql -tA cerc_testing -U vdbm -c "$ready_query") + [[ "$version" -ge 18 ]] + do sleep 1; done + + ./eth-statediff-service/scripts/compare-statediffs.sh \ + ./service-canonical ./service-current diff --git a/.github/workflows/manual_publish.yml b/.github/workflows/manual_publish.yml deleted file mode 100644 index 8af4947..0000000 --- a/.github/workflows/manual_publish.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: MANUAL Override Publish from release SHA to TAG -on: - workflow_dispatch: - inputs: - giteaPublishTag: - description: 'Release TAG to publish TO on gitea; e.g. v4.1.5-alpha' - required: true - cercContainerTag: - description: 'Container (truncated!!! SHA) to release-tag FROM' - required: true - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - name: Pull SHA and add release-tag - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Get the version - id: vars - run: | - echo ::set-output name=sha::$(echo ${cercContainerTag:0:7}) - - name: Pull docker image by SHA - run: docker pull git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{github.event.inputs.cercContainerTag}} - - name: Tag docker image TAG - run: docker tag git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{github.event.inputs.cercContainerTag}} git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{github.event.inputs.giteaPublishTag}} - - name: Tag docker image TAG - run: docker tag git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{github.event.inputs.cercContainerTag}} git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:latest - - name: Docker Login - run: echo ${{ secrets.GITEA_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin - - name: Docker Push Release Tag - run: docker push git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{github.event.inputs.giteaPublishTag}} - - name: Docker Push LATEST Tag - run: docker push git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:latest diff --git a/.github/workflows/on-publish-pr.yml b/.github/workflows/on-publish-pr.yml deleted file mode 100644 index f6ffaa4..0000000 --- a/.github/workflows/on-publish-pr.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Publish Docker image -on: - release: - types: [published] - pull_request: -jobs: - pre_job: - # continue-on-error: true # Uncomment once integration is finished - runs-on: ubuntu-latest - # Map a step output to a job output - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v4 - with: - # All of these options are optional, so you can remove them if you are happy with the defaults - concurrent_skipping: "never" - skip_after_successful_duplicate: "true" - do_not_skip: '["workflow_dispatch", "schedule"]' - run-tests: - if: ${{ needs.pre_job.outputs.should_skip != 'true' }} - needs: pre_job - uses: ./.github/workflows/tests.yml - build: - name: Run docker build - runs-on: ubuntu-latest - if: | - always() && - (needs.run-tests.result == 'success' || needs.run-tests.result == 'skipped') && - github.event_name == 'release' - needs: run-tests - steps: - - uses: actions/checkout@v2 - - name: Get the version - id: vars - run: | - echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) - echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) - - name: Run docker build - run: make docker-build - - name: Tag docker image - run: docker tag cerc-io/eth-statediff-service git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} - - name: Tag docker image TAG - run: docker tag git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.tag}} - - name: Docker Login - run: echo ${{ secrets.GITEA_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin - - name: Docker Push - run: docker push git.vdb.to/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} -# push_to_registries: -# name: Push Docker image to Docker Hub -# runs-on: ubuntu-latest -# if: | -# always() && -# (needs.build.result == 'success') && -# github.event_name == 'release' -# needs: build -# steps: -# - name: Get the version -# id: vars -# run: | -# echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) -# echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) -# - name: Docker Login to Github Registry -# run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin -# - name: Docker Pull -# run: docker pull docker.pkg.github.com/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} -# - name: Docker Login to Docker Registry -# run: echo ${{ secrets.VULCANIZEJENKINS_PAT }} | docker login -u vulcanizejenkins --password-stdin -# - name: Tag docker image -# run: docker tag docker.pkg.github.com/cerc-io/eth-statediff-service/eth-statediff-service:${{steps.vars.outputs.sha}} cerc-io/eth-statediff-service:${{steps.vars.outputs.tag}} -# - name: Docker Push to Docker Hub -# run: docker push cerc-io/eth-statediff-service:${{steps.vars.outputs.tag}} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 17ed729..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Tests for Geth that are used in multiple jobs. - -on: - workflow_call: - -env: - GOPATH: /tmp/go - -jobs: - build: - name: Run docker build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Run docker build - run: make docker-build - - statediff-unit-test: - name: Run statediff unit tests - runs-on: ubuntu-latest - env: - GO111MODULE: on - steps: - - name: Create GOPATH - run: mkdir -p /tmp/go - - - uses: actions/setup-go@v3 - with: - go-version: ">=1.18.0" - check-latest: true - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Run unit tests - run: | - make test diff --git a/Dockerfile b/Dockerfile index 0dad3ac..fdf7b58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,36 @@ FROM golang:1.19-alpine as builder -RUN apk --update --no-cache add make git g++ linux-headers +RUN apk add --no-cache git gcc musl-dev binutils-gold # DEBUG RUN apk add busybox-extras -# Get and build ipfs-blockchain-watcher -ADD . /go/src/github.com/cerc-io/eth-statediff-service -#RUN git clone https://github.com/cerc-io/eth-statediff-service.git /go/src/github.com/vulcanize/eth-statediff-service +WORKDIR /eth-statediff-service -WORKDIR /go/src/github.com/cerc-io/eth-statediff-service -RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o eth-statediff-service . +ARG GIT_VDBTO_TOKEN + +COPY go.mod go.sum ./ +RUN if [ -n "$GIT_VDBTO_TOKEN" ]; then git config --global url."https://$GIT_VDBTO_TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/"; fi && \ + go mod download && \ + rm -f ~/.gitconfig +COPY . . + +RUN go build -ldflags '-extldflags "-static"' -o eth-statediff-service . -# app container FROM alpine -ARG CONFIG_FILE="./environments/config.toml" +ARG USER="vdbm" ARG EXPOSE_PORT=8545 +ARG CONFIG_FILE="./environments/docker.toml" RUN apk --no-cache add su-exec bash WORKDIR /app -# chown first so dir is writable -# note: using $USER is merged, but not in the stable release yet -COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/$CONFIG_FILE config.toml -COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/startup_script.sh . -COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/environments environments +COPY --from=builder /eth-statediff-service/$CONFIG_FILE config.toml +COPY --from=builder /eth-statediff-service/startup_script.sh . # keep binaries immutable -COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/eth-statediff-service eth-statediff-service +COPY --from=builder /eth-statediff-service/eth-statediff-service eth-statediff-service EXPOSE $EXPOSE_PORT diff --git a/Makefile b/Makefile deleted file mode 100644 index 48bd006..0000000 --- a/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -## Build docker image -.PHONY: docker-build -docker-build: - docker build -t cerc-io/eth-statediff-service . - -.PHONY: test -test: - go test -p 1 ./pkg/... -v - -build: - go fmt ./... - go build diff --git a/README.md b/README.md index 58d1592..a24e9f8 100644 --- a/README.md +++ b/README.md @@ -1,130 +1,26 @@ # eth-statediff-service -[![Go Report Card](https://goreportcard.com/badge/github.com/vulcanize/eth-statediff-service)](https://goreportcard.com/report/github.com/vulcanize/eth-statediff-service) +[![Go Report Card](https://goreportcard.com/badge/github.com/cerc-io/eth-statediff-service)](https://goreportcard.com/report/github.com/cerc-io/eth-statediff-service) ->> standalone statediffing service on top of LevelDB - -Purpose: - -Stand up a statediffing service directly on top of a go-ethereum LevelDB instance. +A standalone statediffing service which runs directly on top of a `go-ethereum` LevelDB instance. This service can serve historical state data over the same rpc interface as [statediffing geth](https://github.com/cerc-io/go-ethereum) without needing to run a full node. ## Setup -Build the binary: +Configure access to the private Git server at `git.vdb.to`, then build the executable: ```bash -make build +go build . ``` ## Configuration -An example config file: +See [./environments/example.toml](./environments/example.toml) for an annotated example config file. -```toml -[leveldb] - # LevelDB access mode - mode = "local" # LVLDB_MODE - - # in local mode - # LevelDB paths - path = "/Users/user/Library/Ethereum/geth/chaindata" # LVLDB_PATH - ancient = "/Users/user/Library/Ethereum/geth/chaindata/ancient" # LVLDB_ANCIENT - - # in remote mode - # URL for leveldb-ethdb-rpc endpoint - url = "http://127.0.0.1:8082/" # LVLDB_URL - -[server] - ipcPath = ".ipc" # SERVICE_IPC_PATH - httpPath = "127.0.0.1:8545" # SERVICE_HTTP_PATH - -[statediff] - prerun = true # STATEDIFF_PRERUN - serviceWorkers = 1 # STATEDIFF_SERVICE_WORKERS - workerQueueSize = 1024 # STATEDIFF_WORKER_QUEUE_SIZE - trieWorkers = 4 # STATEDIFF_TRIE_WORKERS - -[prerun] - only = false # PRERUN_ONLY - parallel = true # PRERUN_PARALLEL - - # to perform prerun in a specific range (optional) - start = 0 # PRERUN_RANGE_START - stop = 100 # PRERUN_RANGE_STOP - - # to perform prerun over multiple ranges (optional) - ranges = [ - [101, 1000] - ] - - # statediffing params for prerun - [prerun.params] - includeBlock = true # PRERUN_INCLUDE_BLOCK - includeReceipts = true # PRERUN_INCLUDE_RECEIPTS - includeTD = true # PRERUN_INCLUDE_TD - includeCode = true # PRERUN_INCLUDE_CODE - watchedAddresses = [] - -[log] - file = "" # LOG_FILE_PATH - level = "info" # LOG_LEVEL - -[database] - # output type - type = "postgres" - - # with postgres type - # db credentials - name = "vulcanize_test" # DATABASE_NAME - hostname = "localhost" # DATABASE_HOSTNAME - port = 5432 # DATABASE_PORT - user = "vulcanize" # DATABASE_USER - password = "..." # DATABASE_PASSWORD - driver = "sqlx" # DATABASE_DRIVER_TYPE - - # with file type - # file mode - fileMode = "csv" # DATABASE_FILE_MODE - - # with SQL file mode - filePath = "" # DATABASE_FILE_PATH - - # with CSV file mode - fileCsvDir = "output_dir" # DATABASE_FILE_CSV_DIR - - # with dump type - # - dumpDestination = "" # DATABASE_DUMP_DST - -[cache] - database = 1024 # DB_CACHE_SIZE_MB - trie = 1024 # TRIE_CACHE_SIZE_MB - -[prom] - # prometheus metrics - metrics = true # PROM_METRICS - http = true # PROM_HTTP - httpAddr = "localhost" # PROM_HTTP_ADDR - httpPort = "8889" # PROM_HTTP_PORT - dbStats = true # PROM_DB_STATS - -[ethereum] - # node info - nodeID = "" # ETH_NODE_ID - clientName = "eth-statediff-service" # ETH_CLIENT_NAME - networkID = 1 # ETH_NETWORK_ID - chainID = 1 # ETH_CHAIN_ID - genesisBlock = "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" # ETH_GENESIS_BLOCK - - # path to custom chain config file (optional) - # keep chainID same as that in chain config file - chainConfig = "./chain.json" # ETH_CHAIN_CONFIG - -[debug] - pprof = false # DEBUG_PPROF -``` +> **Note:** previous versions of this service used different variable names. To update, change the following: +> * `LVLDB_MODE`, `LVLDB_PATH`, `LVLDB_ANCIENT`, `LVLDB_URL` => `LEVELDB_*` +> * `LOG_FILE_PATH` => `LOG_FILE` ### Local Setup @@ -180,14 +76,27 @@ An example config file: Example: ```bash - curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"statediff_writeStateDiffsInRange","params":['"$BEGIN"', '"$END"', {"intermediateStateNodes":true,"intermediateStorageNodes":true,"includeBlock":true,"includeReceipts":true,"includeTD":true,"includeCode":true}],"id":1}' "$HOST":"$PORT" + curl -X POST -H 'Content-Type: application/json' --data '{ + "jsonrpc": "2.0", + "method": "statediff_writeStateDiffsInRange", + "params": [0, 1, { + "ncludeBlock": true, + "includeReceipts": true, + "includeTD": true, + "includeCode": true + } + ], + "id": 1 + }' "$HOST":"$PORT" ``` * Prerun: - * The process can be configured locally with sets of ranges to process as a "prerun" to processing directed by the server endpoints. - * This is done by turning "prerun" on in the config (`statediff.prerun = true`) and defining ranges and params in the -`prerun` section of the config. - * Set the range using `prerun.start` and `prerun.stop`. Use `prerun.ranges` if prerun on more than one range is required. + * The process can be configured locally with sets of ranges to process as a "prerun" to + processing directed by the server endpoints. + * This is done by turning "prerun" on in the config (`statediff.prerun = true`) and defining +ranges and params in the `prerun` section of the config. + * Set the range using `prerun.start` and `prerun.stop`. Use `prerun.ranges` if prerun on more + than one range is required. * NOTE: Currently, `params.includeTD` must be set to / passed as `true`. @@ -216,7 +125,8 @@ An example config file: ## Import output data in file mode into a database -* When `eth-statediff-service` is run in file mode (`database.type`) the output is in form of a SQL file or multiple CSV files. +* When `eth-statediff-service` is run in file mode (`database.type`: `file`) the output is in form of a SQL + file or multiple CSV files. ### SQL diff --git a/cmd/env.go b/cmd/env.go index 766378b..fc30916 100644 --- a/cmd/env.go +++ b/cmd/env.go @@ -30,10 +30,10 @@ const ( DB_CACHE_SIZE_MB = "DB_CACHE_SIZE_MB" TRIE_CACHE_SIZE_MB = "TRIE_CACHE_SIZE_MB" - LVLDB_MODE = "LVLDB_MODE" - LVLDB_PATH = "LVLDB_PATH" - LVLDB_ANCIENT = "LVLDB_ANCIENT" - LVLDB_URL = "LVLDB_URL" + LEVELDB_MODE = "LEVELDB_MODE" + LEVELDB_PATH = "LEVELDB_PATH" + LEVELDB_ANCIENT = "LEVELDB_ANCIENT" + LEVELDB_URL = "LEVELDB_URL" STATEDIFF_PRERUN = "STATEDIFF_PRERUN" STATEDIFF_TRIE_WORKERS = "STATEDIFF_TRIE_WORKERS" @@ -58,8 +58,8 @@ const ( PRERUN_INCLUDE_TD = "PRERUN_INCLUDE_TD" PRERUN_INCLUDE_CODE = "PRERUN_INCLUDE_CODE" - LOG_LEVEL = "LOG_LEVEL" - LOG_FILE_PATH = "LOG_FILE_PATH" + LOG_LEVEL = "LOG_LEVEL" + LOG_FILE = "LOG_FILE" DATABASE_NAME = "DATABASE_NAME" DATABASE_HOSTNAME = "DATABASE_HOSTNAME" @@ -119,10 +119,10 @@ func init() { viper.BindEnv("cache.database", DB_CACHE_SIZE_MB) viper.BindEnv("cache.trie", TRIE_CACHE_SIZE_MB) - viper.BindEnv("leveldb.mode", LVLDB_MODE) - viper.BindEnv("leveldb.path", LVLDB_PATH) - viper.BindEnv("leveldb.ancient", LVLDB_ANCIENT) - viper.BindEnv("leveldb.url", LVLDB_URL) + viper.BindEnv("leveldb.mode", LEVELDB_MODE) + viper.BindEnv("leveldb.path", LEVELDB_PATH) + viper.BindEnv("leveldb.ancient", LEVELDB_ANCIENT) + viper.BindEnv("leveldb.url", LEVELDB_URL) viper.BindEnv("prom.metrics", PROM_METRICS) viper.BindEnv("prom.http", PROM_HTTP) @@ -145,7 +145,7 @@ func init() { viper.BindEnv("prerun.params.includeCode", PRERUN_INCLUDE_CODE) viper.BindEnv("log.level", LOG_LEVEL) - viper.BindEnv("log.file", LOG_FILE_PATH) + viper.BindEnv("log.file", LOG_FILE) viper.BindEnv("debug.pprof", DEBUG_PPROF) } diff --git a/cmd/root.go b/cmd/root.go index e957938..209ca22 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -23,13 +23,13 @@ import ( "strings" "time" + "github.com/cerc-io/plugeth-statediff/indexer/database/dump" + "github.com/cerc-io/plugeth-statediff/indexer/database/file" + "github.com/cerc-io/plugeth-statediff/indexer/database/sql/postgres" + "github.com/cerc-io/plugeth-statediff/indexer/interfaces" + "github.com/cerc-io/plugeth-statediff/indexer/node" + "github.com/cerc-io/plugeth-statediff/indexer/shared" "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/statediff/indexer/database/dump" - "github.com/ethereum/go-ethereum/statediff/indexer/database/file" - "github.com/ethereum/go-ethereum/statediff/indexer/database/sql/postgres" - "github.com/ethereum/go-ethereum/statediff/indexer/interfaces" - "github.com/ethereum/go-ethereum/statediff/indexer/node" - "github.com/ethereum/go-ethereum/statediff/indexer/shared" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -49,7 +49,6 @@ var rootCmd = &cobra.Command{ } func Execute() { - log.Info("----- Starting vDB -----") if err := rootCmd.Execute(); err != nil { log.Fatal(err) } @@ -122,11 +121,11 @@ func init() { rootCmd.PersistentFlags().String("leveldb-url", "", "url to primary leveldb-ethdb-rpc server") rootCmd.PersistentFlags().Bool("prerun", false, "turn on prerun of toml configured ranges") - rootCmd.PersistentFlags().Int("service-workers", 0, "number of range requests to process concurrently") - rootCmd.PersistentFlags().Int("trie-workers", 0, "number of workers to use for trie traversal and processing") - rootCmd.PersistentFlags().Int("worker-queue-size", 0, "size of the range request queue for service workers") + rootCmd.PersistentFlags().Int("service-workers", 1, "number of range requests to process concurrently") + rootCmd.PersistentFlags().Int("trie-workers", 1, "number of workers to use for trie traversal and processing") + rootCmd.PersistentFlags().Int("worker-queue-size", 1024, "size of the range request queue for service workers") - rootCmd.PersistentFlags().String("database-name", "vulcanize_public", "database name") + rootCmd.PersistentFlags().String("database-name", "cerc_public", "database name") rootCmd.PersistentFlags().Int("database-port", 5432, "database port") rootCmd.PersistentFlags().String("database-hostname", "localhost", "database hostname") rootCmd.PersistentFlags().String("database-user", "", "database user") @@ -300,7 +299,7 @@ func getConfig(nodeInfo node.Info) (interfaces.Config, error) { if err != nil { return nil, err } - logWithCommand.Infof("Configuring service for database type: %s", dbType) + logWithCommand.Debugf("Configuring service for database type: %s", dbType) var indexerConfig interfaces.Config switch dbType { case shared.FILE: @@ -340,7 +339,7 @@ func getConfig(nodeInfo node.Info) (interfaces.Config, error) { case dump.STDOUT: indexerConfig = dump.Config{Dump: os.Stderr} case dump.DISCARD: - indexerConfig = dump.Config{Dump: dump.NewDiscardWriterCloser()} + indexerConfig = dump.Config{Dump: dump.Discard} default: return nil, fmt.Errorf("unrecognized dump destination: %s", dumpDst) } @@ -357,8 +356,6 @@ func getConfig(nodeInfo node.Info) (interfaces.Config, error) { DatabaseName: viper.GetString("database.name"), Username: viper.GetString("database.user"), Password: viper.GetString("database.password"), - ID: nodeInfo.ID, - ClientName: nodeInfo.ClientName, Driver: driverType, } if viper.IsSet("database.maxIdle") { diff --git a/cmd/serve.go b/cmd/serve.go index 6ba7b7d..faada92 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -28,7 +28,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - sd "github.com/cerc-io/eth-statediff-service/pkg" + pkg "github.com/cerc-io/eth-statediff-service/pkg" srpc "github.com/cerc-io/eth-statediff-service/pkg/rpc" ) @@ -60,22 +60,14 @@ func maxParallelism() int { } func serve() { - logWithCommand.Info("Running eth-statediff-service serve command") - logWithCommand.Infof("Parallelism: %d", maxParallelism()) + logWithCommand.Debug("Running eth-statediff-service serve command") + logWithCommand.Debugf("Parallelism: %d", maxParallelism()) reader, chainConf, nodeInfo := instantiateLevelDBReader() - // report latest block info - header, err := reader.GetLatestHeader() - if err != nil { - logWithCommand.Fatalf("Unable to determine latest header height and hash: %s", err.Error()) - } - if header.Number == nil { - logWithCommand.Fatal("Latest header found in levelDB has a nil block height") - } - logWithCommand.Infof("Latest block found in the levelDB\r\nheight: %s, hash: %s", header.Number.String(), header.Hash().Hex()) + reportLatestBlock(reader) - statediffService, err := createStateDiffService(reader, chainConf, nodeInfo) + service, err := createStateDiffService(reader, chainConf, nodeInfo) if err != nil { logWithCommand.Fatal(err) } @@ -93,48 +85,45 @@ func serve() { // short circuit if we only want to perform prerun if viper.GetBool("prerun.only") { parallel := viper.GetBool("prerun.parallel") - if err := statediffService.Run(nil, parallel); err != nil { - logWithCommand.Fatal("Unable to perform prerun: %v", err) + if err := service.Run(nil, parallel); err != nil { + logWithCommand.Fatalf("Unable to perform prerun: %v", err) } return } // start service and servers - logWithCommand.Info("Starting statediff service") - wg := new(sync.WaitGroup) - if err := statediffService.Loop(wg); err != nil { + var wg sync.WaitGroup + if err := service.Loop(&wg); err != nil { logWithCommand.Fatalf("unable to start statediff service: %v", err) } - logWithCommand.Info("Starting RPC servers") - if err := startServers(statediffService); err != nil { + + if err := startServers(service); err != nil { logWithCommand.Fatal(err) } - logWithCommand.Info("RPC servers successfully spun up; awaiting requests") + logWithCommand.Debug("RPC servers successfully spun up; awaiting requests") // clean shutdown shutdown := make(chan os.Signal) signal.Notify(shutdown, os.Interrupt) <-shutdown logWithCommand.Info("Received interrupt signal, shutting down") - statediffService.Stop() + service.Stop() wg.Wait() } -func startServers(serv sd.StateDiffService) error { +func startServers(serv *pkg.Service) error { ipcPath := viper.GetString("server.ipcPath") httpPath := viper.GetString("server.httpPath") if ipcPath == "" && httpPath == "" { - logWithCommand.Fatal("Need an ipc path and/or an http path") + logWithCommand.Fatal("Need an IPC path and/or an HTTP path") } if ipcPath != "" { - logWithCommand.Info("Starting up IPC server") _, _, err := srpc.StartIPCEndpoint(ipcPath, serv.APIs()) if err != nil { return err } } if httpPath != "" { - logWithCommand.Info("Starting up HTTP server") _, err := srpc.StartHTTPEndpoint(httpPath, serv.APIs(), []string{"statediff"}, nil, []string{"*"}, rpc.HTTPTimeouts{}) if err != nil { return err diff --git a/cmd/stats.go b/cmd/stats.go index abf91f7..3d494f2 100644 --- a/cmd/stats.go +++ b/cmd/stats.go @@ -42,13 +42,5 @@ func stats() { logWithCommand.Info("Running eth-statediff-service stats command") reader, _, _ := instantiateLevelDBReader() - - header, err := reader.GetLatestHeader() - if err != nil { - logWithCommand.Fatalf("Unable to determine latest header height and hash: %s", err.Error()) - } - if header.Number == nil { - logWithCommand.Fatal("Latest header found in levelDB has a nil block height") - } - logWithCommand.Infof("Latest block found in the levelDB\r\nheight: %s, hash: %s", header.Number.String(), header.Hash().Hex()) + reportLatestBlock(reader) } diff --git a/cmd/util.go b/cmd/util.go index 9586f3b..22c9b7a 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -3,31 +3,32 @@ package cmd import ( "context" + statediff "github.com/cerc-io/plugeth-statediff" + "github.com/cerc-io/plugeth-statediff/indexer" + "github.com/cerc-io/plugeth-statediff/indexer/node" + "github.com/cerc-io/plugeth-statediff/indexer/shared" + "github.com/cerc-io/plugeth-statediff/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/statediff" - ind "github.com/ethereum/go-ethereum/statediff/indexer" - "github.com/ethereum/go-ethereum/statediff/indexer/node" - "github.com/ethereum/go-ethereum/statediff/indexer/shared" "github.com/ethereum/go-ethereum/trie" "github.com/spf13/viper" - sd "github.com/cerc-io/eth-statediff-service/pkg" + pkg "github.com/cerc-io/eth-statediff-service/pkg" "github.com/cerc-io/eth-statediff-service/pkg/prom" ) type blockRange [2]uint64 -func createStateDiffService(lvlDBReader sd.Reader, chainConf *params.ChainConfig, nodeInfo node.Info) (sd.StateDiffService, error) { +func createStateDiffService(lvlDBReader pkg.Reader, chainConf *params.ChainConfig, nodeInfo node.Info) (*pkg.Service, error) { // create statediff service - logWithCommand.Info("Setting up database") + logWithCommand.Debug("Setting up database") conf, err := getConfig(nodeInfo) if err != nil { logWithCommand.Fatal(err) } - logWithCommand.Info("Creating statediff indexer") - db, indexer, err := ind.NewStateDiffIndexer(context.Background(), chainConf, nodeInfo, conf) + logWithCommand.Debug("Creating statediff indexer") + db, indexer, err := indexer.NewStateDiffIndexer(context.Background(), chainConf, nodeInfo, conf, true) if err != nil { logWithCommand.Fatal(err) } @@ -35,17 +36,17 @@ func createStateDiffService(lvlDBReader sd.Reader, chainConf *params.ChainConfig prom.RegisterDBCollector(viper.GetString("database.name"), db) } - logWithCommand.Info("Creating statediff service") - sdConf := sd.Config{ + logWithCommand.Debug("Creating statediff service") + sdConf := pkg.ServiceConfig{ ServiceWorkers: viper.GetUint("statediff.serviceWorkers"), TrieWorkers: viper.GetUint("statediff.trieWorkers"), WorkerQueueSize: viper.GetUint("statediff.workerQueueSize"), PreRuns: setupPreRunRanges(), } - return sd.NewStateDiffService(lvlDBReader, indexer, sdConf) + return pkg.NewStateDiffService(lvlDBReader, indexer, sdConf), nil } -func setupPreRunRanges() []sd.RangeRequest { +func setupPreRunRanges() []pkg.RangeRequest { if !viper.GetBool("statediff.prerun") { return nil } @@ -64,9 +65,9 @@ func setupPreRunRanges() []sd.RangeRequest { preRunParams.WatchedAddresses = addrs var rawRanges []blockRange viper.UnmarshalKey("prerun.ranges", &rawRanges) - blockRanges := make([]sd.RangeRequest, len(rawRanges)) + blockRanges := make([]pkg.RangeRequest, len(rawRanges)) for i, rawRange := range rawRanges { - blockRanges[i] = sd.RangeRequest{ + blockRanges[i] = pkg.RangeRequest{ Start: rawRange[0], Stop: rawRange[1], Params: preRunParams, @@ -75,7 +76,7 @@ func setupPreRunRanges() []sd.RangeRequest { if viper.IsSet("prerun.start") && viper.IsSet("prerun.stop") { hardStart := viper.GetInt("prerun.start") hardStop := viper.GetInt("prerun.stop") - blockRanges = append(blockRanges, sd.RangeRequest{ + blockRanges = append(blockRanges, pkg.RangeRequest{ Start: uint64(hardStart), Stop: uint64(hardStop), Params: preRunParams, @@ -85,9 +86,9 @@ func setupPreRunRanges() []sd.RangeRequest { return blockRanges } -func instantiateLevelDBReader() (sd.Reader, *params.ChainConfig, node.Info) { +func instantiateLevelDBReader() (pkg.Reader, *params.ChainConfig, node.Info) { // load some necessary params - logWithCommand.Info("Loading statediff service parameters") + logWithCommand.Debug("Loading statediff service parameters") mode := viper.GetString("leveldb.mode") path := viper.GetString("leveldb.path") ancientPath := viper.GetString("leveldb.ancient") @@ -107,23 +108,15 @@ func instantiateLevelDBReader() (sd.Reader, *params.ChainConfig, node.Info) { nodeInfo := getEthNodeInfo() - var chainConf *params.ChainConfig - var err error chainConfigPath := viper.GetString("ethereum.chainConfig") - - if chainConfigPath != "" { - chainConf, err = statediff.LoadConfig(chainConfigPath) - } else { - chainConf, err = statediff.ChainConfig(nodeInfo.ChainID) - } - + chainConf, err := utils.LoadConfig(chainConfigPath) if err != nil { - logWithCommand.Fatalf("Unable to instantiate chain config: %s", err.Error()) + logWithCommand.Fatalf("Unable to instantiate chain config: %s", err) } // create LevelDB reader - logWithCommand.Info("Creating LevelDB reader") - readerConf := sd.LvLDBReaderConfig{ + logWithCommand.Debug("Creating LevelDB reader") + readerConf := pkg.LvLDBReaderConfig{ TrieConfig: &trie.Config{ Cache: viper.GetInt("cache.trie"), Journal: "", @@ -136,9 +129,24 @@ func instantiateLevelDBReader() (sd.Reader, *params.ChainConfig, node.Info) { Url: url, DBCacheSize: viper.GetInt("cache.database"), } - reader, err := sd.NewLvlDBReader(readerConf) + reader, err := pkg.NewLvlDBReader(readerConf) if err != nil { - logWithCommand.Fatalf("Unable to instantiate levelDB reader: %s", err.Error()) + logWithCommand.Fatalf("Unable to instantiate levelDB reader: %s", err) } return reader, chainConf, nodeInfo } + +// report latest block info +func reportLatestBlock(reader pkg.Reader) { + header, err := reader.GetLatestHeader() + if err != nil { + logWithCommand.Fatalf("Unable to determine latest header height and hash: %s", err.Error()) + } + if header.Number == nil { + logWithCommand.Fatal("Latest header found in levelDB has a nil block height") + } + logWithCommand. + WithField("height", header.Number). + WithField("hash", header.Hash()). + Info("Latest block found in levelDB") +} diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 74f6334..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: '3.2' - -services: - eth-statediff-service: - build: - context: ./ - cache_from: - - alpine:latest - - golang:1.16 - dockerfile: ./Dockerfile - args: - USER: "vdbm" - CONFIG_FILE: ./environments/example.toml - EXPOSE_PORT: 8545 - environment: - - VDB_COMMAND=serve - volumes: - - eth-statediff-service-data:/root/.ethereum/ - ports: - - "127.0.0.1:8545:8545" - -volumes: - eth-statediff-service-data: diff --git a/environments/config.toml b/environments/config.toml deleted file mode 100644 index fa7e1b8..0000000 --- a/environments/config.toml +++ /dev/null @@ -1,56 +0,0 @@ -[leveldb] - mode = "local" - path = "/app/geth-rw/chaindata" - ancient = "/app/geth-rw/chaindata/ancient" - -[server] - ipcPath = "" - httpPath = "0.0.0.0:8545" - -[statediff] - prerun = true - serviceWorkers = 1 - workerQueueSize = 1024 - trieWorkers = 16 - -[prerun] - only = true - ranges = [] - [prerun.params] - includeBlock = true - includeReceipts = true - includeTD = true - includeCode = true - watchedAddresses = [] - -[log] - file = "" - level = "info" - -[database] - type = "postgres" - name = "" - hostname = "" - port = 5432 - user = "" - password = "" - driver = "sqlx" - -[cache] - database = 1024 - trie = 4096 - -[prom] - metrics = true - http = true - httpAddr = "0.0.0.0" - httpPort = 9100 - dbStats = false - -[ethereum] - nodeID = "" - clientName = "eth-statediff-service" - genesisBlock = "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" - networkID = 1 - chainID = 1 - chainConfig = "" diff --git a/environments/docker.toml b/environments/docker.toml new file mode 100644 index 0000000..1a43ffb --- /dev/null +++ b/environments/docker.toml @@ -0,0 +1,82 @@ +[leveldb] + mode = "local" # LEVELDB_MODE + path = "/app/geth-rw/chaindata" # LEVELDB_PATH + ancient = "/app/geth-rw/chaindata/ancient" # LEVELDB_ANCIENT + url = "http://127.0.0.1:8082/" # LEVELDB_URL + +[server] + ipcPath = ".ipc" # SERVICE_IPC_PATH + httpPath = "0.0.0.0:8545" # SERVICE_HTTP_PATH + +[statediff] + prerun = true # STATEDIFF_PRERUN + serviceWorkers = 1 # STATEDIFF_SERVICE_WORKERS + workerQueueSize = 1024 # STATEDIFF_WORKER_QUEUE_SIZE + trieWorkers = 16 # STATEDIFF_TRIE_WORKERS + +[prerun] + only = true # PRERUN_ONLY + parallel = true # PRERUN_PARALLEL + ranges = [] + + # statediffing params for prerun + [prerun.params] + includeBlock = true # PRERUN_INCLUDE_BLOCK + includeReceipts = true # PRERUN_INCLUDE_RECEIPTS + includeTD = true # PRERUN_INCLUDE_TD + includeCode = true # PRERUN_INCLUDE_CODE + watchedAddresses = [] + +[log] + # Leave empty to output to stdout + file = "" # LOG_FILE + level = "debug" # LOG_LEVEL + +[database] + # output type + type = "postgres" + name = "" # DATABASE_NAME + hostname = "" # DATABASE_HOSTNAME + port = 5432 # DATABASE_PORT + user = "" # DATABASE_USER + password = "" # DATABASE_PASSWORD + driver = "" # DATABASE_DRIVER_TYPE + + # with file type + # file mode + fileMode = "csv" # DATABASE_FILE_MODE + + # with SQL file mode + filePath = "" # DATABASE_FILE_PATH + + # with CSV file mode + fileCsvDir = "" # DATABASE_FILE_CSV_DIR + + # with dump type + # + dumpDestination = "" # DATABASE_DUMP_DST + +[cache] + # settings for geth internal caches + database = 1024 # DB_CACHE_SIZE_MB + trie = 4096 # TRIE_CACHE_SIZE_MB + +[prom] + # prometheus metrics + metrics = true # PROM_METRICS + http = true # PROM_HTTP + httpAddr = "localhost" # PROM_HTTP_ADDR + httpPort = "8889" # PROM_HTTP_PORT + dbStats = true # PROM_DB_STATS + +[ethereum] + # Identifiers for ethereum node + nodeID = "" # ETH_NODE_ID + clientName = "eth-statediff-service" # ETH_CLIENT_NAME + networkID = 1 # ETH_NETWORK_ID + chainID = 1 # ETH_CHAIN_ID + genesisBlock = "" # ETH_GENESIS_BLOCK + chainConfig = "" # ETH_CHAIN_CONFIG + +[debug] + pprof = false # DEBUG_PPROF diff --git a/environments/example.toml b/environments/example.toml index 957047a..8accf7d 100644 --- a/environments/example.toml +++ b/environments/example.toml @@ -1,61 +1,102 @@ [leveldb] - mode = "local" - path = "/Users/user/Library/Ethereum/geth/chaindata" - ancient = "/Users/user/Library/Ethereum/geth/chaindata/ancient" - url = "http://127.0.0.1:8082/" + # LevelDB access mode + mode = "local" # LEVELDB_MODE + + # LevelDB paths (local mode) + path = "/Users/user/Library/Ethereum/geth/chaindata" # LEVELDB_PATH + ancient = "/Users/user/Library/Ethereum/geth/chaindata/ancient" # LEVELDB_ANCIENT + + # URL for leveldb-ethdb-rpc endpoint (remote mode) + url = "http://127.0.0.1:8082/" # LEVELDB_URL [server] - ipcPath = ".ipc" - httpPath = "127.0.0.1:8545" + ipcPath = ".ipc" # SERVICE_IPC_PATH + httpPath = "127.0.0.1:8545" # SERVICE_HTTP_PATH [statediff] - prerun = true - serviceWorkers = 1 - workerQueueSize = 1024 - trieWorkers = 4 + prerun = true # STATEDIFF_PRERUN + serviceWorkers = 1 # STATEDIFF_SERVICE_WORKERS + workerQueueSize = 1024 # STATEDIFF_WORKER_QUEUE_SIZE + trieWorkers = 4 # STATEDIFF_TRIE_WORKERS [prerun] - only = false + only = false # PRERUN_ONLY + parallel = true # PRERUN_PARALLEL + + # to perform prerun in a specific range (optional) + start = 0 # PRERUN_RANGE_START + stop = 100 # PRERUN_RANGE_STOP + + # to perform prerun over multiple ranges (optional) ranges = [ - [0, 1000] + [101, 1000] ] + + # statediffing params for prerun [prerun.params] - includeBlock = true - includeReceipts = true - includeTD = true - includeCode = true - watchedAddresses = [] + includeBlock = true # PRERUN_INCLUDE_BLOCK + includeReceipts = true # PRERUN_INCLUDE_RECEIPTS + includeTD = true # PRERUN_INCLUDE_TD + includeCode = true # PRERUN_INCLUDE_CODE + watchedAddresses = [] [log] - file = "" - level = "info" + # Leave empty to output to stdout + file = "" # LOG_FILE + level = "info" # LOG_LEVEL [database] - name = "vulcanize_test" - hostname = "localhost" - port = 5432 - user = "vulcanize" - password = "..." + # output type type = "postgres" - driver = "sqlx" - dumpDestination = "" - filePath = "" + + # with postgres type + # db credentials + name = "vulcanize_test" # DATABASE_NAME + hostname = "localhost" # DATABASE_HOSTNAME + port = 5432 # DATABASE_PORT + user = "vulcanize" # DATABASE_USER + password = "..." # DATABASE_PASSWORD + # SQL backend to use: + driver = "sqlx" # DATABASE_DRIVER_TYPE + + # with file type + # file mode + fileMode = "csv" # DATABASE_FILE_MODE + + # with SQL file mode + filePath = "" # DATABASE_FILE_PATH + + # with CSV file mode + fileCsvDir = "output_dir" # DATABASE_FILE_CSV_DIR + + # with dump type + # + dumpDestination = "" # DATABASE_DUMP_DST [cache] - database = 1024 - trie = 1024 + # settings for geth internal caches + database = 1024 # DB_CACHE_SIZE_MB + trie = 1024 # TRIE_CACHE_SIZE_MB [prom] - dbStats = false - metrics = true - http = true - httpAddr = "localhost" - httpPort = "8889" + # prometheus metrics + metrics = true # PROM_METRICS + http = true # PROM_HTTP + httpAddr = "localhost" # PROM_HTTP_ADDR + httpPort = "8889" # PROM_HTTP_PORT + dbStats = true # PROM_DB_STATS [ethereum] - chainConfig = "" - nodeID = "" - clientName = "eth-statediff-service" - genesisBlock = "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" - networkID = 1 - chainID = 1 + # Identifiers for ethereum node + nodeID = "" # ETH_NODE_ID + clientName = "eth-statediff-service" # ETH_CLIENT_NAME + networkID = 1 # ETH_NETWORK_ID + chainID = 1 # ETH_CHAIN_ID + genesisBlock = "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3" # ETH_GENESIS_BLOCK + + # Path to custom chain config file (optional) + # chainID should match that in this config file + chainConfig = "chain.json" # ETH_CHAIN_CONFIG + +[debug] + pprof = false # DEBUG_PPROF diff --git a/go.mod b/go.mod index 99d615c..8811468 100644 --- a/go.mod +++ b/go.mod @@ -1,58 +1,62 @@ module github.com/cerc-io/eth-statediff-service -go 1.18 +go 1.19 require ( github.com/cerc-io/leveldb-ethdb-rpc v1.1.13 - github.com/ethereum/go-ethereum v1.11.6 + github.com/cerc-io/plugeth-statediff v0.0.0-00010101000000-000000000000 + github.com/ethereum/go-ethereum v1.12.0 github.com/jmoiron/sqlx v1.3.5 // indirect - github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_golang v1.16.0 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.3.0 github.com/spf13/viper v1.10.1 ) require ( - github.com/DataDog/zstd v1.5.2 // indirect - github.com/VictoriaMetrics/fastcache v1.6.0 // indirect + github.com/DataDog/zstd v1.5.5 // indirect + github.com/VictoriaMetrics/fastcache v1.12.1 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/cerc-io/eth-iterator-utils v1.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cockroachdb/errors v1.9.1 // indirect + github.com/cockroachdb/errors v1.10.0 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect - github.com/cockroachdb/redact v1.1.3 // indirect + github.com/cockroachdb/pebble v0.0.0-20230720154706-692f3b61a3c4 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230613231145-182959a1fad6 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/deckarep/golang-set/v2 v2.1.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect + github.com/deckarep/golang-set/v2 v2.3.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/deepmap/oapi-codegen v1.8.2 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect - github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect + github.com/fjl/memsize v0.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect - github.com/georgysavva/scany v1.2.1 // indirect - github.com/getsentry/sentry-go v0.18.0 // indirect + github.com/georgysavva/scany v0.2.9 // indirect + github.com/getsentry/sentry-go v0.22.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.3.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/uuid v1.3.0 // indirect - github.com/gorilla/websocket v1.4.2 // indirect + github.com/gorilla/websocket v1.5.0 // indirect github.com/graph-gophers/graphql-go v1.3.0 // indirect - github.com/hashicorp/go-bexpr v0.1.10 // indirect + github.com/hashicorp/go-bexpr v0.1.12 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect - github.com/huin/goupnp v1.0.3 // indirect + github.com/holiman/uint256 v1.2.3 // indirect + github.com/huin/goupnp v1.2.0 // indirect + github.com/inconshreveable/log15 v2.16.0+incompatible // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/influxdata/influxdb-client-go/v2 v2.4.0 // indirect github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c // indirect github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect - github.com/ipfs/go-cid v0.2.0 // indirect + github.com/ipfs/go-cid v0.4.1 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.10.0 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -63,37 +67,39 @@ require ( github.com/jackc/pgx/v4 v4.13.0 // indirect github.com/jackc/puddle v1.1.3 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect - github.com/klauspost/compress v1.15.15 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.7 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/magiconair/properties v1.8.5 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect - github.com/minio/sha256-simd v1.0.0 // indirect - github.com/mitchellh/mapstructure v1.4.3 // indirect - github.com/mitchellh/pointerstructure v1.2.0 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/pointerstructure v1.2.1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect - github.com/multiformats/go-base32 v0.0.3 // indirect - github.com/multiformats/go-base36 v0.1.0 // indirect - github.com/multiformats/go-multibase v0.0.3 // indirect - github.com/multiformats/go-multihash v0.1.0 // indirect - github.com/multiformats/go-varint v0.0.6 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/openrelayxyz/plugeth-utils v1.2.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 // indirect - github.com/pganalyze/pg_query_go/v2 v2.2.0 // indirect + github.com/pganalyze/pg_query_go/v4 v4.2.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.39.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect - github.com/rs/cors v1.7.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.4.0 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.0 // indirect + github.com/rivo/uniseg v0.4.4 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rs/cors v1.9.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/shopspring/decimal v1.2.0 // indirect @@ -103,28 +109,38 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/status-im/keycard-go v0.2.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/testify v1.8.2 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect github.com/thoas/go-funk v0.9.3 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect - github.com/tklauser/numcpus v0.6.0 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect + github.com/urfave/cli/v2 v2.25.7 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - github.com/yusufpapurcu/wmi v1.2.2 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect - golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect - google.golang.org/protobuf v1.28.1 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/term v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect + golang.org/x/time v0.3.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - lukechampine.com/blake3 v1.1.6 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + lukechampine.com/blake3 v1.2.1 // indirect ) -replace github.com/ethereum/go-ethereum v1.11.6 => github.com/cerc-io/go-ethereum v1.11.6-statediff-5.0.8 +replace ( + github.com/cerc-io/eth-iterator-utils => git.vdb.to/cerc-io/eth-iterator-utils v0.1.2 + github.com/cerc-io/eth-testing => git.vdb.to/cerc-io/eth-testing v0.3.1 + github.com/cerc-io/plugeth-statediff => git.vdb.to/cerc-io/plugeth-statediff v0.1.4 + github.com/ethereum/go-ethereum => git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1 + github.com/openrelayxyz/plugeth-utils => git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46 +) diff --git a/go.sum b/go.sum index 4a5f97c..2c4c4f9 100644 --- a/go.sum +++ b/go.sum @@ -46,22 +46,24 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= +git.vdb.to/cerc-io/eth-iterator-utils v0.1.2 h1:PdMR5B9wrQSYuYpFhN+9Kc8AEZ0pTt5eKCmu8oCtFcY= +git.vdb.to/cerc-io/eth-iterator-utils v0.1.2/go.mod h1:OvXbdWbZ5viBXC/Ui1EkhsSmGB+AUX+TjGa3UDAfjfg= +git.vdb.to/cerc-io/eth-testing v0.3.1 h1:sPnlMev6oEgTjsW7GtUkSsjKNG/+X6P9q0izSejLGpM= +git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1 h1:KLjxHwp9Zp7xhECccmJS00RiL+VwTuUGLU7qeIctg8g= +git.vdb.to/cerc-io/plugeth v0.0.0-20230808125822-691dc334fab1/go.mod h1:cYXZu70+6xmDgIgrTD81GPasv16piiAFJnKyAbwVPMU= +git.vdb.to/cerc-io/plugeth-statediff v0.1.4 h1:swDJDAk1/yu6MOHAvxeyZz+MS1H9FCmSWGQRswFxFEw= +git.vdb.to/cerc-io/plugeth-statediff v0.1.4/go.mod h1:PX1bwTwZKzegQu6zYdpuJf1tHNmU0suapKOUUO2xIzs= +git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46 h1:KYcbbne/RXd7AuxbUd/3hgk1jPN+33k2CKiNsUsMCC0= +git.vdb.to/cerc-io/plugeth-utils v0.0.0-20230706160122-cd41de354c46/go.mod h1:VpDN61dxy64zGff05F0adujR5enD/JEdXBkTQ+PaIsQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= -github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= -github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= -github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= -github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= +github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -70,24 +72,20 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= -github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= +github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cerc-io/go-ethereum v1.11.6-statediff-5.0.8 h1:a57yBLQOkIKTjC5coaPWtNHmM+nKT8yQfwL/4UNmrLU= -github.com/cerc-io/go-ethereum v1.11.6-statediff-5.0.8/go.mod h1:Jc6zFIJJFvhRMDxbj7kfUFlg6NbSQiS4RyEMDavuF1w= github.com/cerc-io/leveldb-ethdb-rpc v1.1.13 h1:XM+e/JLKjNoYc4Xj7DJNNlFI4+3HpqZ9VkVlrWBlwHg= github.com/cerc-io/leveldb-ethdb-rpc v1.1.13/go.mod h1:ZNa5ySrKJ0ZLsJ0nSNaQ+11PkX29Juy9+omMgP6mw1c= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= @@ -114,28 +112,23 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/cockroachdb/cockroach-go/v2 v2.2.0 h1:/5znzg5n373N/3ESjHF5SMLxiW4RKB05Ql//KWfeTFs= -github.com/cockroachdb/cockroach-go/v2 v2.2.0/go.mod h1:u3MiKYGupPPjkn3ozknpMUpxPaNLTFWAya419/zv6eI= -github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= -github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= -github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= -github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/cockroach-go/v2 v2.0.3 h1:ZA346ACHIZctef6trOTwBAEvPVm1k0uLm/bb2Atc+S8= +github.com/cockroachdb/cockroach-go/v2 v2.0.3/go.mod h1:hAuDgiVgDVkfirP9JnhXEfcXEPRKBpYdGz+l7mvYSzw= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= +github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= -github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= -github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= -github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= -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= +github.com/cockroachdb/pebble v0.0.0-20230720154706-692f3b61a3c4 h1:hAtIkNbQFeZbK6KEjiqyuWbegSeuLOTD8+hK7wn6+pI= +github.com/cockroachdb/pebble v0.0.0-20230720154706-692f3b61a3c4/go.mod h1:FN5O47SBEz5+kO9fG8UTR64g2WS1u5ZFCgTvxGjoSks= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230613231145-182959a1fad6 h1:DJK8W/iB+s/qkTtmXSrHA49lp5O3OsR7E6z4byOLy34= +github.com/cockroachdb/tokenbucket v0.0.0-20230613231145-182959a1fad6/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -145,23 +138,19 @@ github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= -github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/deckarep/golang-set/v2 v2.3.0 h1:qs18EKUfHm2X9fA50Mr/M5hccg2tNnVqsiBImnyDs0g= +github.com/deckarep/golang-set/v2 v2.3.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +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/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU= github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= -github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= +github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/docker v1.6.2 h1:HlFGsy+9/xrgMmhmN+NGhCc5SHGJ7I+kHosRR1xc/aI= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -173,36 +162,28 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ= +github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/georgysavva/scany v1.2.1 h1:91PAMBpwBtDjvn46TaLQmuVhxpAG6p6sjQaU4zPHPSM= -github.com/georgysavva/scany v1.2.1/go.mod h1:vGBpL5XRLOocMFFa55pj0P04DrL3I7qKVRL49K6Eu5o= +github.com/georgysavva/scany v0.2.9 h1:Xt6rjYpHnMClTm/g+oZTnoSxUwiln5GqMNU+QeLNHQU= +github.com/georgysavva/scany v0.2.9/go.mod h1:yeOeC1BdIdl6hOwy8uefL2WNSlseFzbhlG/frrh65SA= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= -github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= -github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= +github.com/getsentry/sentry-go v0.22.0 h1:XNX9zKbv7baSEI65l+H1GEJgSeIC1c7EN5kluWaP6dM= +github.com/getsentry/sentry-go v0.22.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -213,37 +194,30 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= -github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -257,6 +231,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -274,14 +249,14 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= -github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -297,7 +272,6 @@ 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.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -326,19 +300,17 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= -github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/go-bexpr v0.1.12 h1:XrdVhmwu+9iYxIUWxsGVG7NQwrhzJZ0vR6nbN5bLgrA= +github.com/hashicorp/go-bexpr v0.1.12/go.mod h1:ACktpcSySkFNpcxWSClFrut7wicd9WzisnvHuw+g9K8= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= @@ -355,7 +327,6 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -370,17 +341,16 @@ github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKEN github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= -github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= +github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= +github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= +github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= +github.com/inconshreveable/log15 v2.16.0+incompatible h1:6nvMKxtGcpgm7q0KiGs+Vc+xDvUXaBqsPKHWKsinccw= +github.com/inconshreveable/log15 v2.16.0+incompatible/go.mod h1:cOaXtrgN4ScfRrD9Bre7U1thNq5RtJ8ZoP4iXVGRj6o= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb-client-go/v2 v2.4.0 h1:HGBfZYStlx3Kqvsv1h2pJixbCl/jhnFtxpKFAv9Tu5k= @@ -390,13 +360,8 @@ github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 h1:vilfsDSy7TDxedi9gyBkMvAirat/oRcL0lFdJBf6tdM= github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/ipfs/go-cid v0.2.0 h1:01JTiihFq9en9Vz0lc0VDWvZe/uBonGpzo4THP0vcQ0= -github.com/ipfs/go-cid v0.2.0/go.mod h1:P+HXFDF4CVhaVayiEb4wkAy7zBHxBwsJyt0Y5U6MLro= -github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= -github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= -github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= -github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= -github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= +github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= +github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -407,6 +372,8 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk= github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= +github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= +github.com/jackc/pgconn v1.7.0/go.mod h1:sF/lPpNEMEOp+IYhyQGdAvrG20gWf6A1tKlr0v7JMeA= github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= @@ -426,6 +393,8 @@ github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.5/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI= github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= @@ -436,19 +405,22 @@ github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01C github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0= +github.com/jackc/pgtype v1.3.0/go.mod h1:b0JqxHvPmljG+HQ5IsvQ0yqeSi4nGcDTVjFoiLDb0Ik= github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po= github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= -github.com/jackc/pgtype v1.6.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= +github.com/jackc/pgtype v1.4.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= github.com/jackc/pgtype v1.8.1 h1:9k0IXtdJXHJbyAWQgbWr1lU+MEhPXZz6RIXxfR5oxXs= github.com/jackc/pgtype v1.8.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA= +github.com/jackc/pgx/v4 v4.6.0/go.mod h1:vPh43ZzxijXUVJ+t/EmXBtFmbFVO72cuneCT9oAlxAg= github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= -github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA= +github.com/jackc/pgx/v4 v4.8.1/go.mod h1:4HOLxrl8wToZJReD04/yB20GDwf4KBYETvlHciCnwW0= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.13.0 h1:JCjhT5vmhMAf/YwBHLvrBn4OGdIQBiFG6ym8Zmdx570= github.com/jackc/pgx/v4 v4.13.0/go.mod h1:9P4X524sErlaxj0XSGZk7s+LD0eOyu1ZDUrrpznYDF0= @@ -456,13 +428,15 @@ github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0f github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.2/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3 h1:JnPg/5Q9xVJGfjsO5CPUOjnJps1JaRUm8I9FXVCFK94= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= +github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -471,32 +445,20 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= -github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= -github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= -github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= -github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= -github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +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/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -506,18 +468,17 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.4.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -531,7 +492,6 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= @@ -544,67 +504,60 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/mattn/go-sqlite3 v2.0.1+incompatible h1:xQ15muvnzGBHpIpdrNi1DA5x0+TcBZzsIDwmw9uTHzw= +github.com/mattn/go-sqlite3 v2.0.1+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= -github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g= -github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= -github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= -github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +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/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= -github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.1 h1:ZhBBeX8tSlRpu/FFhXH4RC4OJzFlqsQhoHZAz4x7TIw= +github.com/mitchellh/pointerstructure v1.2.1/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= -github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4= -github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= -github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk= -github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multihash v0.1.0 h1:CgAgwqk3//SVEw3T+6DqI4mWMyRuDwZtOWcJT0q9+EA= -github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= -github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY= -github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +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-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-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= @@ -620,15 +573,13 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/pganalyze/pg_query_go/v2 v2.2.0 h1:OW+reH+ZY7jdEuPyuLGlf1m7dLbE+fDudKXhLs0Ttpk= -github.com/pganalyze/pg_query_go/v2 v2.2.0/go.mod h1:XAxmVqz1tEGqizcQ3YSdN90vCOHBWjJi8URL1er5+cA= +github.com/pganalyze/pg_query_go/v4 v4.2.1 h1:id/vuyIQccb9f6Yx3pzH5l4QYrxE3v6/m8RPlgMrprc= +github.com/pganalyze/pg_query_go/v4 v4.2.1/go.mod h1:aEkDNOXNM5j0YGzaAapwJ7LB3dLNj+bvbWcLv1hOVqA= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -642,78 +593,68 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI= -github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.11.0 h1:5EAgkfkMl659uZPbe9AS2N68a7Cc1TJbPEuGzFuRbyk= +github.com/prometheus/procfs v0.11.0/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= +github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= +github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v0.0.0-20200419222939-1884f454f8ea/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= @@ -722,15 +663,20 @@ github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= @@ -739,40 +685,26 @@ github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw= github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= -github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= -github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= -github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= -github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= -github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= -github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= @@ -801,30 +733,26 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +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= @@ -835,8 +763,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-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg= -golang.org/x/exp v0.0.0-20230206171751-46f607a40771/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-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -868,11 +796,9 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -882,7 +808,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -911,11 +836,10 @@ golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -944,15 +868,14 @@ 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.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.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-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -963,7 +886,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1005,10 +927,8 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1027,18 +947,22 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +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/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-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1048,24 +972,21 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.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-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1166,7 +1087,6 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1230,7 +1150,6 @@ google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1272,8 +1191,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1281,16 +1200,12 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= -gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= @@ -1304,14 +1219,10 @@ 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-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= -gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1319,8 +1230,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c= -lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= +lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/pkg/api.go b/pkg/api.go index 2e0b00a..170c07a 100644 --- a/pkg/api.go +++ b/pkg/api.go @@ -18,7 +18,7 @@ package statediff import ( "context" - sd "github.com/ethereum/go-ethereum/statediff" + sd "github.com/cerc-io/plugeth-statediff" ) // APIName is the namespace used for the state diffing service API @@ -30,11 +30,11 @@ const APIVersion = "0.0.1" // PublicStateDiffAPI provides an RPC interface // that can be used to fetch historical diffs from LevelDB directly type PublicStateDiffAPI struct { - sds StateDiffService + sds *Service } // NewPublicStateDiffAPI creates an rpc interface for the underlying statediff service -func NewPublicStateDiffAPI(sds StateDiffService) *PublicStateDiffAPI { +func NewPublicStateDiffAPI(sds *Service) *PublicStateDiffAPI { return &PublicStateDiffAPI{ sds: sds, } diff --git a/pkg/builder.go b/pkg/builder.go deleted file mode 100644 index a0b77e8..0000000 --- a/pkg/builder.go +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2019 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// Contains a batch of utility type declarations used by the tests. As the node -// operates on unique types, a lot of them are needed to check various features. - -package statediff - -import ( - "fmt" - "math/bits" - "sync" - - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/log" - sd "github.com/ethereum/go-ethereum/statediff" - sdtypes "github.com/ethereum/go-ethereum/statediff/types" - iter "github.com/ethereum/go-ethereum/trie/concurrent_iterator" - "github.com/sirupsen/logrus" -) - -type builder struct { - sd.StateDiffBuilder - numWorkers uint -} - -// NewBuilder is used to create a statediff builder -func NewBuilder(stateCache state.Database, workers uint) (sd.Builder, error) { - if workers == 0 { - workers = 1 - } - if bits.OnesCount(workers) != 1 { - return nil, fmt.Errorf("workers must be a power of 2") - } - return &builder{ - StateDiffBuilder: sd.StateDiffBuilder{ - StateCache: stateCache, - }, - numWorkers: workers, - }, nil -} - -// BuildStateDiffObject builds a statediff object from two blocks and the provided parameters -func (sdb *builder) BuildStateDiffObject(args sd.Args, params sd.Params) (sdtypes.StateObject, error) { - var stateNodes []sdtypes.StateLeafNode - var codeAndCodeHashes []sdtypes.IPLD - err := sdb.WriteStateDiffObject( - args, - params, sd.StateNodeAppender(&stateNodes), sd.IPLDMappingAppender(&codeAndCodeHashes)) - if err != nil { - return sdtypes.StateObject{}, err - } - return sdtypes.StateObject{ - BlockHash: args.BlockHash, - BlockNumber: args.BlockNumber, - Nodes: stateNodes, - IPLDs: codeAndCodeHashes, - }, nil -} - -// WriteStateDiffObject writes a statediff object to output callback -func (sdb *builder) WriteStateDiffObject(args sd.Args, params sd.Params, output sdtypes.StateNodeSink, codeOutput sdtypes.IPLDSink) error { - // Load tries for old and new states - oldTrie, err := sdb.StateCache.OpenTrie(args.OldStateRoot) - if err != nil { - return fmt.Errorf("error creating trie for oldStateRoot: %v", err) - } - newTrie, err := sdb.StateCache.OpenTrie(args.NewStateRoot) - if err != nil { - return fmt.Errorf("error creating trie for newStateRoot: %v", err) - } - - // Split old and new tries into corresponding subtrie iterators - oldIters1 := iter.SubtrieIterators(oldTrie.NodeIterator, sdb.numWorkers) - oldIters2 := iter.SubtrieIterators(oldTrie.NodeIterator, sdb.numWorkers) - newIters1 := iter.SubtrieIterators(newTrie.NodeIterator, sdb.numWorkers) - newIters2 := iter.SubtrieIterators(newTrie.NodeIterator, sdb.numWorkers) - - // Create iterators ahead of time to avoid race condition in state.Trie access - // We do two state iterations per subtrie: one for new/updated nodes, - // one for deleted/updated nodes; prepare 2 iterator instances for each task - var iterPairs [][]sd.IterPair - for i := uint(0); i < sdb.numWorkers; i++ { - iterPairs = append(iterPairs, []sd.IterPair{ - {Older: oldIters1[i], Newer: newIters1[i]}, - {Older: oldIters2[i], Newer: newIters2[i]}, - }) - } - - // Dispatch workers to process trie data; sync and collect results here via channels - nodeChan := make(chan sdtypes.StateLeafNode) - codeChan := make(chan sdtypes.IPLD) - - go func() { - nodeSender := func(node sdtypes.StateLeafNode) error { nodeChan <- node; return nil } - ipldSender := func(code sdtypes.IPLD) error { codeChan <- code; return nil } - var wg sync.WaitGroup - - for w := uint(0); w < sdb.numWorkers; w++ { - wg.Add(1) - go func(worker uint) { - defer wg.Done() - var err error - logger := log.New("hash", args.BlockHash.Hex(), "number", args.BlockNumber) - err = sdb.BuildStateDiffWithIntermediateStateNodes(iterPairs[worker], params, nodeSender, ipldSender, logger, nil) - if err != nil { - logrus.Errorf("buildStateDiff error for worker %d, params %+v", worker, params) - } - }(w) - } - wg.Wait() - close(nodeChan) - close(codeChan) - }() - - for nodeChan != nil || codeChan != nil { - select { - case node, more := <-nodeChan: - if more { - if err := output(node); err != nil { - return err - } - } else { - nodeChan = nil - } - case codeAndCodeHash, more := <-codeChan: - if more { - if err := codeOutput(codeAndCodeHash); err != nil { - return err - } - } else { - codeChan = nil - } - } - } - - return nil -} diff --git a/pkg/builder_test.go b/pkg/builder_test.go deleted file mode 100644 index cc2dc3f..0000000 --- a/pkg/builder_test.go +++ /dev/null @@ -1,3124 +0,0 @@ -// Copyright 2019 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package statediff_test - -import ( - "bytes" - "encoding/json" - "math/big" - "sort" - "testing" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" - sd "github.com/ethereum/go-ethereum/statediff" - "github.com/ethereum/go-ethereum/statediff/indexer/ipld" - "github.com/ethereum/go-ethereum/statediff/indexer/shared" - "github.com/ethereum/go-ethereum/statediff/test_helpers" - sdtypes "github.com/ethereum/go-ethereum/statediff/types" - - statediff "github.com/cerc-io/eth-statediff-service/pkg" -) - -var ( - contractLeafKey []byte - emptyDiffs = make([]sdtypes.StateLeafNode, 0) - emptyStorage = make([]sdtypes.StorageLeafNode, 0) - block0, block1, block2, block3, block4, block5, block6 *types.Block - builder sd.Builder - minerAddress = common.HexToAddress("0x0") - minerLeafKey = test_helpers.AddressToLeafKey(minerAddress) - workerCounts = []uint{0, 1, 2, 4, 8} - - slot0 = common.BigToHash(big.NewInt(0)) - slot1 = common.BigToHash(big.NewInt(1)) - slot2 = common.BigToHash(big.NewInt(2)) - slot3 = common.BigToHash(big.NewInt(3)) - - slot0StorageKey = crypto.Keccak256Hash(slot0[:]) - slot1StorageKey = crypto.Keccak256Hash(slot1[:]) - slot2StorageKey = crypto.Keccak256Hash(slot2[:]) - slot3StorageKey = crypto.Keccak256Hash(slot3[:]) - - slot0StorageValue = common.Hex2Bytes("94703c4b2bd70c169f5717101caee543299fc946c7") // prefixed AccountAddr1 - slot1StorageValue = common.Hex2Bytes("01") - slot2StorageValue = common.Hex2Bytes("09") - slot3StorageValue = common.Hex2Bytes("03") - - slot0StorageLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("390decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - slot0StorageValue, - }) - slot1StorageLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("310e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6"), - slot1StorageValue, - }) - slot2StorageLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("305787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace"), - slot2StorageValue, - }) - slot3StorageLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("32575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b"), - slot3StorageValue, - }) - contractAccountAtBlock2 = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(0), - CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), - Root: crypto.Keccak256Hash(block2StorageBranchRootNode), - } - contractAccountAtBlock2RLP, _ = rlp.EncodeToBytes(contractAccountAtBlock2) - contractAccountAtBlock2LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3114658a74d9cc9f7acf2c5cd696c3494d7c344d78bfec3add0d91ec4e8d1c45"), - contractAccountAtBlock2RLP, - }) - contractAccountAtBlock3 = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(0), - CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), - Root: crypto.Keccak256Hash(block3StorageBranchRootNode), - } - contractAccountAtBlock3RLP, _ = rlp.EncodeToBytes(contractAccountAtBlock3) - contractAccountAtBlock3LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3114658a74d9cc9f7acf2c5cd696c3494d7c344d78bfec3add0d91ec4e8d1c45"), - contractAccountAtBlock3RLP, - }) - contractAccountAtBlock4 = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(0), - CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), - Root: crypto.Keccak256Hash(block4StorageBranchRootNode), - } - contractAccountAtBlock4RLP, _ = rlp.EncodeToBytes(contractAccountAtBlock4) - contractAccountAtBlock4LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3114658a74d9cc9f7acf2c5cd696c3494d7c344d78bfec3add0d91ec4e8d1c45"), - contractAccountAtBlock4RLP, - }) - contractAccountAtBlock5 = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(0), - CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), - Root: crypto.Keccak256Hash(block5StorageBranchRootNode), - } - contractAccountAtBlock5RLP, _ = rlp.EncodeToBytes(contractAccountAtBlock5) - contractAccountAtBlock5LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3114658a74d9cc9f7acf2c5cd696c3494d7c344d78bfec3add0d91ec4e8d1c45"), - contractAccountAtBlock5RLP, - }) - minerAccountAtBlock1 = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(2000002625000000000), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - minerAccountAtBlock1RLP, _ = rlp.EncodeToBytes(minerAccountAtBlock1) - minerAccountAtBlock1LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3380c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312a"), - minerAccountAtBlock1RLP, - }) - minerAccountAtBlock2 = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(4000111203461610525), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - minerAccountAtBlock2RLP, _ = rlp.EncodeToBytes(minerAccountAtBlock2) - minerAccountAtBlock2LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3380c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312a"), - minerAccountAtBlock2RLP, - }) - - account1AtBlock1 = &types.StateAccount{ - Nonce: 0, - Balance: test_helpers.Block1Account1Balance, - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account1AtBlock1RLP, _ = rlp.EncodeToBytes(account1AtBlock1) - account1AtBlock1LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), - account1AtBlock1RLP, - }) - account1AtBlock2 = &types.StateAccount{ - Nonce: 2, - Balance: big.NewInt(999555797000009000), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account1AtBlock2RLP, _ = rlp.EncodeToBytes(account1AtBlock2) - account1AtBlock2LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), - account1AtBlock2RLP, - }) - account1AtBlock5 = &types.StateAccount{ - Nonce: 2, - Balance: big.NewInt(2999586469962854280), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account1AtBlock5RLP, _ = rlp.EncodeToBytes(account1AtBlock5) - account1AtBlock5LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), - account1AtBlock5RLP, - }) - account1AtBlock6 = &types.StateAccount{ - Nonce: 3, - Balance: big.NewInt(2999557977962854280), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account1AtBlock6RLP, _ = rlp.EncodeToBytes(account1AtBlock6) - account1AtBlock6LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), - account1AtBlock6RLP, - }) - account2AtBlock2 = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(1000), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account2AtBlock2RLP, _ = rlp.EncodeToBytes(account2AtBlock2) - account2AtBlock2LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3957f3e2f04a0764c3a0491b175f69926da61efbcc8f61fa1455fd2d2b4cdd45"), - account2AtBlock2RLP, - }) - account2AtBlock3 = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(2000013574009435976), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account2AtBlock3RLP, _ = rlp.EncodeToBytes(account2AtBlock3) - account2AtBlock3LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3957f3e2f04a0764c3a0491b175f69926da61efbcc8f61fa1455fd2d2b4cdd45"), - account2AtBlock3RLP, - }) - account2AtBlock4 = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(4000048088163070348), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account2AtBlock4RLP, _ = rlp.EncodeToBytes(account2AtBlock4) - account2AtBlock4LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3957f3e2f04a0764c3a0491b175f69926da61efbcc8f61fa1455fd2d2b4cdd45"), - account2AtBlock4RLP, - }) - account2AtBlock6 = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(6000063258066544204), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account2AtBlock6RLP, _ = rlp.EncodeToBytes(account2AtBlock6) - account2AtBlock6LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3957f3e2f04a0764c3a0491b175f69926da61efbcc8f61fa1455fd2d2b4cdd45"), - account2AtBlock6RLP, - }) - bankAccountAtBlock0 = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(test_helpers.TestBankFunds.Int64()), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock0RLP, _ = rlp.EncodeToBytes(bankAccountAtBlock0) - bankAccountAtBlock0LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("2000bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock0RLP, - }) - - block1BankBalance = big.NewInt(test_helpers.TestBankFunds.Int64() - test_helpers.BalanceChange10000 - test_helpers.GasFees) - bankAccountAtBlock1 = &types.StateAccount{ - Nonce: 1, - Balance: block1BankBalance, - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock1RLP, _ = rlp.EncodeToBytes(bankAccountAtBlock1) - bankAccountAtBlock1LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock1RLP, - }) - - block2BankBalance = block1BankBalance.Int64() - test_helpers.BalanceChange1Ether - test_helpers.GasFees - bankAccountAtBlock2 = &types.StateAccount{ - Nonce: 2, - Balance: big.NewInt(block2BankBalance), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock2RLP, _ = rlp.EncodeToBytes(bankAccountAtBlock2) - bankAccountAtBlock2LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock2RLP, - }) - bankAccountAtBlock3 = &types.StateAccount{ - Nonce: 3, - Balance: big.NewInt(999914255999990000), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock3RLP, _ = rlp.EncodeToBytes(bankAccountAtBlock3) - bankAccountAtBlock3LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock3RLP, - }) - bankAccountAtBlock4 = &types.StateAccount{ - Nonce: 6, - Balance: big.NewInt(999826859999990000), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock4RLP, _ = rlp.EncodeToBytes(&bankAccountAtBlock4) - bankAccountAtBlock4LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock4RLP, - }) - bankAccountAtBlock5 = &types.StateAccount{ - Nonce: 8, - Balance: big.NewInt(999761283999990000), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock5RLP, _ = rlp.EncodeToBytes(bankAccountAtBlock5) - bankAccountAtBlock5LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock5RLP, - }) - - block1BranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock1LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock1LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account1AtBlock1LeafNode), - []byte{}, - []byte{}, - }) - block2BranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock2LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock2LeafNode), - crypto.Keccak256(contractAccountAtBlock2LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account2AtBlock2LeafNode), - []byte{}, - crypto.Keccak256(account1AtBlock2LeafNode), - []byte{}, - []byte{}, - }) - block3BranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock3LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock2LeafNode), - crypto.Keccak256(contractAccountAtBlock3LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account2AtBlock3LeafNode), - []byte{}, - crypto.Keccak256(account1AtBlock2LeafNode), - []byte{}, - []byte{}, - }) - block4BranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock4LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock2LeafNode), - crypto.Keccak256(contractAccountAtBlock4LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account2AtBlock4LeafNode), - []byte{}, - crypto.Keccak256(account1AtBlock2LeafNode), - []byte{}, - []byte{}, - }) - block5BranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock5LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock2LeafNode), - crypto.Keccak256(contractAccountAtBlock5LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account2AtBlock4LeafNode), - []byte{}, - crypto.Keccak256(account1AtBlock5LeafNode), - []byte{}, - []byte{}, - }) - block6BranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock5LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock2LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account2AtBlock6LeafNode), - []byte{}, - crypto.Keccak256(account1AtBlock6LeafNode), - []byte{}, - []byte{}, - }) - - block2StorageBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - []byte{}, - []byte{}, - crypto.Keccak256(slot0StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(slot1StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - }) - block3StorageBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - []byte{}, - []byte{}, - crypto.Keccak256(slot0StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(slot1StorageLeafNode), - crypto.Keccak256(slot3StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - }) - block4StorageBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - []byte{}, - []byte{}, - crypto.Keccak256(slot0StorageLeafNode), - []byte{}, - crypto.Keccak256(slot2StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - }) - block5StorageBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - []byte{}, - []byte{}, - crypto.Keccak256(slot0StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(slot3StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - }) -) - -func TestBuilder(t *testing.T) { - blocks, chain := test_helpers.MakeChain(3, test_helpers.Genesis, test_helpers.TestChainGen) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block0 = test_helpers.Genesis - block1 = blocks[0] - block2 = blocks[1] - block3 = blocks[2] - params := sd.Params{} - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - { - "testEmptyDiff", - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: emptyDiffs, - }, - }, - { - "testBlock0", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: test_helpers.NullHash, - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock0, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock0LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock0LeafNode)).String(), - Content: bankAccountAtBlock0LeafNode, - }, - }, - }, - }, - { - "testBlock1", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block1.Root(), - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock1, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock1LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: minerAccountAtBlock1, - LeafKey: minerLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock1LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock1, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock1LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block1BranchRootNode)).String(), - Content: block1BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock1LeafNode)).String(), - Content: bankAccountAtBlock1LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock1LeafNode)).String(), - Content: minerAccountAtBlock1LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock1LeafNode)).String(), - Content: account1AtBlock1LeafNode, - }, - }, - }, - }, - { - "testBlock2", - // 1000 transferred from testBankAddress to account1Addr - // 1000 transferred from account1Addr to account2Addr - // account1addr creates a new contract - sd.Args{ - OldStateRoot: block1.Root(), - NewStateRoot: block2.Root(), - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock2, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock2LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: minerAccountAtBlock2, - LeafKey: minerLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock2LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock2, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock2LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock2, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot0StorageValue, - LeafKey: slot0StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - }, - { - Removed: false, - Value: slot1StorageValue, - LeafKey: slot1StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account2AtBlock2, - LeafKey: test_helpers.Account2LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock2LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.RawBinary, test_helpers.CodeHash.Bytes()).String(), - Content: test_helpers.ByteCodeAfterDeployment, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block2BranchRootNode)).String(), - Content: block2BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock2LeafNode)).String(), - Content: bankAccountAtBlock2LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock2LeafNode)).String(), - Content: minerAccountAtBlock2LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock2LeafNode)).String(), - Content: account1AtBlock2LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2LeafNode)).String(), - Content: contractAccountAtBlock2LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block2StorageBranchRootNode)).String(), - Content: block2StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - Content: slot0StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - Content: slot1StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock2LeafNode)).String(), - Content: account2AtBlock2LeafNode, - }, - }, - }, - }, - { - "testBlock3", - //the contract's storage is changed - //and the block is mined by account 2 - sd.Args{ - OldStateRoot: block2.Root(), - NewStateRoot: block3.Root(), - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock3, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock3LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock3, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot3StorageValue, - LeafKey: slot3StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account2AtBlock3, - LeafKey: test_helpers.Account2LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock3LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block3BranchRootNode)).String(), - Content: block3BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock3LeafNode)).String(), - Content: bankAccountAtBlock3LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3LeafNode)).String(), - Content: contractAccountAtBlock3LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3StorageBranchRootNode)).String(), - Content: block3StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - Content: slot3StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock3LeafNode)).String(), - Content: account2AtBlock3LeafNode, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block0.Root().Bytes(), crypto.Keccak256(bankAccountAtBlock0LeafNode)) { - t.Errorf("block0 expected root %x does not match actual root %x", block0.Root().Bytes(), crypto.Keccak256(bankAccountAtBlock0LeafNode)) - } - if !bytes.Equal(block1.Root().Bytes(), crypto.Keccak256(block1BranchRootNode)) { - t.Errorf("block1 expected root %x does not match actual root %x", block1.Root().Bytes(), crypto.Keccak256(block1BranchRootNode)) - } - if !bytes.Equal(block2.Root().Bytes(), crypto.Keccak256(block2BranchRootNode)) { - t.Errorf("block2 expected root %x does not match actual root %x", block2.Root().Bytes(), crypto.Keccak256(block2BranchRootNode)) - } - if !bytes.Equal(block3.Root().Bytes(), crypto.Keccak256(block3BranchRootNode)) { - t.Errorf("block3 expected root %x does not match actual root %x", block3.Root().Bytes(), crypto.Keccak256(block3BranchRootNode)) - } -} - -func TestBuilderWithWatchedAddressList(t *testing.T) { - blocks, chain := test_helpers.MakeChain(3, test_helpers.Genesis, test_helpers.TestChainGen) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block0 = test_helpers.Genesis - block1 = blocks[0] - block2 = blocks[1] - block3 = blocks[2] - params := sd.Params{ - WatchedAddresses: []common.Address{test_helpers.Account1Addr, test_helpers.ContractAddr}, - } - params.ComputeWatchedAddressesLeafPaths() - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - { - "testEmptyDiff", - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: emptyDiffs, - }, - }, - { - "testBlock0", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: test_helpers.NullHash, - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: emptyDiffs, - }, - }, - { - "testBlock1", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block1.Root(), - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock1, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock1LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block1BranchRootNode)).String(), - Content: block1BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock1LeafNode)).String(), - Content: account1AtBlock1LeafNode, - }, - }, - }, - }, - { - "testBlock2", - //1000 transferred from testBankAddress to account1Addr - //1000 transferred from account1Addr to account2Addr - sd.Args{ - OldStateRoot: block1.Root(), - NewStateRoot: block2.Root(), - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock2, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot0StorageValue, - LeafKey: slot0StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - }, - { - Removed: false, - Value: slot1StorageValue, - LeafKey: slot1StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock2, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock2LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.RawBinary, test_helpers.CodeHash.Bytes()).String(), - Content: test_helpers.ByteCodeAfterDeployment, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block2BranchRootNode)).String(), - Content: block2BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2LeafNode)).String(), - Content: contractAccountAtBlock2LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block2StorageBranchRootNode)).String(), - Content: block2StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - Content: slot0StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - Content: slot1StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock2LeafNode)).String(), - Content: account1AtBlock2LeafNode, - }, - }, - }, - }, - { - "testBlock3", - //the contract's storage is changed - //and the block is mined by account 2 - sd.Args{ - OldStateRoot: block2.Root(), - NewStateRoot: block3.Root(), - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock3, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot3StorageValue, - LeafKey: slot3StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block3BranchRootNode)).String(), - Content: block3BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3LeafNode)).String(), - Content: contractAccountAtBlock3LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3StorageBranchRootNode)).String(), - Content: block3StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - Content: slot3StorageLeafNode, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block0.Root().Bytes(), crypto.Keccak256(bankAccountAtBlock0LeafNode)) { - t.Errorf("block0 expected root %x does not match actual root %x", block0.Root().Bytes(), crypto.Keccak256(bankAccountAtBlock0LeafNode)) - } - if !bytes.Equal(block1.Root().Bytes(), crypto.Keccak256(block1BranchRootNode)) { - t.Errorf("block1 expected root %x does not match actual root %x", block1.Root().Bytes(), crypto.Keccak256(block1BranchRootNode)) - } - if !bytes.Equal(block2.Root().Bytes(), crypto.Keccak256(block2BranchRootNode)) { - t.Errorf("block2 expected root %x does not match actual root %x", block2.Root().Bytes(), crypto.Keccak256(block2BranchRootNode)) - } - if !bytes.Equal(block3.Root().Bytes(), crypto.Keccak256(block3BranchRootNode)) { - t.Errorf("block3 expected root %x does not match actual root %x", block3.Root().Bytes(), crypto.Keccak256(block3BranchRootNode)) - } -} - -func TestBuilderWithRemovedAccountAndStorage(t *testing.T) { - blocks, chain := test_helpers.MakeChain(6, test_helpers.Genesis, test_helpers.TestChainGen) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block3 = blocks[2] - block4 = blocks[3] - block5 = blocks[4] - block6 = blocks[5] - params := sd.Params{} - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - // blocks 0-3 are the same as in TestBuilderWithIntermediateNodes - { - "testBlock4", - sd.Args{ - OldStateRoot: block3.Root(), - NewStateRoot: block4.Root(), - BlockNumber: block4.Number(), - BlockHash: block4.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block4.Number(), - BlockHash: block4.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock4, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock4LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock4, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock4LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot2StorageValue, - LeafKey: slot2StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot2StorageLeafNode)).String(), - }, - { - Removed: true, - LeafKey: slot1StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - { - Removed: true, - LeafKey: slot3StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account2AtBlock4, - LeafKey: test_helpers.Account2LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock4LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block4BranchRootNode)).String(), - Content: block4BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock4LeafNode)).String(), - Content: bankAccountAtBlock4LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock4LeafNode)).String(), - Content: contractAccountAtBlock4LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block4StorageBranchRootNode)).String(), - Content: block4StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot2StorageLeafNode)).String(), - Content: slot2StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock4LeafNode)).String(), - Content: account2AtBlock4LeafNode, - }, - }, - }, - }, - { - "testBlock5", - sd.Args{ - OldStateRoot: block4.Root(), - NewStateRoot: block5.Root(), - BlockNumber: block5.Number(), - BlockHash: block5.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block5.Number(), - BlockHash: block5.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock5, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock5LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock5, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock5LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot3StorageValue, - LeafKey: slot3StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - }, - { - Removed: true, - LeafKey: slot2StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock5, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock5LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block5BranchRootNode)).String(), - Content: block5BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock5LeafNode)).String(), - Content: bankAccountAtBlock5LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock5LeafNode)).String(), - Content: contractAccountAtBlock5LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block5StorageBranchRootNode)).String(), - Content: block5StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - Content: slot3StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock5LeafNode)).String(), - Content: account1AtBlock5LeafNode, - }, - }, - }, - }, - { - "testBlock6", - sd.Args{ - OldStateRoot: block5.Root(), - NewStateRoot: block6.Root(), - BlockNumber: block6.Number(), - BlockHash: block6.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block6.Number(), - BlockHash: block6.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: true, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: nil, - LeafKey: contractLeafKey, - CID: shared.RemovedNodeStateCID}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: true, - LeafKey: slot0StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - { - Removed: true, - LeafKey: slot3StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account2AtBlock6, - LeafKey: test_helpers.Account2LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock6LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock6, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock6LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block6BranchRootNode)).String(), - Content: block6BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock6LeafNode)).String(), - Content: account2AtBlock6LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock6LeafNode)).String(), - Content: account1AtBlock6LeafNode, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block4.Root().Bytes(), crypto.Keccak256(block4BranchRootNode)) { - t.Errorf("block4 expected root %x does not match actual root %x", block4.Root().Bytes(), crypto.Keccak256(block4BranchRootNode)) - } - if !bytes.Equal(block5.Root().Bytes(), crypto.Keccak256(block5BranchRootNode)) { - t.Errorf("block5 expected root %x does not match actual root %x", block5.Root().Bytes(), crypto.Keccak256(block5BranchRootNode)) - } - if !bytes.Equal(block6.Root().Bytes(), crypto.Keccak256(block6BranchRootNode)) { - t.Errorf("block6 expected root %x does not match actual root %x", block6.Root().Bytes(), crypto.Keccak256(block6BranchRootNode)) - } -} - -func TestBuilderWithRemovedNonWatchedAccount(t *testing.T) { - blocks, chain := test_helpers.MakeChain(6, test_helpers.Genesis, test_helpers.TestChainGen) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block3 = blocks[2] - block4 = blocks[3] - block5 = blocks[4] - block6 = blocks[5] - params := sd.Params{ - WatchedAddresses: []common.Address{test_helpers.Account1Addr, test_helpers.Account2Addr}, - } - params.ComputeWatchedAddressesLeafPaths() - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - { - "testBlock4", - sd.Args{ - OldStateRoot: block3.Root(), - NewStateRoot: block4.Root(), - BlockNumber: block4.Number(), - BlockHash: block4.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block4.Number(), - BlockHash: block4.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account2AtBlock4, - LeafKey: test_helpers.Account2LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock4LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block4BranchRootNode)).String(), - Content: block4BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock4LeafNode)).String(), - Content: account2AtBlock4LeafNode, - }, - }, - }, - }, - { - "testBlock5", - sd.Args{ - OldStateRoot: block4.Root(), - NewStateRoot: block5.Root(), - BlockNumber: block5.Number(), - BlockHash: block5.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block5.Number(), - BlockHash: block5.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock5, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock5LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block5BranchRootNode)).String(), - Content: block5BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock5LeafNode)).String(), - Content: account1AtBlock5LeafNode, - }, - }, - }, - }, - { - "testBlock6", - sd.Args{ - OldStateRoot: block5.Root(), - NewStateRoot: block6.Root(), - BlockNumber: block6.Number(), - BlockHash: block6.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block6.Number(), - BlockHash: block6.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account2AtBlock6, - LeafKey: test_helpers.Account2LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock6LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock6, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock6LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block6BranchRootNode)).String(), - Content: block6BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account2AtBlock6LeafNode)).String(), - Content: account2AtBlock6LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock6LeafNode)).String(), - Content: account1AtBlock6LeafNode, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block4.Root().Bytes(), crypto.Keccak256(block4BranchRootNode)) { - t.Errorf("block4 expected root %x does not match actual root %x", block4.Root().Bytes(), crypto.Keccak256(block4BranchRootNode)) - } - if !bytes.Equal(block5.Root().Bytes(), crypto.Keccak256(block5BranchRootNode)) { - t.Errorf("block5 expected root %x does not match actual root %x", block5.Root().Bytes(), crypto.Keccak256(block5BranchRootNode)) - } - if !bytes.Equal(block6.Root().Bytes(), crypto.Keccak256(block6BranchRootNode)) { - t.Errorf("block6 expected root %x does not match actual root %x", block6.Root().Bytes(), crypto.Keccak256(block6BranchRootNode)) - } -} - -func TestBuilderWithRemovedWatchedAccount(t *testing.T) { - blocks, chain := test_helpers.MakeChain(6, test_helpers.Genesis, test_helpers.TestChainGen) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block3 = blocks[2] - block4 = blocks[3] - block5 = blocks[4] - block6 = blocks[5] - params := sd.Params{ - WatchedAddresses: []common.Address{test_helpers.Account1Addr, test_helpers.ContractAddr}, - } - params.ComputeWatchedAddressesLeafPaths() - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - { - "testBlock4", - sd.Args{ - OldStateRoot: block3.Root(), - NewStateRoot: block4.Root(), - BlockNumber: block4.Number(), - BlockHash: block4.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block4.Number(), - BlockHash: block4.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock4, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock4LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - LeafKey: slot2StorageKey.Bytes(), - Value: slot2StorageValue, - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot2StorageLeafNode)).String(), - }, - { - Removed: true, - LeafKey: slot1StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - { - Removed: true, - LeafKey: slot3StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block4BranchRootNode)).String(), - Content: block4BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock4LeafNode)).String(), - Content: contractAccountAtBlock4LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block4StorageBranchRootNode)).String(), - Content: block4StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot2StorageLeafNode)).String(), - Content: slot2StorageLeafNode, - }, - }, - }, - }, - { - "testBlock5", - sd.Args{ - OldStateRoot: block4.Root(), - NewStateRoot: block5.Root(), - BlockNumber: block5.Number(), - BlockHash: block5.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block5.Number(), - BlockHash: block5.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock5, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock5LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - LeafKey: slot3StorageKey.Bytes(), - Value: slot3StorageValue, - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - }, - { - Removed: true, - LeafKey: slot2StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock5, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock5LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block5BranchRootNode)).String(), - Content: block5BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock5LeafNode)).String(), - Content: contractAccountAtBlock5LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block5StorageBranchRootNode)).String(), - Content: block5StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot3StorageLeafNode)).String(), - Content: slot3StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock5LeafNode)).String(), - Content: account1AtBlock5LeafNode, - }, - }, - }, - }, - { - "testBlock6", - sd.Args{ - OldStateRoot: block5.Root(), - NewStateRoot: block6.Root(), - BlockNumber: block6.Number(), - BlockHash: block6.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block6.Number(), - BlockHash: block6.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: true, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: nil, - LeafKey: contractLeafKey, - CID: shared.RemovedNodeStateCID}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: true, - LeafKey: slot0StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - { - Removed: true, - LeafKey: slot3StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - }, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock6, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock6LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block6BranchRootNode)).String(), - Content: block6BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock6LeafNode)).String(), - Content: account1AtBlock6LeafNode, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block4.Root().Bytes(), crypto.Keccak256(block4BranchRootNode)) { - t.Errorf("block4 expected root %x does not match actual root %x", block4.Root().Bytes(), crypto.Keccak256(block4BranchRootNode)) - } - if !bytes.Equal(block5.Root().Bytes(), crypto.Keccak256(block5BranchRootNode)) { - t.Errorf("block5 expected root %x does not match actual root %x", block5.Root().Bytes(), crypto.Keccak256(block5BranchRootNode)) - } - if !bytes.Equal(block6.Root().Bytes(), crypto.Keccak256(block6BranchRootNode)) { - t.Errorf("block6 expected root %x does not match actual root %x", block6.Root().Bytes(), crypto.Keccak256(block6BranchRootNode)) - } -} - -var ( - slot00StorageValue = common.Hex2Bytes("9471562b71999873db5b286df957af199ec94617f7") // prefixed TestBankAddress - - slot00StorageLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("390decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563"), - slot00StorageValue, - }) - - contractAccountAtBlock01 = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(0), - CodeHash: common.HexToHash("0xaaea5efba4fd7b45d7ec03918ac5d8b31aa93b48986af0e6b591f0f087c80127").Bytes(), - Root: crypto.Keccak256Hash(block01StorageBranchRootNode), - } - contractAccountAtBlock01RLP, _ = rlp.EncodeToBytes(contractAccountAtBlock01) - contractAccountAtBlock01LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3cb2583748c26e89ef19c2a8529b05a270f735553b4d44b6f2a1894987a71c8b"), - contractAccountAtBlock01RLP, - }) - - bankAccountAtBlock01 = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(3999629697375000000), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock01RLP, _ = rlp.EncodeToBytes(bankAccountAtBlock01) - bankAccountAtBlock01LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock01RLP, - }) - bankAccountAtBlock02 = &types.StateAccount{ - Nonce: 2, - Balance: big.NewInt(5999607323457344852), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock02RLP, _ = rlp.EncodeToBytes(bankAccountAtBlock02) - bankAccountAtBlock02LeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("2000bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock02RLP, - }) - - block01BranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256Hash(bankAccountAtBlock01LeafNode), - crypto.Keccak256Hash(contractAccountAtBlock01LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - }) - - block01StorageBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - []byte{}, - []byte{}, - crypto.Keccak256(slot00StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(slot1StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - }) -) - -func TestBuilderWithMovedAccount(t *testing.T) { - blocks, chain := test_helpers.MakeChain(2, test_helpers.Genesis, test_helpers.TestSelfDestructChainGen) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block0 = test_helpers.Genesis - block1 = blocks[0] - block2 = blocks[1] - params := sd.Params{} - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - { - "testBlock1", - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block1.Root(), - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock01, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock01LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock01, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock01LeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - LeafKey: slot0StorageKey.Bytes(), - Value: slot00StorageValue, - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot00StorageLeafNode)).String(), - }, - { - Removed: false, - LeafKey: slot1StorageKey.Bytes(), - Value: slot1StorageValue, - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.RawBinary, test_helpers.CodeHash.Bytes()).String(), - Content: test_helpers.ByteCodeAfterDeployment, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block01BranchRootNode)).String(), - Content: block01BranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock01LeafNode)).String(), - Content: bankAccountAtBlock01LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock01LeafNode)).String(), - Content: contractAccountAtBlock01LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block01StorageBranchRootNode)).String(), - Content: block01StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot00StorageLeafNode)).String(), - Content: slot00StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - Content: slot1StorageLeafNode, - }, - }, - }, - }, - { - "testBlock2", - sd.Args{ - OldStateRoot: block1.Root(), - NewStateRoot: block2.Root(), - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock02, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock02LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: true, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: nil, - LeafKey: contractLeafKey, - CID: shared.RemovedNodeStateCID}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: true, - LeafKey: slot0StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - { - Removed: true, - LeafKey: slot1StorageKey.Bytes(), - CID: shared.RemovedNodeStorageCID, - Value: []byte{}, - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock02LeafNode)).String(), - Content: bankAccountAtBlock02LeafNode, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block1.Root().Bytes(), crypto.Keccak256(block01BranchRootNode)) { - t.Errorf("block01 expected root %x does not match actual root %x", block1.Root().Bytes(), crypto.Keccak256(block01BranchRootNode)) - } - if !bytes.Equal(block2.Root().Bytes(), crypto.Keccak256(bankAccountAtBlock02LeafNode)) { - t.Errorf("block02 expected root %x does not match actual root %x", block2.Root().Bytes(), crypto.Keccak256(bankAccountAtBlock02LeafNode)) - } -} - -/* -pragma solidity ^0.5.10; - -contract test { - address payable owner; - - modifier onlyOwner { - require( - msg.sender == owner, - "Only owner can call this function." - ); - _; - } - - uint256[100] data; - - constructor() public { - owner = msg.sender; - data = [1]; - } - - function Put(uint256 addr, uint256 value) public { - data[addr] = value; - } - - function close() public onlyOwner { //onlyOwner is custom modifier - selfdestruct(owner); // `owner` is the owners address - } -} -*/ - -var ( - b = big.NewInt(0).Sub(test_helpers.TestBIGBankFunds, test_helpers.BalanceChangeBIG) - block1BankBigBalance = big.NewInt(0).Sub(b, big.NewInt(test_helpers.GasFees2)) - bankAccountAtBlock1b = &types.StateAccount{ - Nonce: 1, - Balance: block1BankBigBalance, - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock1bRLP, _ = rlp.EncodeToBytes(bankAccountAtBlock1b) - bankAccountAtBlock1bLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock1bRLP, - }) - - account1AtBlock1b = &types.StateAccount{ - Nonce: 0, - Balance: test_helpers.Block1bAccount1Balance, - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account1AtBlock1bRLP, _ = rlp.EncodeToBytes(account1AtBlock1b) - account1AtBlock1bLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), - account1AtBlock1bRLP, - }) - - account1AtBlock2bBalance, _ = big.NewInt(0).SetString("1999999999999999999999999761539571000000000", 10) - account1AtBlock2b = &types.StateAccount{ - Nonce: 1, - Balance: account1AtBlock2bBalance, - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - account1AtBlock2bRLP, _ = rlp.EncodeToBytes(account1AtBlock2b) - account1AtBlock2bLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3926db69aaced518e9b9f0f434a473e7174109c943548bb8f23be41ca76d9ad2"), - account1AtBlock2bRLP, - }) - - minerAccountAtBlock2b = &types.StateAccount{ - Nonce: 0, - Balance: big.NewInt(4055891787808414571), - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - minerAccountAtBlock2bRLP, _ = rlp.EncodeToBytes(minerAccountAtBlock2b) - minerAccountAtBlock2bLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3380c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312a"), - minerAccountAtBlock2bRLP, - }) - - contractAccountAtBlock2b = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(0), - CodeHash: test_helpers.CodeHashForInternalizedLeafNode.Bytes(), - Root: crypto.Keccak256Hash(block2StorageBranchRootNode), - } - contractAccountAtBlock2bRLP, _ = rlp.EncodeToBytes(contractAccountAtBlock2b) - contractAccountAtBlock2bLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3d7e14f1723fa19b5d6d9f8b86b49acefbc9c400bf4ed686c10d6b6467fc5b3a"), - contractAccountAtBlock2bRLP, - }) - - bankAccountAtBlock3bBalance, _ = big.NewInt(0).SetString("18000000000000000000000001999920365757724976", 10) - bankAccountAtBlock3b = &types.StateAccount{ - Nonce: 3, - Balance: bankAccountAtBlock3bBalance, - CodeHash: test_helpers.NullCodeHash.Bytes(), - Root: test_helpers.EmptyContractRoot, - } - bankAccountAtBlock3bRLP, _ = rlp.EncodeToBytes(bankAccountAtBlock3b) - bankAccountAtBlock3bLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("30bf49f440a1cd0527e4d06e2765654c0f56452257516d793a9b8d604dcfdf2a"), - bankAccountAtBlock3bRLP, - }) - - contractAccountAtBlock3b = &types.StateAccount{ - Nonce: 1, - Balance: big.NewInt(0), - CodeHash: test_helpers.CodeHashForInternalizedLeafNode.Bytes(), - Root: crypto.Keccak256Hash(block3bStorageBranchRootNode), - } - contractAccountAtBlock3bRLP, _ = rlp.EncodeToBytes(contractAccountAtBlock3b) - contractAccountAtBlock3bLeafNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("3d7e14f1723fa19b5d6d9f8b86b49acefbc9c400bf4ed686c10d6b6467fc5b3a"), - contractAccountAtBlock3bRLP, - }) - - slot40364 = common.BigToHash(big.NewInt(40364)) - slot105566 = common.BigToHash(big.NewInt(105566)) - - slot40364StorageValue = common.Hex2Bytes("01") - slot105566StorageValue = common.Hex2Bytes("02") - - slot40364StorageKey = crypto.Keccak256Hash(slot40364[:]) - slot105566StorageKey = crypto.Keccak256Hash(slot105566[:]) - - slot40364StorageInternalLeafNode = []interface{}{ - common.Hex2Bytes("3077bbc951a04529defc15da8c06e427cde0d7a1499c50975bbe8aab"), - slot40364StorageValue, - } - slot105566StorageInternalLeafNode = []interface{}{ - common.Hex2Bytes("3c62586c18bf1ecfda161ced374b7a894630e2db426814c24e5d42af"), - slot105566StorageValue, - } - - block3bStorageBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - []byte{}, - []byte{}, - crypto.Keccak256(slot0StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(slot1StorageLeafNode), - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(block3bStorageExtensionNode), - []byte{}, - }) - - block3bStorageExtensionNode, _ = rlp.EncodeToBytes(&[]interface{}{ - common.Hex2Bytes("1291631c"), - crypto.Keccak256(block3bStorageBranchNodeWithInternalLeaves), - }) - - block3bStorageBranchNodeWithInternalLeaves, _ = rlp.EncodeToBytes(&[]interface{}{ - slot105566StorageInternalLeafNode, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - slot40364StorageInternalLeafNode, - []byte{}, - []byte{}, - []byte{}, - }) - - block1bBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock1bLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock1LeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account1AtBlock1bLeafNode), - []byte{}, - []byte{}, - }) - - block2bBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock1bLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock2bLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account1AtBlock2bLeafNode), - crypto.Keccak256(contractAccountAtBlock2bLeafNode), - []byte{}, - }) - - block3bBranchRootNode, _ = rlp.EncodeToBytes(&[]interface{}{ - crypto.Keccak256(bankAccountAtBlock3bLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(minerAccountAtBlock2bLeafNode), - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - []byte{}, - crypto.Keccak256(account1AtBlock2bLeafNode), - crypto.Keccak256(contractAccountAtBlock3bLeafNode), - []byte{}, - }) -) - -func TestBuilderWithInternalizedLeafNode(t *testing.T) { - blocks, chain := test_helpers.MakeChain(3, test_helpers.GenesisForInternalLeafNodeTest, test_helpers.TestChainGenWithInternalLeafNode) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block0 = test_helpers.Genesis - block1 = blocks[0] - block2 = blocks[1] - block3 = blocks[2] - params := sd.Params{} - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - { - "testEmptyDiff", - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: emptyDiffs, - }, - }, - { - "testBlock0", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: test_helpers.NullHash, - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock0, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock0LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock0LeafNode)).String(), - Content: bankAccountAtBlock0LeafNode, - }, - }, - }, - }, - { - "testBlock1", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block1.Root(), - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock1b, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock1bLeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: minerAccountAtBlock1, - LeafKey: minerLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock1LeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock1b, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock1bLeafNode)).String()}, - StorageDiff: emptyStorage, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block1bBranchRootNode)).String(), - Content: block1bBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock1bLeafNode)).String(), - Content: bankAccountAtBlock1bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock1LeafNode)).String(), - Content: minerAccountAtBlock1LeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock1bLeafNode)).String(), - Content: account1AtBlock1bLeafNode, - }, - }, - }, - }, - { - "testBlock2", - // 1000 transferred from testBankAddress to account1Addr - // 1000 transferred from account1Addr to account2Addr - // account1addr creates a new contract - sd.Args{ - OldStateRoot: block1.Root(), - NewStateRoot: block2.Root(), - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: minerAccountAtBlock2b, - LeafKey: minerLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock2bLeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: account1AtBlock2b, - LeafKey: test_helpers.Account1LeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock2bLeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock2b, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2bLeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot0StorageValue, - LeafKey: slot0StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - }, - { - Removed: false, - Value: slot1StorageValue, - LeafKey: slot1StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.RawBinary, test_helpers.CodeHashForInternalizedLeafNode.Bytes()).String(), - Content: test_helpers.ByteCodeAfterDeploymentForInternalLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block2bBranchRootNode)).String(), - Content: block2bBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(minerAccountAtBlock2bLeafNode)).String(), - Content: minerAccountAtBlock2bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(account1AtBlock2bLeafNode)).String(), - Content: account1AtBlock2bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2bLeafNode)).String(), - Content: contractAccountAtBlock2bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block2StorageBranchRootNode)).String(), - Content: block2StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - Content: slot0StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - Content: slot1StorageLeafNode, - }, - }, - }, - }, - { - "testBlock3", - //the contract's storage is changed - //and the block is mined by account 2 - sd.Args{ - OldStateRoot: block2.Root(), - NewStateRoot: block3.Root(), - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: bankAccountAtBlock3b, - LeafKey: test_helpers.BankLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock3bLeafNode)).String()}, - StorageDiff: emptyStorage, - }, - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock3b, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3bLeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot105566StorageValue, - LeafKey: slot105566StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchNodeWithInternalLeaves)).String(), - }, - { - Removed: false, - Value: slot40364StorageValue, - LeafKey: slot40364StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchNodeWithInternalLeaves)).String(), - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block3bBranchRootNode)).String(), - Content: block3bBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(bankAccountAtBlock3bLeafNode)).String(), - Content: bankAccountAtBlock3bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3bLeafNode)).String(), - Content: contractAccountAtBlock3bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchRootNode)).String(), - Content: block3bStorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageExtensionNode)).String(), - Content: block3bStorageExtensionNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchNodeWithInternalLeaves)).String(), - Content: block3bStorageBranchNodeWithInternalLeaves, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block1.Root().Bytes(), crypto.Keccak256(block1bBranchRootNode)) { - t.Errorf("block1 expected root %x does not match actual root %x", block1.Root().Bytes(), crypto.Keccak256(block1bBranchRootNode)) - } - if !bytes.Equal(block2.Root().Bytes(), crypto.Keccak256(block2bBranchRootNode)) { - t.Errorf("block2 expected root %x does not match actual root %x", block2.Root().Bytes(), crypto.Keccak256(block2bBranchRootNode)) - } - if !bytes.Equal(block3.Root().Bytes(), crypto.Keccak256(block3bBranchRootNode)) { - t.Errorf("block3 expected root %x does not match actual root %x", block3.Root().Bytes(), crypto.Keccak256(block3bBranchRootNode)) - } -} - -func TestBuilderWithInternalizedLeafNodeAndWatchedAddress(t *testing.T) { - blocks, chain := test_helpers.MakeChain(3, test_helpers.GenesisForInternalLeafNodeTest, test_helpers.TestChainGenWithInternalLeafNode) - contractLeafKey = test_helpers.AddressToLeafKey(test_helpers.ContractAddr) - defer chain.Stop() - block0 = test_helpers.Genesis - block1 = blocks[0] - block2 = blocks[1] - block3 = blocks[2] - params := sd.Params{ - WatchedAddresses: []common.Address{ - test_helpers.ContractAddr, - }, - } - params.ComputeWatchedAddressesLeafPaths() - - var tests = []struct { - name string - startingArguments sd.Args - expected *sdtypes.StateObject - }{ - { - "testEmptyDiff", - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: emptyDiffs, - }, - }, - { - "testBlock0", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: test_helpers.NullHash, - NewStateRoot: block0.Root(), - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block0.Number(), - BlockHash: block0.Hash(), - Nodes: []sdtypes.StateLeafNode{}, - IPLDs: []sdtypes.IPLD{}, // there's some kind of weird behavior where if our root node is a leaf node - // even though it is along the path to the watched leaf (necessarily, as it is the root) it doesn't get included - // unconsequential, but kinda odd. - }, - }, - { - "testBlock1", - //10000 transferred from testBankAddress to account1Addr - sd.Args{ - OldStateRoot: block0.Root(), - NewStateRoot: block1.Root(), - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block1.Number(), - BlockHash: block1.Hash(), - Nodes: []sdtypes.StateLeafNode{}, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block1bBranchRootNode)).String(), - Content: block1bBranchRootNode, - }, - }, - }, - }, - { - "testBlock2", - // 1000 transferred from testBankAddress to account1Addr - // 1000 transferred from account1Addr to account2Addr - // account1addr creates a new contract - sd.Args{ - OldStateRoot: block1.Root(), - NewStateRoot: block2.Root(), - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block2.Number(), - BlockHash: block2.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock2b, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2bLeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot0StorageValue, - LeafKey: slot0StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - }, - { - Removed: false, - Value: slot1StorageValue, - LeafKey: slot1StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.RawBinary, test_helpers.CodeHashForInternalizedLeafNode.Bytes()).String(), - Content: test_helpers.ByteCodeAfterDeploymentForInternalLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block2bBranchRootNode)).String(), - Content: block2bBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock2bLeafNode)).String(), - Content: contractAccountAtBlock2bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block2StorageBranchRootNode)).String(), - Content: block2StorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot0StorageLeafNode)).String(), - Content: slot0StorageLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(slot1StorageLeafNode)).String(), - Content: slot1StorageLeafNode, - }, - }, - }, - }, - { - "testBlock3", - //the contract's storage is changed - //and the block is mined by account 2 - sd.Args{ - OldStateRoot: block2.Root(), - NewStateRoot: block3.Root(), - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - }, - &sdtypes.StateObject{ - BlockNumber: block3.Number(), - BlockHash: block3.Hash(), - Nodes: []sdtypes.StateLeafNode{ - { - Removed: false, - AccountWrapper: struct { - Account *types.StateAccount - LeafKey []byte - CID string - }{ - Account: contractAccountAtBlock3b, - LeafKey: contractLeafKey, - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3bLeafNode)).String()}, - StorageDiff: []sdtypes.StorageLeafNode{ - { - Removed: false, - Value: slot105566StorageValue, - LeafKey: slot105566StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchNodeWithInternalLeaves)).String(), - }, - { - Removed: false, - Value: slot40364StorageValue, - LeafKey: slot40364StorageKey.Bytes(), - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchNodeWithInternalLeaves)).String(), - }, - }, - }, - }, - IPLDs: []sdtypes.IPLD{ - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(block3bBranchRootNode)).String(), - Content: block3bBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStateTrie, crypto.Keccak256(contractAccountAtBlock3bLeafNode)).String(), - Content: contractAccountAtBlock3bLeafNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchRootNode)).String(), - Content: block3bStorageBranchRootNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageExtensionNode)).String(), - Content: block3bStorageExtensionNode, - }, - { - CID: ipld.Keccak256ToCid(ipld.MEthStorageTrie, crypto.Keccak256(block3bStorageBranchNodeWithInternalLeaves)).String(), - Content: block3bStorageBranchNodeWithInternalLeaves, - }, - }, - }, - }, - } - - for _, workers := range workerCounts { - builder, _ = statediff.NewBuilder(chain.StateCache(), workers) - for _, test := range tests { - diff, err := builder.BuildStateDiffObject(test.startingArguments, params) - if err != nil { - t.Error(err) - } - receivedStateDiffRlp, err := rlp.EncodeToBytes(&diff) - if err != nil { - t.Error(err) - } - expectedStateDiffRlp, err := rlp.EncodeToBytes(test.expected) - if err != nil { - t.Error(err) - } - sort.Slice(receivedStateDiffRlp, func(i, j int) bool { return receivedStateDiffRlp[i] < receivedStateDiffRlp[j] }) - sort.Slice(expectedStateDiffRlp, func(i, j int) bool { return expectedStateDiffRlp[i] < expectedStateDiffRlp[j] }) - if !bytes.Equal(receivedStateDiffRlp, expectedStateDiffRlp) { - actual, err := json.Marshal(diff) - if err != nil { - t.Error(err) - } - expected, err := json.Marshal(test.expected) - if err != nil { - t.Error(err) - } - t.Logf("Test failed: %s", test.name) - t.Errorf("actual state diff: %s\r\n\r\n\r\nexpected state diff: %s", actual, expected) - } - } - } - - // Let's also confirm that our root state nodes form the state root hash in the headers - if !bytes.Equal(block1.Root().Bytes(), crypto.Keccak256(block1bBranchRootNode)) { - t.Errorf("block1 expected root %x does not match actual root %x", block1.Root().Bytes(), crypto.Keccak256(block1bBranchRootNode)) - } - if !bytes.Equal(block2.Root().Bytes(), crypto.Keccak256(block2bBranchRootNode)) { - t.Errorf("block2 expected root %x does not match actual root %x", block2.Root().Bytes(), crypto.Keccak256(block2bBranchRootNode)) - } - if !bytes.Equal(block3.Root().Bytes(), crypto.Keccak256(block3bBranchRootNode)) { - t.Errorf("block3 expected root %x does not match actual root %x", block3.Root().Bytes(), crypto.Keccak256(block3bBranchRootNode)) - } -} - -/* -pragma solidity ^0.5.10; - -contract test { - address payable owner; - - modifier onlyOwner { - require( - msg.sender == owner, - "Only owner can call this function." - ); - _; - } - - uint256[105566] data; - - constructor() public { - owner = msg.sender; - data = [1]; - } - - function Put(uint256 addr, uint256 value) public { - data[addr] = value; - } - - function close() public onlyOwner { //onlyOwner is custom modifier - selfdestruct(owner); // `owner` is the owners address - } -} -*/ diff --git a/pkg/config.go b/pkg/config.go index 318ffc1..211af44 100644 --- a/pkg/config.go +++ b/pkg/config.go @@ -1,7 +1,7 @@ package statediff -// Config holds config params for the statediffing service -type Config struct { +// ServiceConfig holds config params for the statediffing service +type ServiceConfig struct { ServiceWorkers uint TrieWorkers uint WorkerQueueSize uint diff --git a/pkg/prom/db_stats_collector.go b/pkg/prom/db_stats_collector.go index df98e8a..62e3be5 100644 --- a/pkg/prom/db_stats_collector.go +++ b/pkg/prom/db_stats_collector.go @@ -19,7 +19,7 @@ package prom import ( "github.com/prometheus/client_golang/prometheus" - dbmetrics "github.com/ethereum/go-ethereum/statediff/indexer/database/metrics" + dbmetrics "github.com/cerc-io/plugeth-statediff/indexer/database/metrics" ) const ( diff --git a/pkg/reader.go b/pkg/reader.go index d69b9fd..21e506b 100644 --- a/pkg/reader.go +++ b/pkg/reader.go @@ -56,23 +56,29 @@ type LvLDBReaderConfig struct { DBCacheSize int } -// NewLvlDBReader creates a new Read using LevelDB +// NewLvlDBReader creates a new Reader using LevelDB func NewLvlDBReader(conf LvLDBReaderConfig) (*LvlDBReader, error) { var edb ethdb.Database var err error - if conf.Mode == "local" { - kvdb, _ := rawdb.NewLevelDBDatabase(conf.Path, conf.DBCacheSize, 256, "eth-statediff-service", true) - edb, err = rawdb.NewDatabaseWithFreezer(kvdb, conf.AncientPath, "eth-statediff-service", true) - } + switch conf.Mode { + case "local": + edb, err = rawdb.NewLevelDBDatabase(conf.Path, conf.DBCacheSize, 256, "eth-statediff-service", true) + if err != nil { + return nil, err + } - if conf.Mode == "remote" { + edb, err = rawdb.NewDatabaseWithFreezer(edb, conf.AncientPath, "eth-statediff-service", true) + if err != nil { + return nil, err + } + case "remote": edb, err = client.NewDatabaseClient(conf.Url) + if err != nil { + return nil, err + } } - if err != nil { - return nil, err - } return &LvlDBReader{ ethDB: edb, stateDB: state.NewDatabaseWithConfig(edb, conf.TrieConfig), @@ -84,11 +90,11 @@ func NewLvlDBReader(conf LvLDBReaderConfig) (*LvlDBReader, error) { func (ldr *LvlDBReader) GetBlockByHash(hash common.Hash) (*types.Block, error) { height := rawdb.ReadHeaderNumber(ldr.ethDB, hash) if height == nil { - return nil, fmt.Errorf("unable to read header height for header hash %s", hash.String()) + return nil, fmt.Errorf("unable to read header height for header hash %s", hash) } block := rawdb.ReadBlock(ldr.ethDB, hash, *height) if block == nil { - return nil, fmt.Errorf("unable to read block at height %d hash %s", *height, hash.String()) + return nil, fmt.Errorf("unable to read block at height %d hash %s", *height, hash) } return block, nil } @@ -97,7 +103,7 @@ func (ldr *LvlDBReader) GetBlockByNumber(number uint64) (*types.Block, error) { hash := rawdb.ReadCanonicalHash(ldr.ethDB, number) block := rawdb.ReadBlock(ldr.ethDB, hash, number) if block == nil { - return nil, fmt.Errorf("unable to read block at height %d hash %s", number, hash.String()) + return nil, fmt.Errorf("unable to read block at height %d hash %s", number, hash) } return block, nil } @@ -106,11 +112,11 @@ func (ldr *LvlDBReader) GetBlockByNumber(number uint64) (*types.Block, error) { func (ldr *LvlDBReader) GetReceiptsByHash(hash common.Hash) (types.Receipts, error) { number := rawdb.ReadHeaderNumber(ldr.ethDB, hash) if number == nil { - return nil, fmt.Errorf("unable to read header height for header hash %s", hash.String()) + return nil, fmt.Errorf("unable to read header height for header hash %s", hash) } receipts := rawdb.ReadReceipts(ldr.ethDB, hash, *number, ldr.chainConfig) if receipts == nil { - return nil, fmt.Errorf("unable to read receipts at height %d hash %s", number, hash.String()) + return nil, fmt.Errorf("unable to read receipts at height %d hash %s", number, hash) } return receipts, nil } @@ -119,11 +125,11 @@ func (ldr *LvlDBReader) GetReceiptsByHash(hash common.Hash) (types.Receipts, err func (ldr *LvlDBReader) GetTdByHash(hash common.Hash) (*big.Int, error) { number := rawdb.ReadHeaderNumber(ldr.ethDB, hash) if number == nil { - return nil, fmt.Errorf("unable to read header height for header hash %s", hash.String()) + return nil, fmt.Errorf("unable to read header height for header hash %s", hash) } td := rawdb.ReadTd(ldr.ethDB, hash, *number) if td == nil { - return nil, fmt.Errorf("unable to read total difficulty at height %d hash %s", number, hash.String()) + return nil, fmt.Errorf("unable to read total difficulty at height %d hash %s", number, hash) } return td, nil } diff --git a/pkg/rpc/ipc.go b/pkg/rpc/ipc.go index 57c29a5..3dd8a1b 100644 --- a/pkg/rpc/ipc.go +++ b/pkg/rpc/ipc.go @@ -79,7 +79,7 @@ func StartIPCEndpoint(ipcEndpoint string, apis []rpc.API) (net.Listener, *rpc.Se if err := handler.RegisterName(api.Namespace, api.Service); err != nil { return nil, nil, err } - log.Debug("IPC registered", "namespace", api.Namespace) + log.WithField("namespace", api.Namespace).Debug("IPC server registered") } // All APIs registered, start the IPC listener. listener, err := ipcListen(ipcEndpoint) diff --git a/pkg/service.go b/pkg/service.go index bde2a9d..6785079 100644 --- a/pkg/service.go +++ b/pkg/service.go @@ -22,15 +22,15 @@ import ( "sync" "time" + "github.com/cerc-io/plugeth-statediff" + "github.com/cerc-io/plugeth-statediff/adapt" + "github.com/cerc-io/plugeth-statediff/indexer/interfaces" + sdtypes "github.com/cerc-io/plugeth-statediff/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" - sd "github.com/ethereum/go-ethereum/statediff" - "github.com/ethereum/go-ethereum/statediff/indexer/interfaces" - sdtypes "github.com/ethereum/go-ethereum/statediff/types" "github.com/sirupsen/logrus" "github.com/cerc-io/eth-statediff-service/pkg/prom" @@ -38,33 +38,10 @@ import ( const defaultQueueSize = 1024 -// StateDiffService is the state-diffing service interface -type StateDiffService interface { - // Lifecycle Start() and Stop() - node.Lifecycle - // APIs and Protocols() interface for node service registration - APIs() []rpc.API - Protocols() []p2p.Protocol - // Loop is the main event loop for processing state diffs - Loop(wg *sync.WaitGroup) error - // Run is a one-off command to run on a predefined set of ranges - Run(ranges []RangeRequest, parallel bool) error - // StateDiffAt method to get state diff object at specific block - StateDiffAt(blockNumber uint64, params sd.Params) (*sd.Payload, error) - // StateDiffFor method to get state diff object at specific block - StateDiffFor(blockHash common.Hash, params sd.Params) (*sd.Payload, error) - // WriteStateDiffAt method to write state diff object directly to DB - WriteStateDiffAt(blockNumber uint64, params sd.Params) error - // WriteStateDiffFor method to get state trie object at specific block - WriteStateDiffFor(blockHash common.Hash, params sd.Params) error - // WriteStateDiffsInRange method to wrtie state diff objects within the range directly to the DB - WriteStateDiffsInRange(start, stop uint64, params sd.Params) error -} - // Service is the underlying struct for the state diffing service type Service struct { // Used to build the state diff objects - Builder sd.Builder + builder statediff.Builder // Used to read data from LevelDB lvlDBReader Reader // Used to signal shutdown of the service @@ -80,22 +57,20 @@ type Service struct { } // NewStateDiffService creates a new Service -func NewStateDiffService(lvlDBReader Reader, indexer interfaces.StateDiffIndexer, conf Config) (*Service, error) { - b, err := NewBuilder(lvlDBReader.StateDB(), conf.TrieWorkers) - if err != nil { - return nil, err - } +func NewStateDiffService(lvlDBReader Reader, indexer interfaces.StateDiffIndexer, conf ServiceConfig) *Service { + builder := statediff.NewBuilder(adapt.GethStateView(lvlDBReader.StateDB())) + builder.SetSubtrieWorkers(conf.TrieWorkers) if conf.WorkerQueueSize == 0 { conf.WorkerQueueSize = defaultQueueSize } return &Service{ lvlDBReader: lvlDBReader, - Builder: b, + builder: builder, indexer: indexer, workers: conf.ServiceWorkers, queue: make(chan RangeRequest, conf.WorkerQueueSize), preruns: conf.PreRuns, - }, nil + } } // Protocols exports the services p2p protocols, this service has none @@ -115,7 +90,7 @@ func (sds *Service) APIs() []rpc.API { } } -func segmentRange(workers, start, stop uint64, params sd.Params) []RangeRequest { +func segmentRange(workers, start, stop uint64, params statediff.Params) []RangeRequest { segmentSize := ((stop - start) + 1) / workers remainder := ((stop - start) + 1) % workers numOfSegments := workers @@ -214,25 +189,24 @@ func (sds *Service) Loop(wg *sync.WaitGroup) error { for { select { case blockRange := <-sds.queue: - logrus.Infof("service worker %d received range (%d, %d) off of work queue, beginning processing", id, blockRange.Start, blockRange.Stop) + log := logrus.WithField("range", blockRange).WithField("worker", id) + log.Debug("processing range") prom.DecQueuedRanges() for j := blockRange.Start; j <= blockRange.Stop; j++ { if err := sds.WriteStateDiffAt(j, blockRange.Params); err != nil { - logrus.Errorf("service worker %d error writing statediff at height %d in range (%d, %d) : %v", id, j, blockRange.Start, blockRange.Stop, err) + log.Errorf("error writing statediff at block %d: %v", j, err) } select { case <-sds.quitChan: - logrus.Infof("closing service worker %d\n"+ - "working in range (%d, %d)\n"+ - "last processed height: %d", id, blockRange.Start, blockRange.Stop, j) + log.Infof("closing service worker (last processed block: %d)", j) return default: - logrus.Infof("service worker %d finished processing statediff height %d in range (%d, %d)", id, j, blockRange.Start, blockRange.Stop) + log.Infof("Finished processing block %d", j) } } - logrus.Infof("service worker %d finished processing range (%d, %d)", id, blockRange.Start, blockRange.Stop) + log.Debugf("Finished processing range") case <-sds.quitChan: - logrus.Infof("closing the statediff service loop worker %d", id) + logrus.Debugf("closing the statediff service loop worker %d", id) return } } @@ -249,7 +223,7 @@ func (sds *Service) Loop(wg *sync.WaitGroup) error { // StateDiffAt returns a state diff object payload at the specific blockheight // This operation cannot be performed back past the point of db pruning; it requires an archival node for historical data -func (sds *Service) StateDiffAt(blockNumber uint64, params sd.Params) (*sd.Payload, error) { +func (sds *Service) StateDiffAt(blockNumber uint64, params statediff.Params) (*statediff.Payload, error) { currentBlock, err := sds.lvlDBReader.GetBlockByNumber(blockNumber) if err != nil { return nil, err @@ -271,12 +245,12 @@ func (sds *Service) StateDiffAt(blockNumber uint64, params sd.Params) (*sd.Paylo // StateDiffFor returns a state diff object payload for the specific blockhash // This operation cannot be performed back past the point of db pruning; it requires an archival node for historical data -func (sds *Service) StateDiffFor(blockHash common.Hash, params sd.Params) (*sd.Payload, error) { +func (sds *Service) StateDiffFor(blockHash common.Hash, params statediff.Params) (*statediff.Payload, error) { currentBlock, err := sds.lvlDBReader.GetBlockByHash(blockHash) if err != nil { return nil, err } - logrus.Infof("sending state diff at block %s", blockHash.Hex()) + logrus.Infof("sending state diff at block %s", blockHash) // compute leaf paths of watched addresses in the params params.ComputeWatchedAddressesLeafPaths() @@ -292,8 +266,8 @@ func (sds *Service) StateDiffFor(blockHash common.Hash, params sd.Params) (*sd.P } // processStateDiff method builds the state diff payload from the current block, parent state root, and provided params -func (sds *Service) processStateDiff(currentBlock *types.Block, parentRoot common.Hash, params sd.Params) (*sd.Payload, error) { - stateDiff, err := sds.Builder.BuildStateDiffObject(sd.Args{ +func (sds *Service) processStateDiff(currentBlock *types.Block, parentRoot common.Hash, params statediff.Params) (*statediff.Payload, error) { + stateDiff, err := sds.builder.BuildStateDiffObject(statediff.Args{ BlockHash: currentBlock.Hash(), BlockNumber: currentBlock.Number(), OldStateRoot: parentRoot, @@ -310,8 +284,8 @@ func (sds *Service) processStateDiff(currentBlock *types.Block, parentRoot commo return sds.newPayload(stateDiffRlp, currentBlock, params) } -func (sds *Service) newPayload(stateObject []byte, block *types.Block, params sd.Params) (*sd.Payload, error) { - payload := &sd.Payload{ +func (sds *Service) newPayload(stateObject []byte, block *types.Block, params statediff.Params) (*statediff.Payload, error) { + payload := &statediff.Payload{ StateObjectRlp: stateObject, } if params.IncludeBlock { @@ -358,7 +332,7 @@ func (sds *Service) Stop() error { // WriteStateDiffAt writes a state diff at the specific blockheight directly to the database // This operation cannot be performed back past the point of db pruning; it requires an archival node // for historical data -func (sds *Service) WriteStateDiffAt(blockNumber uint64, params sd.Params) error { +func (sds *Service) WriteStateDiffAt(blockNumber uint64, params statediff.Params) error { logrus.Infof("Writing state diff at block %d", blockNumber) t := time.Now() currentBlock, err := sds.lvlDBReader.GetBlockByNumber(blockNumber) @@ -383,8 +357,8 @@ func (sds *Service) WriteStateDiffAt(blockNumber uint64, params sd.Params) error // WriteStateDiffFor writes a state diff for the specific blockHash directly to the database // This operation cannot be performed back past the point of db pruning; it requires an archival node // for historical data -func (sds *Service) WriteStateDiffFor(blockHash common.Hash, params sd.Params) error { - logrus.Infof("Writing state diff for block %s", blockHash.Hex()) +func (sds *Service) WriteStateDiffFor(blockHash common.Hash, params statediff.Params) error { + logrus.Infof("Writing state diff for block %s", blockHash) t := time.Now() currentBlock, err := sds.lvlDBReader.GetBlockByHash(blockHash) if err != nil { @@ -406,7 +380,7 @@ func (sds *Service) WriteStateDiffFor(blockHash common.Hash, params sd.Params) e } // Writes a state diff from the current block, parent state root, and provided params -func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, params sd.Params, t time.Time) error { +func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, params statediff.Params, t time.Time) error { var totalDifficulty *big.Int var receipts types.Receipts var err error @@ -439,20 +413,22 @@ func (sds *Service) writeStateDiff(block *types.Block, parentRoot common.Hash, p } prom.SetTimeMetric(prom.T_BLOCK_PROCESSING, time.Now().Sub(t)) t = time.Now() - err = sds.Builder.WriteStateDiffObject(sd.Args{ + err = sds.builder.WriteStateDiff(statediff.Args{ NewStateRoot: block.Root(), OldStateRoot: parentRoot, + BlockNumber: block.Number(), + BlockHash: block.Hash(), }, params, output, codeOutput) prom.SetTimeMetric(prom.T_STATE_PROCESSING, time.Now().Sub(t)) t = time.Now() - err = tx.Submit(err) + err = tx.Submit() prom.SetLastProcessedHeight(height) prom.SetTimeMetric(prom.T_POSTGRES_TX_COMMIT, time.Now().Sub(t)) return err } // WriteStateDiffsInRange adds a RangeRequest to the work queue -func (sds *Service) WriteStateDiffsInRange(start, stop uint64, params sd.Params) error { +func (sds *Service) WriteStateDiffsInRange(start, stop uint64, params statediff.Params) error { if stop < start { return fmt.Errorf("invalid block range (%d, %d): stop height must be greater or equal to start height", start, stop) } @@ -460,7 +436,7 @@ func (sds *Service) WriteStateDiffsInRange(start, stop uint64, params sd.Params) select { case sds.queue <- RangeRequest{Start: start, Stop: stop, Params: params}: prom.IncQueuedRanges() - logrus.Infof("added range (%d, %d) to the worker queue", start, stop) + logrus.Infof("Added range (%d, %d) to the worker queue", start, stop) return nil case <-blocked.C: return fmt.Errorf("unable to add range (%d, %d) to the worker queue", start, stop) diff --git a/pkg/types.go b/pkg/types.go index 0a7e89e..6e6e1fa 100644 --- a/pkg/types.go +++ b/pkg/types.go @@ -20,7 +20,9 @@ package statediff import ( - sd "github.com/ethereum/go-ethereum/statediff" + "fmt" + + sd "github.com/cerc-io/plugeth-statediff" ) // RangeRequest holds range quest work params @@ -28,3 +30,7 @@ type RangeRequest struct { Start, Stop uint64 Params sd.Params } + +func (r RangeRequest) String() string { + return fmt.Sprintf("[%d,%d]", r.Start, r.Stop) +} diff --git a/scripts/compare-statediffs.sh b/scripts/compare-statediffs.sh new file mode 100755 index 0000000..9442862 --- /dev/null +++ b/scripts/compare-statediffs.sh @@ -0,0 +1,121 @@ +#!/bin/bash +# +# Usage: compare-versions.sh [-d ] +# +# Compares full statediff output from two versions of the service. +# Configure the input data using environment vars. +( + set -u + : $LEVELDB_PATH + : $LEVELDB_ANCIENT + : $ETH_GENESIS_BLOCK + : $ETH_CHAIN_CONFIG +) || exit 1 + +# Range of diffs to request +range_start=50 +range_end=100 + +# Get the parent directory +script_dir=$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")") + +while getopts d: opt; do + case $opt in + d) output_dir="$OPTARG" + esac +done +shift $((OPTIND - 1)) + +binary_A=$1 +binary_B=$2 +shift 2 + +if [[ -z $output_dir ]]; then + output_dir=$(mktemp -d) +fi + +export STATEDIFF_TRIE_WORKERS=32 +export STATEDIFF_SERVICE_WORKERS=8 +export STATEDIFF_WORKER_QUEUE_SIZE=1024 + +export DATABASE_TYPE=postgres +export DATABASE_NAME="cerc_testing" +export DATABASE_HOSTNAME="localhost" +export DATABASE_PORT=8077 +export DATABASE_USER="vdbm" +export DATABASE_PASSWORD="password" + +export ETH_NODE_ID=test-node +export ETH_CLIENT_NAME=test-client +export ETH_NETWORK_ID=test-network +export ETH_CHAIN_ID=4242 + +export SERVICE_HTTP_PATH='127.0.0.1:8545' +export LOG_LEVEL=debug + +dump_table() { + statement="copy (select * from $1) to stdout with csv" + docker exec -e PGPASSWORD="$DATABASE_PASSWORD" test-ipld-eth-db-1 \ + psql -q $DATABASE_NAME -U $DATABASE_USER -c "$statement" | sort -u > "$2/$1.csv" +} + +clear_table() { + docker exec -e PGPASSWORD="$DATABASE_PASSWORD" test-ipld-eth-db-1 \ + psql -q $DATABASE_NAME -U $DATABASE_USER -c "truncate $1" +} + +tables=( + eth.log_cids + eth.receipt_cids + eth.state_cids + eth.storage_cids + eth.transaction_cids + eth.uncle_cids + ipld.blocks + public.nodes +) + +for table in "${tables[@]}"; do + clear_table $table +done + +run_service() { + export LOG_FILE=$(mktemp) + export LOG_FILE_PATH=$LOG_FILE + + service_binary=$1 + service_output_dir=$2 + + $service_binary serve & + + until grep "HTTP endpoint opened" $LOG_FILE + do sleep 1; done + + $script_dir/request-range.sh $range_start $range_end + if E=$?; [[ $E != 0 ]]; then + cat $LOG_FILE + return $E + fi + + echo "Waiting for service to complete requests..." + + until grep \ + -e "Finished processing block $range_end" \ + -e "finished processing statediff height $range_end" \ + $LOG_FILE + do sleep 1; done + + kill -INT $! + + mkdir -p $service_output_dir + for table in "${tables[@]}"; do + dump_table $table $service_output_dir + clear_table $table + done +} + +set -e +run_service $binary_A $output_dir/A +run_service $binary_B $output_dir/B + +diff -rs $output_dir/A $output_dir/B diff --git a/scripts/request-range.sh b/scripts/request-range.sh new file mode 100755 index 0000000..1bd6ce6 --- /dev/null +++ b/scripts/request-range.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -eu + +FROM=$1 +TO=$2 +URL='127.0.0.1:8545' + +DATA='{ + "jsonrpc": "2.0", + "method": "statediff_writeStateDiffsInRange", + "params": ['"$FROM"', '"$TO"', { + "includeBlock": true, + "includeReceipts": true, + "includeTD": true, + "includeCode": true + } + ], + "id": 1 +}' + +exec curl -s $URL -X POST -H 'Content-Type: application/json' --data "$DATA" diff --git a/startup_script.sh b/startup_script.sh index 850dfcc..7b216d1 100755 --- a/startup_script.sh +++ b/startup_script.sh @@ -10,8 +10,8 @@ fi # Check the database variables are set test "$VDB_COMMAND" -# docker must be run in privilaged mode for mounts to work -echo "Setting up /app/geth-rw overlayed /app/geth-ro" +# docker must be run in privileged mode for mounts to work +echo "Setting up /app/geth-rw overlayed onto /app/geth-ro" mkdir -p /tmp/overlay mount -t tmpfs tmpfs /tmp/overlay mkdir -p /tmp/overlay/upper @@ -31,8 +31,8 @@ fi START_TIME=`date -u +"%Y-%m-%dT%H:%M:%SZ"` echo "Running the statediff service" && \ -if [[ ! -z "$LOG_FILE_PATH" ]]; then - $SETUID /app/eth-statediff-service "$VDB_COMMAND" --config=/app/config.toml $* |& $SETUID tee ${LOG_FILE_PATH}.console +if [[ ! -z "$LOG_FILE" ]]; then + $SETUID /app/eth-statediff-service "$VDB_COMMAND" --config=/app/config.toml $* |& $SETUID tee ${LOG_FILE}.console rc=$? else $SETUID /app/eth-statediff-service "$VDB_COMMAND" --config=/app/config.toml $* diff --git a/test/ci-chain.json b/test/ci-chain.json new file mode 100644 index 0000000..d2ee2f5 --- /dev/null +++ b/test/ci-chain.json @@ -0,0 +1,16 @@ +{ + "chainId": 41337, + "homesteadBlock": 0, + "eip150Block": 0, + "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "clique": { + "period": 5, + "epoch": 30000 + } +} diff --git a/test/ci-config.toml b/test/ci-config.toml new file mode 100644 index 0000000..c2ef305 --- /dev/null +++ b/test/ci-config.toml @@ -0,0 +1,37 @@ +# Config file for service in compose.yml + +[leveldb] + mode = "local" + url = "http://127.0.0.1:8082/" + +[server] + ipcPath = ".ipc" + httpPath = "0.0.0.0:8545" + +[statediff] + serviceWorkers = 1 + workerQueueSize = 1024 + trieWorkers = 4 + +[log] + level = "debug" + +[database] + name = "cerc_testing" + hostname = "localhost" + port = 8077 + user = "vdbm" + password = "password" + type = "postgres" + driver = "sqlx" + +[cache] + database = 1024 + trie = 1024 + +[ethereum] + chainConfig = "test/ci-chain.json" + nodeID = "test-node" + clientName = "test-eth-statediff-service" + networkID = "test-network" + chainID = 41337 diff --git a/test/compose.yml b/test/compose.yml new file mode 100644 index 0000000..1715384 --- /dev/null +++ b/test/compose.yml @@ -0,0 +1,23 @@ +services: + migrations: + restart: on-failure + depends_on: + - ipld-eth-db + image: git.vdb.to/cerc-io/ipld-eth-db/ipld-eth-db:v5.0.5-alpha + environment: + DATABASE_USER: "vdbm" + DATABASE_NAME: "cerc_testing" + DATABASE_PASSWORD: "password" + DATABASE_HOSTNAME: "ipld-eth-db" + DATABASE_PORT: 5432 + + ipld-eth-db: + image: timescale/timescaledb:latest-pg14 + restart: always + command: ["postgres", "-c", "log_statement=all"] + environment: + POSTGRES_USER: "vdbm" + POSTGRES_DB: "cerc_testing" + POSTGRES_PASSWORD: "password" + ports: + - 127.0.0.1:8077:5432