diff --git a/.changeset/three-rockets-design.md b/.changeset/three-rockets-design.md new file mode 100644 index 000000000000..99cd03ab3a0e --- /dev/null +++ b/.changeset/three-rockets-design.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/gas-oracle': patch +--- + +Initial implementation of the `gas-oracle` diff --git a/.dockerignore b/.dockerignore index 6743725724c5..d9185447b480 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,3 +12,4 @@ tests/testdata l2geth/signer/fourbyte l2geth/cmd/puppeth l2geth/cmd/clef +go/gas-oracle/gas-oracle diff --git a/.github/workflows/gas-oracle.yml b/.github/workflows/gas-oracle.yml new file mode 100644 index 000000000000..394161b303b1 --- /dev/null +++ b/.github/workflows/gas-oracle.yml @@ -0,0 +1,43 @@ +name: gas-oracle unit tests + +on: + push: + paths: + - 'go/gas-oracle/**' + branches: + - 'master' + - 'develop' + - '*rc' + - 'regenesis/*' + pull_request: + paths: + - 'go/gas-oracle/**' + branches: + - 'master' + - 'develop' + - '*rc' + - 'regenesis/*' + workflow_dispatch: + +defaults: + run: + working-directory: ./go/gas-oracle + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.16.x + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install + run: make + + - name: Test + run: make test diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 000000000000..e81c8ed0d574 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,29 @@ +name: golangci-lint +on: + push: + paths: + - 'go/gas-oracle/**' + branches: + - 'master' + - 'develop' + - '*rc' + - 'regenesis/*' + pull_request: + paths: + - 'go/gas-oracle/**' + branches: + - 'master' + - 'develop' + - '*rc' + - 'regenesis/*' +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.29 + working-directory: go/gas-oracle diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65bfc5216d1f..ef551cebd9fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,7 @@ jobs: message-relayer: ${{ steps.packages.outputs.message-relayer }} data-transport-layer: ${{ steps.packages.outputs.data-transport-layer }} contracts: ${{ steps.packages.outputs.contracts }} + gas-oracle: ${{ steps.packages.outputs.gas-oracle }} steps: - name: Checkout Repo @@ -100,6 +101,32 @@ jobs: push: true tags: ethereumoptimism/rpc-proxy:${{ needs.release.outputs.l2geth }} + gas-oracle: + name: Publish Gas Oracle Version ${{ needs.release.outputs.gas-oracle }} + needs: release + if: needs.release.outputs.gas-oracle != '' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }} + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Publish Gas Oracle + uses: docker/build-push-action@v2 + with: + context: . + file: ./ops/docker/Dockerfile.gas-oracle + push: true + tags: ethereumoptimism/gas-oracle:${{ needs.release.outputs.gas-oracle }} + # pushes the base builder image to dockerhub builder: name: Prepare the base builder image for the services diff --git a/go/gas-oracle/.gitignore b/go/gas-oracle/.gitignore new file mode 100644 index 000000000000..af79c9887461 --- /dev/null +++ b/go/gas-oracle/.gitignore @@ -0,0 +1 @@ +gas-oracle diff --git a/go/gas-oracle/Makefile b/go/gas-oracle/Makefile new file mode 100644 index 000000000000..6512d4dc6351 --- /dev/null +++ b/go/gas-oracle/Makefile @@ -0,0 +1,38 @@ +SHELL := /bin/bash + +GITCOMMIT := $(shell git rev-parse HEAD) +GITDATE := $(shell git show -s --format='%ct') +GITVERSION := $(shell cat package.json | jq .version) + +LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT) +LDFLAGSSTRING +=-X main.GitDate=$(GITDATE) +LDFLAGSSTRING +=-X main.GitVersion=$(GITVERSION) +LDFLAGS :=-ldflags "$(LDFLAGSSTRING)" + +gas-oracle: + env GO111MODULE=on go build $(LDFLAGS) + +clean: + rm gas-oracle + +test: + go test -v ./... + +lint: + golangci-lint run ./... + +binding: + $(eval temp := $(shell mktemp)) + + cat abis/OVM_GasPriceOracle.json \ + | jq -r .bin > $(temp) + + cat abis/OVM_GasPriceOracle.json \ + | jq .abi \ + | abigen --pkg bindings \ + --abi - \ + --out bindings/gaspriceoracle.go \ + --type GasPriceOracle \ + --bin $(temp) + + rm $(temp) diff --git a/go/gas-oracle/README.md b/go/gas-oracle/README.md new file mode 100644 index 000000000000..6720f5beced4 --- /dev/null +++ b/go/gas-oracle/README.md @@ -0,0 +1,89 @@ +# gas-oracle + +This service is responsible for sending transactions to the Sequencer to update +the L2 gas price over time. It consists of a set of functions found in the +`gasprices` package that define the parameters of how the gas prices are updated +and then the `oracle` package is responsible for observing the Sequencer over +time and send transactions that actually do update the gas prices. + +### Generating the Bindings + +Note: this only needs to happen if the ABI of the `OVM_GasPriceOracle` is +updated. + +This project uses `abigen` to automatically create smart contract bindings in +Go. To generate the bindings, be sure that the latest ABI and bytecode are +committed into the repository in the `abis` directory. + +Use the following command to generate the bindings: + +```bash +$ make binding +``` + +Be sure to use `abigen` built with the same version of `go-ethereum` as what is +in the `go.mod` file. + +### Building the service + +The service can be built with the `Makefile`. A binary will be produced +called the `gas-oracle`. + +```bash +$ make gas-oracle +``` + +### Running the service + +Use the `--help` flag when running the `gas-oracle` to see it's configuration +options. + +``` +NAME: + gas-oracle - Remotely Control the Optimistic Ethereum Gas Price + +USAGE: + gas-oracle [global options] command [command options] [arguments...] + +VERSION: + 0.0.0-1.10.4-stable + +DESCRIPTION: + Configure with a private key and an Optimistic Ethereum HTTP endpoint to send transactions that update the L2 gas price. + +COMMANDS: + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + --ethereum-http-url value Sequencer HTTP Endpoint (default: "http://127.0.0.1:8545") [$GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL] + --chain-id value L2 Chain ID (default: 0) [$GAS_PRICE_ORACLE_CHAIN_ID] + --gas-price-oracle-address value Address of OVM_GasPriceOracle (default: "0x420000000000000000000000000000000000000F") [$GAS_PRICE_ORACLE_GAS_PRICE_ORACLE_ADDRESS] + --private-key value Private Key corresponding to OVM_GasPriceOracle Owner [$GAS_PRICE_ORACLE_PRIVATE_KEY] + --transaction-gas-price value Hardcoded tx.gasPrice, not setting it uses gas estimation (default: 0) [$GAS_PRICE_ORACLE_TRANSACTION_GAS_PRICE] + --loglevel value log level to emit to the screen (default: 3) [$GAS_PRICE_ORACLE_LOG_LEVEL] + --floor-price value gas price floor (default: 1) [$GAS_PRICE_ORACLE_FLOOR_PRICE] + --target-gas-per-second value target gas per second (default: 11000000) [$GAS_PRICE_ORACLE_TARGET_GAS_PER_SECOND] + --max-percent-change-per-epoch value max percent change of gas price per second (default: 0.1) [$GAS_PRICE_ORACLE_MAX_PERCENT_CHANGE_PER_EPOCH] + --average-block-gas-limit-per-epoch value average block gas limit per epoch (default: 1.1e+07) [$GAS_PRICE_ORACLE_AVERAGE_BLOCK_GAS_LIMIT_PER_EPOCH] + --epoch-length-seconds value length of epochs in seconds (default: 10) [$GAS_PRICE_ORACLE_EPOCH_LENGTH_SECONDS] + --significant-factor value only update when the gas price changes by more than this factor (default: 0.05) [$GAS_PRICE_ORACLE_SIGNIFICANT_FACTOR] + --wait-for-receipt wait for receipts when sending transactions [$GAS_PRICE_ORACLE_WAIT_FOR_RECEIPT] + --metrics Enable metrics collection and reporting [$GAS_PRICE_ORACLE_METRICS_ENABLE] + --metrics.addr value Enable stand-alone metrics HTTP server listening interface (default: "127.0.0.1") [$GAS_PRICE_ORACLE_METRICS_HTTP] + --metrics.port value Metrics HTTP server listening port (default: 6060) [$GAS_PRICE_ORACLE_METRICS_PORT] + --metrics.influxdb Enable metrics export/push to an external InfluxDB database [$GAS_PRICE_ORACLE_METRICS_ENABLE_INFLUX_DB] + --metrics.influxdb.endpoint value InfluxDB API endpoint to report metrics to (default: "http://localhost:8086") [$GAS_PRICE_ORACLE_METRICS_INFLUX_DB_ENDPOINT] + --metrics.influxdb.database value InfluxDB database name to push reported metrics to (default: "gas-oracle") [$GAS_PRICE_ORACLE_METRICS_INFLUX_DB_DATABASE] + --metrics.influxdb.username value Username to authorize access to the database (default: "test") [$GAS_PRICE_ORACLE_METRICS_INFLUX_DB_USERNAME] + --metrics.influxdb.password value Password to authorize access to the database (default: "test") [$GAS_PRICE_ORACLE_METRICS_INFLUX_DB_PASSWORD] + --help, -h show help + --version, -v print the version +``` + +### Testing the service + +The service can be tested with the `Makefile` + +``` +$ make test +``` diff --git a/go/gas-oracle/abis/OVM_GasPriceOracle.json b/go/gas-oracle/abis/OVM_GasPriceOracle.json new file mode 100644 index 000000000000..f7f9fd87492a --- /dev/null +++ b/go/gas-oracle/abis/OVM_GasPriceOracle.json @@ -0,0 +1,99 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initialGasPrice", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "gasPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_gasPrice", + "type": "uint256" + } + ], + "name": "setGasPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bin": "0x608060405234801561001057600080fd5b5060405161061d38038061061d8339818101604052604081101561003357600080fd5b5080516020909101516000610046610097565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350916000805160206105fd833981519152908290a3506100878161009b565b61009082610102565b5050610201565b3390565b6100a3610097565b6001600160a01b03166100b46101f2565b6001600160a01b0316146100fd576040805162461bcd60e51b815260206004820181905260248201526000805160206105dd833981519152604482015290519081900360640190fd5b600155565b61010a610097565b6001600160a01b031661011b6101f2565b6001600160a01b031614610164576040805162461bcd60e51b815260206004820181905260248201526000805160206105dd833981519152604482015290519081900360640190fd5b6001600160a01b0381166101a95760405162461bcd60e51b81526004018080602001828103825260268152602001806105b76026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216916000805160206105fd83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b6103a7806102106000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b14610066578063bf1fe4201461008a578063f2fde38b146100a7578063fe173b97146100cd575b600080fd5b6100646100e7565b005b61006e6101a5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360208110156100a057600080fd5b50356101b4565b610064600480360360208110156100bd57600080fd5b50356001600160a01b031661022d565b6100d5610341565b60408051918252519081900360200190f35b6100ef610347565b6001600160a01b03166101006101a5565b6001600160a01b03161461015b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6101bc610347565b6001600160a01b03166101cd6101a5565b6001600160a01b031614610228576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600155565b610235610347565b6001600160a01b03166102466101a5565b6001600160a01b0316146102a1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166102e65760405162461bcd60e51b815260040180806020018281038252602681526020018061034c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015481565b339056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212205ffb3c08a20124b777934c7f2adbd124e8d73ee3f782032330e9b5c98715395a64736f6c634300070600334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0" +} diff --git a/go/gas-oracle/bindings/gaspriceoracle.go b/go/gas-oracle/bindings/gaspriceoracle.go new file mode 100644 index 000000000000..addd05e60831 --- /dev/null +++ b/go/gas-oracle/bindings/gaspriceoracle.go @@ -0,0 +1,467 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// GasPriceOracleABI is the input ABI used to generate the binding from. +const GasPriceOracleABI = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_initialGasPrice\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"gasPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasPrice\",\"type\":\"uint256\"}],\"name\":\"setGasPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]" + +// GasPriceOracleBin is the compiled bytecode used for deploying new contracts. +var GasPriceOracleBin = "0x608060405234801561001057600080fd5b5060405161061d38038061061d8339818101604052604081101561003357600080fd5b5080516020909101516000610046610097565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350916000805160206105fd833981519152908290a3506100878161009b565b61009082610102565b5050610201565b3390565b6100a3610097565b6001600160a01b03166100b46101f2565b6001600160a01b0316146100fd576040805162461bcd60e51b815260206004820181905260248201526000805160206105dd833981519152604482015290519081900360640190fd5b600155565b61010a610097565b6001600160a01b031661011b6101f2565b6001600160a01b031614610164576040805162461bcd60e51b815260206004820181905260248201526000805160206105dd833981519152604482015290519081900360640190fd5b6001600160a01b0381166101a95760405162461bcd60e51b81526004018080602001828103825260268152602001806105b76026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216916000805160206105fd83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b6103a7806102106000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063715018a61461005c5780638da5cb5b14610066578063bf1fe4201461008a578063f2fde38b146100a7578063fe173b97146100cd575b600080fd5b6100646100e7565b005b61006e6101a5565b604080516001600160a01b039092168252519081900360200190f35b610064600480360360208110156100a057600080fd5b50356101b4565b610064600480360360208110156100bd57600080fd5b50356001600160a01b031661022d565b6100d5610341565b60408051918252519081900360200190f35b6100ef610347565b6001600160a01b03166101006101a5565b6001600160a01b03161461015b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6101bc610347565b6001600160a01b03166101cd6101a5565b6001600160a01b031614610228576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600155565b610235610347565b6001600160a01b03166102466101a5565b6001600160a01b0316146102a1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166102e65760405162461bcd60e51b815260040180806020018281038252602681526020018061034c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015481565b339056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212205ffb3c08a20124b777934c7f2adbd124e8d73ee3f782032330e9b5c98715395a64736f6c634300070600334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0" + +// DeployGasPriceOracle deploys a new Ethereum contract, binding an instance of GasPriceOracle to it. +func DeployGasPriceOracle(auth *bind.TransactOpts, backend bind.ContractBackend, _owner common.Address, _initialGasPrice *big.Int) (common.Address, *types.Transaction, *GasPriceOracle, error) { + parsed, err := abi.JSON(strings.NewReader(GasPriceOracleABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(GasPriceOracleBin), backend, _owner, _initialGasPrice) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &GasPriceOracle{GasPriceOracleCaller: GasPriceOracleCaller{contract: contract}, GasPriceOracleTransactor: GasPriceOracleTransactor{contract: contract}, GasPriceOracleFilterer: GasPriceOracleFilterer{contract: contract}}, nil +} + +// GasPriceOracle is an auto generated Go binding around an Ethereum contract. +type GasPriceOracle struct { + GasPriceOracleCaller // Read-only binding to the contract + GasPriceOracleTransactor // Write-only binding to the contract + GasPriceOracleFilterer // Log filterer for contract events +} + +// GasPriceOracleCaller is an auto generated read-only Go binding around an Ethereum contract. +type GasPriceOracleCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// GasPriceOracleTransactor is an auto generated write-only Go binding around an Ethereum contract. +type GasPriceOracleTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// GasPriceOracleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type GasPriceOracleFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// GasPriceOracleSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type GasPriceOracleSession struct { + Contract *GasPriceOracle // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// GasPriceOracleCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type GasPriceOracleCallerSession struct { + Contract *GasPriceOracleCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// GasPriceOracleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type GasPriceOracleTransactorSession struct { + Contract *GasPriceOracleTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// GasPriceOracleRaw is an auto generated low-level Go binding around an Ethereum contract. +type GasPriceOracleRaw struct { + Contract *GasPriceOracle // Generic contract binding to access the raw methods on +} + +// GasPriceOracleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type GasPriceOracleCallerRaw struct { + Contract *GasPriceOracleCaller // Generic read-only contract binding to access the raw methods on +} + +// GasPriceOracleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type GasPriceOracleTransactorRaw struct { + Contract *GasPriceOracleTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewGasPriceOracle creates a new instance of GasPriceOracle, bound to a specific deployed contract. +func NewGasPriceOracle(address common.Address, backend bind.ContractBackend) (*GasPriceOracle, error) { + contract, err := bindGasPriceOracle(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &GasPriceOracle{GasPriceOracleCaller: GasPriceOracleCaller{contract: contract}, GasPriceOracleTransactor: GasPriceOracleTransactor{contract: contract}, GasPriceOracleFilterer: GasPriceOracleFilterer{contract: contract}}, nil +} + +// NewGasPriceOracleCaller creates a new read-only instance of GasPriceOracle, bound to a specific deployed contract. +func NewGasPriceOracleCaller(address common.Address, caller bind.ContractCaller) (*GasPriceOracleCaller, error) { + contract, err := bindGasPriceOracle(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &GasPriceOracleCaller{contract: contract}, nil +} + +// NewGasPriceOracleTransactor creates a new write-only instance of GasPriceOracle, bound to a specific deployed contract. +func NewGasPriceOracleTransactor(address common.Address, transactor bind.ContractTransactor) (*GasPriceOracleTransactor, error) { + contract, err := bindGasPriceOracle(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &GasPriceOracleTransactor{contract: contract}, nil +} + +// NewGasPriceOracleFilterer creates a new log filterer instance of GasPriceOracle, bound to a specific deployed contract. +func NewGasPriceOracleFilterer(address common.Address, filterer bind.ContractFilterer) (*GasPriceOracleFilterer, error) { + contract, err := bindGasPriceOracle(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &GasPriceOracleFilterer{contract: contract}, nil +} + +// bindGasPriceOracle binds a generic wrapper to an already deployed contract. +func bindGasPriceOracle(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(GasPriceOracleABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_GasPriceOracle *GasPriceOracleRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _GasPriceOracle.Contract.GasPriceOracleCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_GasPriceOracle *GasPriceOracleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _GasPriceOracle.Contract.GasPriceOracleTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_GasPriceOracle *GasPriceOracleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _GasPriceOracle.Contract.GasPriceOracleTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_GasPriceOracle *GasPriceOracleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _GasPriceOracle.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_GasPriceOracle *GasPriceOracleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _GasPriceOracle.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_GasPriceOracle *GasPriceOracleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _GasPriceOracle.Contract.contract.Transact(opts, method, params...) +} + +// GasPrice is a free data retrieval call binding the contract method 0xfe173b97. +// +// Solidity: function gasPrice() view returns(uint256) +func (_GasPriceOracle *GasPriceOracleCaller) GasPrice(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _GasPriceOracle.contract.Call(opts, &out, "gasPrice") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GasPrice is a free data retrieval call binding the contract method 0xfe173b97. +// +// Solidity: function gasPrice() view returns(uint256) +func (_GasPriceOracle *GasPriceOracleSession) GasPrice() (*big.Int, error) { + return _GasPriceOracle.Contract.GasPrice(&_GasPriceOracle.CallOpts) +} + +// GasPrice is a free data retrieval call binding the contract method 0xfe173b97. +// +// Solidity: function gasPrice() view returns(uint256) +func (_GasPriceOracle *GasPriceOracleCallerSession) GasPrice() (*big.Int, error) { + return _GasPriceOracle.Contract.GasPrice(&_GasPriceOracle.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_GasPriceOracle *GasPriceOracleCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _GasPriceOracle.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_GasPriceOracle *GasPriceOracleSession) Owner() (common.Address, error) { + return _GasPriceOracle.Contract.Owner(&_GasPriceOracle.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_GasPriceOracle *GasPriceOracleCallerSession) Owner() (common.Address, error) { + return _GasPriceOracle.Contract.Owner(&_GasPriceOracle.CallOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_GasPriceOracle *GasPriceOracleTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _GasPriceOracle.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_GasPriceOracle *GasPriceOracleSession) RenounceOwnership() (*types.Transaction, error) { + return _GasPriceOracle.Contract.RenounceOwnership(&_GasPriceOracle.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_GasPriceOracle *GasPriceOracleTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _GasPriceOracle.Contract.RenounceOwnership(&_GasPriceOracle.TransactOpts) +} + +// SetGasPrice is a paid mutator transaction binding the contract method 0xbf1fe420. +// +// Solidity: function setGasPrice(uint256 _gasPrice) returns() +func (_GasPriceOracle *GasPriceOracleTransactor) SetGasPrice(opts *bind.TransactOpts, _gasPrice *big.Int) (*types.Transaction, error) { + return _GasPriceOracle.contract.Transact(opts, "setGasPrice", _gasPrice) +} + +// SetGasPrice is a paid mutator transaction binding the contract method 0xbf1fe420. +// +// Solidity: function setGasPrice(uint256 _gasPrice) returns() +func (_GasPriceOracle *GasPriceOracleSession) SetGasPrice(_gasPrice *big.Int) (*types.Transaction, error) { + return _GasPriceOracle.Contract.SetGasPrice(&_GasPriceOracle.TransactOpts, _gasPrice) +} + +// SetGasPrice is a paid mutator transaction binding the contract method 0xbf1fe420. +// +// Solidity: function setGasPrice(uint256 _gasPrice) returns() +func (_GasPriceOracle *GasPriceOracleTransactorSession) SetGasPrice(_gasPrice *big.Int) (*types.Transaction, error) { + return _GasPriceOracle.Contract.SetGasPrice(&_GasPriceOracle.TransactOpts, _gasPrice) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_GasPriceOracle *GasPriceOracleTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _GasPriceOracle.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_GasPriceOracle *GasPriceOracleSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _GasPriceOracle.Contract.TransferOwnership(&_GasPriceOracle.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_GasPriceOracle *GasPriceOracleTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _GasPriceOracle.Contract.TransferOwnership(&_GasPriceOracle.TransactOpts, newOwner) +} + +// GasPriceOracleOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the GasPriceOracle contract. +type GasPriceOracleOwnershipTransferredIterator struct { + Event *GasPriceOracleOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *GasPriceOracleOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(GasPriceOracleOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(GasPriceOracleOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *GasPriceOracleOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *GasPriceOracleOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// GasPriceOracleOwnershipTransferred represents a OwnershipTransferred event raised by the GasPriceOracle contract. +type GasPriceOracleOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_GasPriceOracle *GasPriceOracleFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*GasPriceOracleOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _GasPriceOracle.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &GasPriceOracleOwnershipTransferredIterator{contract: _GasPriceOracle.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_GasPriceOracle *GasPriceOracleFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *GasPriceOracleOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _GasPriceOracle.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(GasPriceOracleOwnershipTransferred) + if err := _GasPriceOracle.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_GasPriceOracle *GasPriceOracleFilterer) ParseOwnershipTransferred(log types.Log) (*GasPriceOracleOwnershipTransferred, error) { + event := new(GasPriceOracleOwnershipTransferred) + if err := _GasPriceOracle.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/go/gas-oracle/flags/flags.go b/go/gas-oracle/flags/flags.go new file mode 100644 index 000000000000..8a45006d2f97 --- /dev/null +++ b/go/gas-oracle/flags/flags.go @@ -0,0 +1,152 @@ +package flags + +import ( + "github.com/urfave/cli" +) + +var ( + EthereumHttpUrlFlag = cli.StringFlag{ + Name: "ethereum-http-url", + Value: "http://127.0.0.1:8545", + Usage: "Sequencer HTTP Endpoint", + EnvVar: "GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL", + } + ChainIDFlag = cli.Uint64Flag{ + Name: "chain-id", + Usage: "L2 Chain ID", + EnvVar: "GAS_PRICE_ORACLE_CHAIN_ID", + } + GasPriceOracleAddressFlag = cli.StringFlag{ + Name: "gas-price-oracle-address", + Usage: "Address of OVM_GasPriceOracle", + Value: "0x420000000000000000000000000000000000000F", + EnvVar: "GAS_PRICE_ORACLE_GAS_PRICE_ORACLE_ADDRESS", + } + PrivateKeyFlag = cli.StringFlag{ + Name: "private-key", + Usage: "Private Key corresponding to OVM_GasPriceOracle Owner", + EnvVar: "GAS_PRICE_ORACLE_PRIVATE_KEY", + } + TransactionGasPriceFlag = cli.Uint64Flag{ + Name: "transaction-gas-price", + Usage: "Hardcoded tx.gasPrice, not setting it uses gas estimation", + EnvVar: "GAS_PRICE_ORACLE_TRANSACTION_GAS_PRICE", + } + LogLevelFlag = cli.IntFlag{ + Name: "loglevel", + Value: 3, + Usage: "log level to emit to the screen", + EnvVar: "GAS_PRICE_ORACLE_LOG_LEVEL", + } + FloorPriceFlag = cli.Uint64Flag{ + Name: "floor-price", + Value: 1, + Usage: "gas price floor", + EnvVar: "GAS_PRICE_ORACLE_FLOOR_PRICE", + } + TargetGasPerSecondFlag = cli.Uint64Flag{ + Name: "target-gas-per-second", + Value: 11_000_000, + Usage: "target gas per second", + EnvVar: "GAS_PRICE_ORACLE_TARGET_GAS_PER_SECOND", + } + MaxPercentChangePerEpochFlag = cli.Float64Flag{ + Name: "max-percent-change-per-epoch", + Value: 0.1, + Usage: "max percent change of gas price per second", + EnvVar: "GAS_PRICE_ORACLE_MAX_PERCENT_CHANGE_PER_EPOCH", + } + AverageBlockGasLimitPerEpochFlag = cli.Float64Flag{ + Name: "average-block-gas-limit-per-epoch", + Value: 11_000_000, + Usage: "average block gas limit per epoch", + EnvVar: "GAS_PRICE_ORACLE_AVERAGE_BLOCK_GAS_LIMIT_PER_EPOCH", + } + EpochLengthSecondsFlag = cli.Uint64Flag{ + Name: "epoch-length-seconds", + Value: 10, + Usage: "length of epochs in seconds", + EnvVar: "GAS_PRICE_ORACLE_EPOCH_LENGTH_SECONDS", + } + SignificanceFactorFlag = cli.Float64Flag{ + Name: "significant-factor", + Value: 0.05, + Usage: "only update when the gas price changes by more than this factor", + EnvVar: "GAS_PRICE_ORACLE_SIGNIFICANT_FACTOR", + } + WaitForReceiptFlag = cli.BoolFlag{ + Name: "wait-for-receipt", + Usage: "wait for receipts when sending transactions", + EnvVar: "GAS_PRICE_ORACLE_WAIT_FOR_RECEIPT", + } + MetricsEnabledFlag = cli.BoolFlag{ + Name: "metrics", + Usage: "Enable metrics collection and reporting", + EnvVar: "GAS_PRICE_ORACLE_METRICS_ENABLE", + } + MetricsHTTPFlag = cli.StringFlag{ + Name: "metrics.addr", + Usage: "Enable stand-alone metrics HTTP server listening interface", + Value: "127.0.0.1", + EnvVar: "GAS_PRICE_ORACLE_METRICS_HTTP", + } + MetricsPortFlag = cli.IntFlag{ + Name: "metrics.port", + Usage: "Metrics HTTP server listening port", + Value: 6060, + EnvVar: "GAS_PRICE_ORACLE_METRICS_PORT", + } + MetricsEnableInfluxDBFlag = cli.BoolFlag{ + Name: "metrics.influxdb", + Usage: "Enable metrics export/push to an external InfluxDB database", + EnvVar: "GAS_PRICE_ORACLE_METRICS_ENABLE_INFLUX_DB", + } + MetricsInfluxDBEndpointFlag = cli.StringFlag{ + Name: "metrics.influxdb.endpoint", + Usage: "InfluxDB API endpoint to report metrics to", + Value: "http://localhost:8086", + EnvVar: "GAS_PRICE_ORACLE_METRICS_INFLUX_DB_ENDPOINT", + } + MetricsInfluxDBDatabaseFlag = cli.StringFlag{ + Name: "metrics.influxdb.database", + Usage: "InfluxDB database name to push reported metrics to", + Value: "gas-oracle", + EnvVar: "GAS_PRICE_ORACLE_METRICS_INFLUX_DB_DATABASE", + } + MetricsInfluxDBUsernameFlag = cli.StringFlag{ + Name: "metrics.influxdb.username", + Usage: "Username to authorize access to the database", + Value: "test", + EnvVar: "GAS_PRICE_ORACLE_METRICS_INFLUX_DB_USERNAME", + } + MetricsInfluxDBPasswordFlag = cli.StringFlag{ + Name: "metrics.influxdb.password", + Usage: "Password to authorize access to the database", + Value: "test", + EnvVar: "GAS_PRICE_ORACLE_METRICS_INFLUX_DB_PASSWORD", + } +) + +var Flags = []cli.Flag{ + EthereumHttpUrlFlag, + ChainIDFlag, + GasPriceOracleAddressFlag, + PrivateKeyFlag, + TransactionGasPriceFlag, + LogLevelFlag, + FloorPriceFlag, + TargetGasPerSecondFlag, + MaxPercentChangePerEpochFlag, + AverageBlockGasLimitPerEpochFlag, + EpochLengthSecondsFlag, + SignificanceFactorFlag, + WaitForReceiptFlag, + MetricsEnabledFlag, + MetricsHTTPFlag, + MetricsPortFlag, + MetricsEnableInfluxDBFlag, + MetricsInfluxDBEndpointFlag, + MetricsInfluxDBDatabaseFlag, + MetricsInfluxDBUsernameFlag, + MetricsInfluxDBPasswordFlag, +} diff --git a/go/gas-oracle/gasprices/gas_price_updater.go b/go/gas-oracle/gasprices/gas_price_updater.go new file mode 100644 index 000000000000..558e6202474e --- /dev/null +++ b/go/gas-oracle/gasprices/gas_price_updater.go @@ -0,0 +1,92 @@ +package gasprices + +import ( + "errors" + "sync" + + "github.com/ethereum/go-ethereum/log" +) + +type GetLatestBlockNumberFn func() (uint64, error) +type UpdateL2GasPriceFn func(uint64) error + +type GasPriceUpdater struct { + mu *sync.RWMutex + gasPricer *GasPricer + epochStartBlockNumber uint64 + averageBlockGasLimit float64 + epochLengthSeconds uint64 + getLatestBlockNumberFn GetLatestBlockNumberFn + updateL2GasPriceFn UpdateL2GasPriceFn +} + +func GetAverageGasPerSecond( + epochStartBlockNumber uint64, + latestBlockNumber uint64, + epochLengthSeconds uint64, + averageBlockGasLimit uint64, +) float64 { + blocksPassed := latestBlockNumber - epochStartBlockNumber + return float64(blocksPassed * averageBlockGasLimit / epochLengthSeconds) +} + +func NewGasPriceUpdater( + gasPricer *GasPricer, + epochStartBlockNumber uint64, + averageBlockGasLimit float64, + epochLengthSeconds uint64, + getLatestBlockNumberFn GetLatestBlockNumberFn, + updateL2GasPriceFn UpdateL2GasPriceFn, +) (*GasPriceUpdater, error) { + if averageBlockGasLimit < 1 { + return nil, errors.New("averageBlockGasLimit cannot be less than 1 gas") + } + if epochLengthSeconds < 1 { + return nil, errors.New("epochLengthSeconds cannot be less than 1 second") + } + return &GasPriceUpdater{ + mu: new(sync.RWMutex), + gasPricer: gasPricer, + epochStartBlockNumber: epochStartBlockNumber, + epochLengthSeconds: epochLengthSeconds, + averageBlockGasLimit: averageBlockGasLimit, + getLatestBlockNumberFn: getLatestBlockNumberFn, + updateL2GasPriceFn: updateL2GasPriceFn, + }, nil +} + +func (g *GasPriceUpdater) UpdateGasPrice() error { + g.mu.Lock() + defer g.mu.Unlock() + + latestBlockNumber, err := g.getLatestBlockNumberFn() + if err != nil { + return err + } + if latestBlockNumber < uint64(g.epochStartBlockNumber) { + return errors.New("Latest block number less than the last epoch's block number") + } + averageGasPerSecond := GetAverageGasPerSecond( + g.epochStartBlockNumber, + latestBlockNumber, + uint64(g.epochLengthSeconds), + uint64(g.averageBlockGasLimit), + ) + log.Debug("UpdateGasPrice", "averageGasPerSecond", averageGasPerSecond, "current-price", g.gasPricer.curPrice) + _, err = g.gasPricer.CompleteEpoch(averageGasPerSecond) + if err != nil { + return err + } + g.epochStartBlockNumber = latestBlockNumber + err = g.updateL2GasPriceFn(g.gasPricer.curPrice) + if err != nil { + return err + } + return nil +} + +func (g *GasPriceUpdater) GetGasPrice() uint64 { + g.mu.RLock() + defer g.mu.RUnlock() + return g.gasPricer.curPrice +} diff --git a/go/gas-oracle/gasprices/gas_price_updater_test.go b/go/gas-oracle/gasprices/gas_price_updater_test.go new file mode 100644 index 000000000000..4ba73150e604 --- /dev/null +++ b/go/gas-oracle/gasprices/gas_price_updater_test.go @@ -0,0 +1,176 @@ +package gasprices + +import ( + "testing" +) + +type MockEpoch struct { + numBlocks uint64 + repeatCount uint64 + postHook func(prevGasPrice uint64, gasPriceUpdater *GasPriceUpdater) +} + +func TestGetAverageGasPerSecond(t *testing.T) { + // Let's sanity check this function with some simple inputs. + // A 10 block epoch + epochStartBlockNumber := 10 + latestBlockNumber := 20 + // That lasts 10 seconds (1 block per second) + epochLengthSeconds := 10 + // And each block has a gas limit of 1 + averageBlockGasLimit := 1 + // We expect a gas per second to be 1! + expectedGps := 1.0 + gps := GetAverageGasPerSecond(uint64(epochStartBlockNumber), uint64(latestBlockNumber), uint64(epochLengthSeconds), uint64(averageBlockGasLimit)) + if gps != expectedGps { + t.Fatalf("Gas per second not calculated correctly. Got: %v expected: %v", gps, expectedGps) + } +} + +// Return a gas pricer that targets 3 blocks per epoch & 10% max change per epoch. +func makeTestGasPricerAndUpdater(curPrice uint64) (*GasPricer, *GasPriceUpdater, func(uint64), error) { + gpsTarget := 3300000.0 + getGasTarget := func() float64 { return gpsTarget } + epochLengthSeconds := uint64(10) + averageBlockGasLimit := 11000000.0 + // Based on our 10 second epoch, we are targetting 3 blocks per epoch. + gasPricer, err := NewGasPricer(curPrice, 1, getGasTarget, 10) + if err != nil { + return nil, nil, nil, err + } + + curBlock := uint64(10) + incrementCurrentBlock := func(newBlockNum uint64) { curBlock += newBlockNum } + getLatestBlockNumber := func() (uint64, error) { return curBlock, nil } + updateL2GasPrice := func(x uint64) error { + return nil + } + + startBlock, _ := getLatestBlockNumber() + gasUpdater, err := NewGasPriceUpdater( + gasPricer, + startBlock, + averageBlockGasLimit, + epochLengthSeconds, + getLatestBlockNumber, + updateL2GasPrice, + ) + if err != nil { + return nil, nil, nil, err + } + return gasPricer, gasUpdater, incrementCurrentBlock, nil +} + +func TestUpdateGasPriceCallsUpdateL2GasPriceFn(t *testing.T) { + _, gasUpdater, incrementCurrentBlock, err := makeTestGasPricerAndUpdater(1) + if err != nil { + t.Fatal(err) + } + wasCalled := false + gasUpdater.updateL2GasPriceFn = func(gasPrice uint64) error { + wasCalled = true + return nil + } + incrementCurrentBlock(3) + if err := gasUpdater.UpdateGasPrice(); err != nil { + t.Fatal(err) + } + if wasCalled != true { + t.Fatalf("Expected updateL2GasPrice to be called.") + } +} + +func TestUpdateGasPriceCorrectlyUpdatesAZeroBlockEpoch(t *testing.T) { + gasPricer, gasUpdater, _, err := makeTestGasPricerAndUpdater(100) + if err != nil { + t.Fatal(err) + } + gasPriceBefore := gasPricer.curPrice + gasPriceAfter := gasPricer.curPrice + gasUpdater.updateL2GasPriceFn = func(gasPrice uint64) error { + gasPriceAfter = gasPrice + return nil + } + if err := gasUpdater.UpdateGasPrice(); err != nil { + t.Fatal(err) + } + if gasPriceBefore < gasPriceAfter { + t.Fatalf("Expected gasPrice to go down because we had fewer than 3 blocks in the epoch.") + } +} + +func TestUpdateGasPriceFailsIfBlockNumberGoesBackwards(t *testing.T) { + _, gasUpdater, _, err := makeTestGasPricerAndUpdater(1) + if err != nil { + t.Fatal(err) + } + gasUpdater.epochStartBlockNumber = 10 + gasUpdater.getLatestBlockNumberFn = func() (uint64, error) { return 0, nil } + err = gasUpdater.UpdateGasPrice() + if err == nil { + t.Fatalf("Expected UpdateGasPrice to fail when block number goes backwards.") + } +} + +func TestUsageOfGasPriceUpdater(t *testing.T) { + _, gasUpdater, incrementCurrentBlock, err := makeTestGasPricerAndUpdater(1000) + if err != nil { + t.Fatal(err) + } + // In these mock epochs the gas price shold go up and then down again after the time has passed + mockEpochs := []MockEpoch{ + // First jack up the price to show that it will grow over time + MockEpoch{ + numBlocks: 10, + repeatCount: 3, + // Make sure the gas price is increasing + postHook: func(prevGasPrice uint64, gasPriceUpdater *GasPriceUpdater) { + curPrice := gasPriceUpdater.gasPricer.curPrice + if prevGasPrice >= curPrice { + t.Fatalf("Expected gas price to increase.") + } + }, + }, + // Then stabilize around the GPS we want + MockEpoch{ + numBlocks: 3, + repeatCount: 5, + postHook: func(prevGasPrice uint64, gasPriceUpdater *GasPriceUpdater) {}, + }, + MockEpoch{ + numBlocks: 3, + repeatCount: 0, + postHook: func(prevGasPrice uint64, gasPriceUpdater *GasPriceUpdater) { + curPrice := gasPriceUpdater.gasPricer.curPrice + if prevGasPrice != curPrice { + t.Fatalf("Expected gas price to stablize.") + } + }, + }, + // Then reduce the demand to show the fee goes back down to the floor + MockEpoch{ + numBlocks: 1, + repeatCount: 5, + postHook: func(prevGasPrice uint64, gasPriceUpdater *GasPriceUpdater) { + curPrice := gasPriceUpdater.gasPricer.curPrice + if prevGasPrice <= curPrice && curPrice != gasPriceUpdater.gasPricer.floorPrice { + t.Fatalf("Expected gas price either reduce or be at the floor.") + } + }, + }, + } + loop := func(epoch MockEpoch) { + prevGasPrice := gasUpdater.gasPricer.curPrice + incrementCurrentBlock(epoch.numBlocks) + err = gasUpdater.UpdateGasPrice() + if err != nil { + t.Fatal(err) + } + epoch.postHook(prevGasPrice, gasUpdater) + } + for _, epoch := range mockEpochs { + for i := 0; i < int(epoch.repeatCount)+1; i++ { + loop(epoch) + } + } +} diff --git a/go/gas-oracle/gasprices/l2_gas_pricer.go b/go/gas-oracle/gasprices/l2_gas_pricer.go new file mode 100644 index 000000000000..dd499261ddfe --- /dev/null +++ b/go/gas-oracle/gasprices/l2_gas_pricer.go @@ -0,0 +1,82 @@ +package gasprices + +import ( + "errors" + "fmt" + "math" + + "github.com/ethereum/go-ethereum/log" +) + +type GetTargetGasPerSecond func() float64 + +type GasPricer struct { + curPrice uint64 + floorPrice uint64 + getTargetGasPerSecond GetTargetGasPerSecond + maxChangePerEpoch float64 +} + +// LinearInterpolation can be used to dynamically update target gas per second +func GetLinearInterpolationFn(getX func() float64, x1 float64, x2 float64, y1 float64, y2 float64) func() float64 { + return func() float64 { + return y1 + ((getX()-x1)/(x2-x1))*(y2-y1) + } +} + +// NewGasPricer creates a GasPricer and checks its config beforehand +func NewGasPricer(curPrice, floorPrice uint64, getTargetGasPerSecond GetTargetGasPerSecond, maxPercentChangePerEpoch float64) (*GasPricer, error) { + if floorPrice < 1 { + return nil, errors.New("floorPrice must be greater than or equal to 1") + } + if maxPercentChangePerEpoch <= 0 { + return nil, errors.New("maxPercentChangePerEpoch must be between (0,100]") + } + return &GasPricer{ + curPrice: max(curPrice, floorPrice), + floorPrice: floorPrice, + getTargetGasPerSecond: getTargetGasPerSecond, + maxChangePerEpoch: maxPercentChangePerEpoch, + }, nil +} + +// CalcNextEpochGasPrice calculates the next gas price given some average +// gas per second over the last epoch +func (p *GasPricer) CalcNextEpochGasPrice(avgGasPerSecondLastEpoch float64) (uint64, error) { + targetGasPerSecond := p.getTargetGasPerSecond() + if avgGasPerSecondLastEpoch < 0 { + return 0.0, fmt.Errorf("avgGasPerSecondLastEpoch cannot be negative, got %f", avgGasPerSecondLastEpoch) + } + if targetGasPerSecond < 1 { + return 0.0, fmt.Errorf("gasPerSecond cannot be less than 1, got %f", targetGasPerSecond) + } + // The percent difference between our current average gas & our target gas + proportionOfTarget := avgGasPerSecondLastEpoch / targetGasPerSecond + // The percent that we should adjust the gas price to reach our target gas + proportionToChangeBy := 0.0 + if proportionOfTarget >= 1 { // If average avgGasPerSecondLastEpoch is GREATER than our target + proportionToChangeBy = math.Min(proportionOfTarget, 1+p.maxChangePerEpoch) + } else { + proportionToChangeBy = math.Max(proportionOfTarget, 1-p.maxChangePerEpoch) + } + log.Debug("CalcNextEpochGasPrice", "proportionToChangeBy", proportionToChangeBy, "proportionOfTarget", proportionOfTarget) + updated := float64(max(1, p.curPrice)) * proportionToChangeBy + return max(p.floorPrice, uint64(math.Ceil(updated))), nil +} + +// CompleteEpoch ends the current epoch and updates the current gas price for the next epoch +func (p *GasPricer) CompleteEpoch(avgGasPerSecondLastEpoch float64) (uint64, error) { + gp, err := p.CalcNextEpochGasPrice(avgGasPerSecondLastEpoch) + if err != nil { + return gp, err + } + p.curPrice = gp + return gp, nil +} + +func max(a, b uint64) uint64 { + if a >= b { + return a + } + return b +} diff --git a/go/gas-oracle/gasprices/l2_gas_pricer_test.go b/go/gas-oracle/gasprices/l2_gas_pricer_test.go new file mode 100644 index 000000000000..3f731f71d646 --- /dev/null +++ b/go/gas-oracle/gasprices/l2_gas_pricer_test.go @@ -0,0 +1,172 @@ +package gasprices + +import ( + "math" + "testing" +) + +type CalcGasPriceTestCase struct { + name string + avgGasPerSecondLastEpoch float64 + expectedNextGasPrice uint64 +} + +func returnConstFn(retVal uint64) func() float64 { + return func() float64 { return float64(retVal) } +} + +func runCalcGasPriceTests(gp GasPricer, tcs []CalcGasPriceTestCase, t *testing.T) { + for _, tc := range tcs { + nextEpochGasPrice, err := gp.CalcNextEpochGasPrice(tc.avgGasPerSecondLastEpoch) + if tc.expectedNextGasPrice != nextEpochGasPrice || err != nil { + t.Fatalf("failed on test: %s", tc.name) + } + } +} + +func TestCalcGasPriceFarFromFloor(t *testing.T) { + gp := GasPricer{ + curPrice: 100, + floorPrice: 1, + getTargetGasPerSecond: returnConstFn(10), + maxChangePerEpoch: 0.5, + } + tcs := []CalcGasPriceTestCase{ + // No change + { + name: "No change expected when already at target", + avgGasPerSecondLastEpoch: 10, + expectedNextGasPrice: 100, + }, + // Price reduction + { + name: "Max % change bounds the reduction in price", + avgGasPerSecondLastEpoch: 1, + expectedNextGasPrice: 50, + }, + { + // We're half of our target, so reduce by half + name: "Reduce fee by half if at 50% capacity", + avgGasPerSecondLastEpoch: 5, + expectedNextGasPrice: 50, + }, + { + name: "Reduce fee by 75% if at 75% capacity", + avgGasPerSecondLastEpoch: 7.5, + expectedNextGasPrice: 75, + }, + // Price increase + { + name: "Max % change bounds the increase in price", + avgGasPerSecondLastEpoch: 100, + expectedNextGasPrice: 150, + }, + { + name: "Increase fee by 25% if at 125% capacity", + avgGasPerSecondLastEpoch: 12.5, + expectedNextGasPrice: 125, + }, + } + runCalcGasPriceTests(gp, tcs, t) +} + +func TestCalcGasPriceAtFloor(t *testing.T) { + gp := GasPricer{ + curPrice: 100, + floorPrice: 100, + getTargetGasPerSecond: returnConstFn(10), + maxChangePerEpoch: 0.5, + } + tcs := []CalcGasPriceTestCase{ + // No change + { + name: "No change expected when already at target", + avgGasPerSecondLastEpoch: 10, + expectedNextGasPrice: 100, + }, + // Price reduction + { + name: "No change expected when at floorPrice", + avgGasPerSecondLastEpoch: 1, + expectedNextGasPrice: 100, + }, + // Price increase + { + name: "Max % change bounds the increase in price", + avgGasPerSecondLastEpoch: 100, + expectedNextGasPrice: 150, + }, + } + runCalcGasPriceTests(gp, tcs, t) +} + +func TestGasPricerUpdates(t *testing.T) { + gp := GasPricer{ + curPrice: 100, + floorPrice: 100, + getTargetGasPerSecond: returnConstFn(10), + maxChangePerEpoch: 0.5, + } + _, err := gp.CompleteEpoch(12.5) + if err != nil { + t.Fatal(err) + } + if gp.curPrice != 125 { + t.Fatalf("gp.curPrice not updated correctly. Got: %v, expected: %v", gp.curPrice, 125) + } +} + +func TestGetLinearInterpolationFn(t *testing.T) { + mockTimestamp := float64(0) // start at timestamp 0 + // TargetGasPerSecond is dynamic based on the current "mocktimestamp" + mockTimeNow := func() float64 { + return mockTimestamp + } + l := GetLinearInterpolationFn(mockTimeNow, 0, 10, 0, 100) + for expected := 0.0; expected < 100; expected += 10 { + mockTimestamp = expected / 10 // To prove this is not identity function, divide by 10 + got := l() + if got != expected { + t.Fatalf("linear interpolation incorrect. Got: %v expected: %v", got, expected) + } + } +} + +func TestGasPricerDynamicTarget(t *testing.T) { + // In prod we will be committing to a gas per second schedule in order to + // meter usage over time. This linear interpolation between a start time, end time, + // start gas per second, and end gas per second is an example of how we can introduce + // acceleration in our gas pricer + startTimestamp := float64(0) + startGasPerSecond := float64(10) + endTimestamp := float64(100) + endGasPerSecond := float64(100) + + mockTimestamp := float64(0) // start at timestamp 0 + // TargetGasPerSecond is dynamic based on the current "mocktimestamp" + mockTimeNow := func() float64 { + return mockTimestamp + } + // TargetGasPerSecond is dynamic based on the current "mocktimestamp" + dynamicGetTarget := GetLinearInterpolationFn(mockTimeNow, startTimestamp, endTimestamp, startGasPerSecond, endGasPerSecond) + + gp := GasPricer{ + curPrice: 100, + floorPrice: 1, + getTargetGasPerSecond: dynamicGetTarget, + maxChangePerEpoch: 0.5, + } + gasPerSecondDemanded := returnConstFn(15) + for i := 0; i < 10; i++ { + mockTimestamp = float64(i * 10) + expectedPrice := math.Ceil(float64(gp.curPrice) * math.Max(0.5, gasPerSecondDemanded()/dynamicGetTarget())) + + _, err := gp.CompleteEpoch(gasPerSecondDemanded()) + if err != nil { + t.Fatal(err) + } + if gp.curPrice != uint64(expectedPrice) { + t.Fatalf("gp.curPrice not updated correctly. Got: %v expected: %v", gp.curPrice, expectedPrice) + } + } +} diff --git a/go/gas-oracle/go.mod b/go/gas-oracle/go.mod new file mode 100644 index 000000000000..19f1ed300285 --- /dev/null +++ b/go/gas-oracle/go.mod @@ -0,0 +1,9 @@ +module github.com/ethereum-optimism/optimism/go/gas-oracle + +go 1.16 + +require ( + github.com/ethereum/go-ethereum v1.10.4 + github.com/urfave/cli v1.20.0 + golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect +) diff --git a/go/gas-oracle/go.sum b/go/gas-oracle/go.sum new file mode 100644 index 000000000000..79b1a07f3af6 --- /dev/null +++ b/go/gas-oracle/go.sum @@ -0,0 +1,571 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= +github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= +github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= +github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= +github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= +github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= +github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= +github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= +github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= +github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= +github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +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/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= +github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= +github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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 v0.0.0-20180603214616-504e848d77ea h1:j4317fAZh7X6GqbFowYdYdI0L9bwxL07jyPZIdepyZ0= +github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= +github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ethereum/go-ethereum v1.10.4 h1:JPZPL2MHbegfFStcaOrrggMVIcf57OQHQ0J3UhjQ+xQ= +github.com/ethereum/go-ethereum v1.10.4/go.mod h1:nEE0TP5MtxGzOMd7egIrbPJMQBnhVU3ELNxhBglIzhg= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +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/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +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/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I= +github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +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/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +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.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +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.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= +github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 h1:bcAj8KroPf552TScjFPIakjH2/tdIrIH8F+cc4v4SRo= +github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo= +github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= +github.com/influxdata/influxdb v1.8.3 h1:WEypI1BQFTT4teLM+1qkEcvUi0dAvopAI/ir0vAiBg8= +github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= +github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= +github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= +github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= +github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= +github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= +github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= +github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 h1:6OvNmYgJyexcZ3pYbTI9jWx5tHo1Dee/tWbLMfPe2TA= +github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/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/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= +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/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= +github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 h1:I/yrLt2WilKxlQKCM52clh5rGzTKpVctGT1lH4Dc8Jw= +github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= +github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= +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/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.0 h1:v2XXALHHh6zHfYTJ+cSkwtyffnaOyR1MXaA91mTrb8o= +github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035 h1:USWjF42jDCSEeikX/G1g40ZWnsPXN5WkZ4jMHZWyBK4= +github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +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.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +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.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= +github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= +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/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_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/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= +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/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= +github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +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/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +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/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/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +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/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +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.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= +github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= +github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988 h1:EjgCl+fVlIaPJSori0ikSz3uV0DOHKWOJFpv1sAAhBM= +golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +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-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/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-20190206041539-40960b6deb8e/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-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-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +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= +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/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/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/go/gas-oracle/main.go b/go/gas-oracle/main.go new file mode 100644 index 000000000000..fe81949b0910 --- /dev/null +++ b/go/gas-oracle/main.go @@ -0,0 +1,80 @@ +package main + +import ( + "fmt" + "os" + "time" + + "github.com/ethereum-optimism/optimism/go/gas-oracle/flags" + ometrics "github.com/ethereum-optimism/optimism/go/gas-oracle/metrics" + "github.com/ethereum-optimism/optimism/go/gas-oracle/oracle" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics/influxdb" + "github.com/ethereum/go-ethereum/params" + "github.com/urfave/cli" +) + +var ( + GitVersion = "" + GitCommit = "" + GitDate = "" +) + +func main() { + app := cli.NewApp() + app.Flags = flags.Flags + + app.Version = GitVersion + "-" + params.VersionWithCommit(GitCommit, GitDate) + app.Name = "gas-oracle" + app.Usage = "Remotely Control the Optimistic Ethereum Gas Price" + app.Description = "Configure with a private key and an Optimistic Ethereum HTTP endpoint " + + "to send transactions that update the L2 gas price." + + // Configure the logging + app.Before = func(ctx *cli.Context) error { + loglevel := ctx.GlobalUint64(flags.LogLevelFlag.Name) + log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(loglevel), log.StreamHandler(os.Stdout, log.TerminalFormat(true)))) + return nil + } + + // Define the functionality of the application + app.Action = func(ctx *cli.Context) error { + if args := ctx.Args(); len(args) > 0 { + return fmt.Errorf("invalid command: %q", args[0]) + } + + config := oracle.NewConfig(ctx) + gpo, err := oracle.NewGasPriceOracle(config) + if err != nil { + return err + } + + if err := gpo.Start(); err != nil { + return err + } + + if config.MetricsEnabled { + address := fmt.Sprintf("%s:%d", config.MetricsHTTP, config.MetricsPort) + log.Info("Enabling stand-alone metrics HTTP endpoint", "address", address) + ometrics.Setup(address) + } + + if config.MetricsEnableInfluxDB { + endpoint := config.MetricsInfluxDBEndpoint + database := config.MetricsInfluxDBDatabase + username := config.MetricsInfluxDBUsername + password := config.MetricsInfluxDBPassword + log.Info("Enabling metrics export to InfluxDB", "endpoint", endpoint, "username", username, "database", database) + go influxdb.InfluxDBWithTags(ometrics.DefaultRegistry, 10*time.Second, endpoint, database, username, password, "geth.", make(map[string]string)) + } + + gpo.Wait() + + return nil + } + + err := app.Run(os.Args) + if err != nil { + log.Crit("application failed", "message", err) + } +} diff --git a/go/gas-oracle/metrics/handler.go b/go/gas-oracle/metrics/handler.go new file mode 100644 index 000000000000..c8305ee1683d --- /dev/null +++ b/go/gas-oracle/metrics/handler.go @@ -0,0 +1,188 @@ +package metrics + +// Do not edit this file as it was copied from go-ethereum + +import ( + "expvar" + "fmt" + "net/http" + "sync" + + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" + "github.com/ethereum/go-ethereum/metrics/prometheus" +) + +var DefaultRegistry = metrics.NewRegistry() + +type exp struct { + expvarLock sync.Mutex // expvar panics if you try to register the same var twice, so we must probe it safely + registry metrics.Registry +} + +func (exp *exp) expHandler(w http.ResponseWriter, r *http.Request) { + // load our variables into expvar + exp.syncToExpvar() + + // now just run the official expvar handler code (which is not publicly callable, so pasted inline) + w.Header().Set("Content-Type", "application/json; charset=utf-8") + fmt.Fprintf(w, "{\n") + first := true + expvar.Do(func(kv expvar.KeyValue) { + if !first { + fmt.Fprintf(w, ",\n") + } + first = false + fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value) + }) + fmt.Fprintf(w, "\n}\n") +} + +// Exp will register an expvar powered metrics handler with http.DefaultServeMux on "/debug/vars" +func Exp(r metrics.Registry) { + h := ExpHandler(r) + // this would cause a panic: + // panic: http: multiple registrations for /debug/vars + // http.HandleFunc("/debug/vars", e.expHandler) + // haven't found an elegant way, so just use a different endpoint + http.Handle("/debug/metrics", h) + http.Handle("/debug/metrics/prometheus", prometheus.Handler(r)) +} + +// ExpHandler will return an expvar powered metrics handler. +func ExpHandler(r metrics.Registry) http.Handler { + e := exp{sync.Mutex{}, r} + return http.HandlerFunc(e.expHandler) +} + +// Setup starts a dedicated metrics server at the given address. +// This function enables metrics reporting separate from pprof. +func Setup(address string) { + m := http.NewServeMux() + m.Handle("/debug/metrics", ExpHandler(DefaultRegistry)) + m.Handle("/debug/metrics/prometheus", prometheus.Handler(DefaultRegistry)) + log.Info("Starting metrics server", "addr", fmt.Sprintf("http://%s/debug/metrics", address)) + go func() { + if err := http.ListenAndServe(address, m); err != nil { + log.Error("Failure in running metrics server", "err", err) + } + }() +} + +func (exp *exp) getInt(name string) *expvar.Int { + var v *expvar.Int + exp.expvarLock.Lock() + p := expvar.Get(name) + if p != nil { + v = p.(*expvar.Int) + } else { + v = new(expvar.Int) + expvar.Publish(name, v) + } + exp.expvarLock.Unlock() + return v +} + +func (exp *exp) getFloat(name string) *expvar.Float { + var v *expvar.Float + exp.expvarLock.Lock() + p := expvar.Get(name) + if p != nil { + v = p.(*expvar.Float) + } else { + v = new(expvar.Float) + expvar.Publish(name, v) + } + exp.expvarLock.Unlock() + return v +} + +func (exp *exp) publishCounter(name string, metric metrics.Counter) { + v := exp.getInt(name) + v.Set(metric.Count()) +} + +func (exp *exp) publishGauge(name string, metric metrics.Gauge) { + v := exp.getInt(name) + v.Set(metric.Value()) +} +func (exp *exp) publishGaugeFloat64(name string, metric metrics.GaugeFloat64) { + exp.getFloat(name).Set(metric.Value()) +} + +func (exp *exp) publishHistogram(name string, metric metrics.Histogram) { + h := metric.Snapshot() + ps := h.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) + exp.getInt(name + ".count").Set(h.Count()) + exp.getFloat(name + ".min").Set(float64(h.Min())) + exp.getFloat(name + ".max").Set(float64(h.Max())) + exp.getFloat(name + ".mean").Set(h.Mean()) + exp.getFloat(name + ".std-dev").Set(h.StdDev()) + exp.getFloat(name + ".50-percentile").Set(ps[0]) + exp.getFloat(name + ".75-percentile").Set(ps[1]) + exp.getFloat(name + ".95-percentile").Set(ps[2]) + exp.getFloat(name + ".99-percentile").Set(ps[3]) + exp.getFloat(name + ".999-percentile").Set(ps[4]) +} + +func (exp *exp) publishMeter(name string, metric metrics.Meter) { + m := metric.Snapshot() + exp.getInt(name + ".count").Set(m.Count()) + exp.getFloat(name + ".one-minute").Set(m.Rate1()) + exp.getFloat(name + ".five-minute").Set(m.Rate5()) + exp.getFloat(name + ".fifteen-minute").Set(m.Rate15()) + exp.getFloat(name + ".mean").Set(m.RateMean()) +} + +func (exp *exp) publishTimer(name string, metric metrics.Timer) { + t := metric.Snapshot() + ps := t.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999}) + exp.getInt(name + ".count").Set(t.Count()) + exp.getFloat(name + ".min").Set(float64(t.Min())) + exp.getFloat(name + ".max").Set(float64(t.Max())) + exp.getFloat(name + ".mean").Set(t.Mean()) + exp.getFloat(name + ".std-dev").Set(t.StdDev()) + exp.getFloat(name + ".50-percentile").Set(ps[0]) + exp.getFloat(name + ".75-percentile").Set(ps[1]) + exp.getFloat(name + ".95-percentile").Set(ps[2]) + exp.getFloat(name + ".99-percentile").Set(ps[3]) + exp.getFloat(name + ".999-percentile").Set(ps[4]) + exp.getFloat(name + ".one-minute").Set(t.Rate1()) + exp.getFloat(name + ".five-minute").Set(t.Rate5()) + exp.getFloat(name + ".fifteen-minute").Set(t.Rate15()) + exp.getFloat(name + ".mean-rate").Set(t.RateMean()) +} + +func (exp *exp) publishResettingTimer(name string, metric metrics.ResettingTimer) { + t := metric.Snapshot() + ps := t.Percentiles([]float64{50, 75, 95, 99}) + exp.getInt(name + ".count").Set(int64(len(t.Values()))) + exp.getFloat(name + ".mean").Set(t.Mean()) + exp.getInt(name + ".50-percentile").Set(ps[0]) + exp.getInt(name + ".75-percentile").Set(ps[1]) + exp.getInt(name + ".95-percentile").Set(ps[2]) + exp.getInt(name + ".99-percentile").Set(ps[3]) +} + +func (exp *exp) syncToExpvar() { + exp.registry.Each(func(name string, i interface{}) { + switch i := i.(type) { + case metrics.Counter: + exp.publishCounter(name, i) + case metrics.Gauge: + exp.publishGauge(name, i) + case metrics.GaugeFloat64: + exp.publishGaugeFloat64(name, i) + case metrics.Histogram: + exp.publishHistogram(name, i) + case metrics.Meter: + exp.publishMeter(name, i) + case metrics.Timer: + exp.publishTimer(name, i) + case metrics.ResettingTimer: + exp.publishResettingTimer(name, i) + default: + panic(fmt.Sprintf("unsupported type for '%s': %T", name, i)) + } + }) +} diff --git a/go/gas-oracle/oracle/config.go b/go/gas-oracle/oracle/config.go new file mode 100644 index 000000000000..252891abe23b --- /dev/null +++ b/go/gas-oracle/oracle/config.go @@ -0,0 +1,90 @@ +package oracle + +import ( + "crypto/ecdsa" + "fmt" + "math/big" + "strings" + + "github.com/ethereum-optimism/optimism/go/gas-oracle/flags" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/log" + "github.com/urfave/cli" +) + +// Config represents the configuration options for the gas oracle +type Config struct { + chainID *big.Int + ethereumHttpUrl string + gasPriceOracleAddress common.Address + privateKey *ecdsa.PrivateKey + gasPrice *big.Int + waitForReceipt bool + floorPrice uint64 + targetGasPerSecond uint64 + maxPercentChangePerEpoch float64 + averageBlockGasLimitPerEpoch float64 + epochLengthSeconds uint64 + significanceFactor float64 + // Metrics config + MetricsEnabled bool + MetricsHTTP string + MetricsPort int + MetricsEnableInfluxDB bool + MetricsInfluxDBEndpoint string + MetricsInfluxDBDatabase string + MetricsInfluxDBUsername string + MetricsInfluxDBPassword string +} + +// NewConfig creates a new Config +func NewConfig(ctx *cli.Context) *Config { + cfg := Config{} + cfg.ethereumHttpUrl = ctx.GlobalString(flags.EthereumHttpUrlFlag.Name) + addr := ctx.GlobalString(flags.GasPriceOracleAddressFlag.Name) + cfg.gasPriceOracleAddress = common.HexToAddress(addr) + cfg.targetGasPerSecond = ctx.GlobalUint64(flags.TargetGasPerSecondFlag.Name) + cfg.maxPercentChangePerEpoch = ctx.GlobalFloat64(flags.MaxPercentChangePerEpochFlag.Name) + cfg.averageBlockGasLimitPerEpoch = ctx.GlobalFloat64(flags.AverageBlockGasLimitPerEpochFlag.Name) + cfg.epochLengthSeconds = ctx.GlobalUint64(flags.EpochLengthSecondsFlag.Name) + cfg.significanceFactor = ctx.GlobalFloat64(flags.SignificanceFactorFlag.Name) + cfg.floorPrice = ctx.GlobalUint64(flags.FloorPriceFlag.Name) + + if ctx.GlobalIsSet(flags.PrivateKeyFlag.Name) { + hex := ctx.GlobalString(flags.PrivateKeyFlag.Name) + hex = strings.TrimPrefix(hex, "0x") + key, err := crypto.HexToECDSA(hex) + if err != nil { + log.Error(fmt.Sprintf("Option %q: %v", flags.PrivateKeyFlag.Name, err)) + } + cfg.privateKey = key + } else { + log.Crit("No private key configured") + } + + if ctx.GlobalIsSet(flags.ChainIDFlag.Name) { + chainID := ctx.GlobalUint64(flags.ChainIDFlag.Name) + cfg.chainID = new(big.Int).SetUint64(chainID) + } + + if ctx.GlobalIsSet(flags.TransactionGasPriceFlag.Name) { + gasPrice := ctx.GlobalUint64(flags.TransactionGasPriceFlag.Name) + cfg.gasPrice = new(big.Int).SetUint64(gasPrice) + } + + if ctx.GlobalIsSet(flags.WaitForReceiptFlag.Name) { + cfg.waitForReceipt = true + } + + cfg.MetricsEnabled = ctx.GlobalBool(flags.MetricsEnabledFlag.Name) + cfg.MetricsHTTP = ctx.GlobalString(flags.MetricsHTTPFlag.Name) + cfg.MetricsPort = ctx.GlobalInt(flags.MetricsPortFlag.Name) + cfg.MetricsEnableInfluxDB = ctx.GlobalBool(flags.MetricsEnableInfluxDBFlag.Name) + cfg.MetricsInfluxDBEndpoint = ctx.GlobalString(flags.MetricsInfluxDBEndpointFlag.Name) + cfg.MetricsInfluxDBDatabase = ctx.GlobalString(flags.MetricsInfluxDBDatabaseFlag.Name) + cfg.MetricsInfluxDBUsername = ctx.GlobalString(flags.MetricsInfluxDBUsernameFlag.Name) + cfg.MetricsInfluxDBPassword = ctx.GlobalString(flags.MetricsInfluxDBPasswordFlag.Name) + + return &cfg +} diff --git a/go/gas-oracle/oracle/gas_price_oracle.go b/go/gas-oracle/oracle/gas_price_oracle.go new file mode 100644 index 000000000000..a81066cf9a3c --- /dev/null +++ b/go/gas-oracle/oracle/gas_price_oracle.go @@ -0,0 +1,256 @@ +package oracle + +import ( + "context" + "errors" + "fmt" + "math/big" + "time" + + "github.com/ethereum-optimism/optimism/go/gas-oracle/bindings" + "github.com/ethereum-optimism/optimism/go/gas-oracle/gasprices" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/log" +) + +// errInvalidSigningKey represents the error when the signing key used +// is not the Owner of the contract and therefore cannot update the gasprice +var errInvalidSigningKey = errors.New("invalid signing key") + +// errNoChainID represents the error when the chain id is not provided +// and it cannot be remotely fetched +var errNoChainID = errors.New("no chain id provided") + +// errNoPrivateKey represents the error when the private key is not provided to +// the application +var errNoPrivateKey = errors.New("no private key provided") + +// errWrongChainID represents the error when the configured chain id is not +// correct +var errWrongChainID = errors.New("wrong chain id provided") + +// GasPriceOracle manages a hot key that can update the L2 Gas Price +type GasPriceOracle struct { + chainID *big.Int + ctx context.Context + stop chan struct{} + contract *bindings.GasPriceOracle + backend DeployContractBackend + gasPriceUpdater *gasprices.GasPriceUpdater + config *Config +} + +// Start runs the GasPriceOracle +func (g *GasPriceOracle) Start() error { + if g.config.chainID == nil { + return errNoChainID + } + if g.config.privateKey == nil { + return errNoPrivateKey + } + + address := crypto.PubkeyToAddress(g.config.privateKey.PublicKey) + log.Info("Starting Gas Price Oracle", "chain-id", g.chainID, "address", address.Hex()) + + price, err := g.contract.GasPrice(&bind.CallOpts{ + Context: context.Background(), + }) + if err != nil { + return err + } + gasPriceGauge.Update(int64(price.Uint64())) + + go g.Loop() + + return nil +} + +func (g *GasPriceOracle) Stop() { + close(g.stop) +} + +func (g *GasPriceOracle) Wait() { + <-g.stop +} + +// ensure makes sure that the configured private key is the owner +// of the `OVM_GasPriceOracle`. If it is not the owner, then it will +// not be able to make updates to the L2 gas price. +func (g *GasPriceOracle) ensure() error { + owner, err := g.contract.Owner(&bind.CallOpts{ + Context: g.ctx, + }) + if err != nil { + return err + } + address := crypto.PubkeyToAddress(g.config.privateKey.PublicKey) + if address != owner { + log.Error("Signing key does not match contract owner", "signer", address.Hex(), "owner", owner.Hex()) + return errInvalidSigningKey + } + return nil +} + +// Loop is the main logic of the gas-oracle +func (g *GasPriceOracle) Loop() { + timer := time.NewTicker(time.Duration(g.config.epochLengthSeconds) * time.Second) + for { + select { + case <-timer.C: + log.Trace("polling", "time", time.Now()) + if err := g.Update(); err != nil { + log.Error("cannot update gas price", "message", err) + } + + case <-g.ctx.Done(): + g.Stop() + } + } +} + +// Update will update the gas price +func (g *GasPriceOracle) Update() error { + l2GasPrice, err := g.contract.GasPrice(&bind.CallOpts{ + Context: g.ctx, + }) + if err != nil { + return fmt.Errorf("cannot get gas price: %w", err) + } + + if err := g.gasPriceUpdater.UpdateGasPrice(); err != nil { + return fmt.Errorf("cannot update gas price: %w", err) + } + + newGasPrice, err := g.contract.GasPrice(&bind.CallOpts{ + Context: g.ctx, + }) + if err != nil { + return fmt.Errorf("cannot get gas price: %w", err) + } + + local := g.gasPriceUpdater.GetGasPrice() + log.Info("Update", "original", l2GasPrice, "current", newGasPrice, "local", local) + return nil +} + +// NewGasPriceOracle creates a new GasPriceOracle based on a Config +func NewGasPriceOracle(cfg *Config) (*GasPriceOracle, error) { + client, err := ethclient.Dial(cfg.ethereumHttpUrl) + if err != nil { + return nil, err + } + + // Ensure that we can actually connect + t := time.NewTicker(5 * time.Second) + for ; true; <-t.C { + _, err := client.ChainID(context.Background()) + if err == nil { + t.Stop() + break + } + log.Error("Unable to connect to remote node", "addr", cfg.ethereumHttpUrl) + } + + address := cfg.gasPriceOracleAddress + contract, err := bindings.NewGasPriceOracle(address, client) + if err != nil { + return nil, err + } + + // Fetch the current gas price to use as the current price + currentPrice, err := contract.GasPrice(&bind.CallOpts{ + Context: context.Background(), + }) + if err != nil { + return nil, err + } + + // Create a gas pricer for the gas price updater + log.Info("Creating GasPricer", "currentPrice", currentPrice, + "floorPrice", cfg.floorPrice, "targetGasPerSecond", cfg.targetGasPerSecond, + "maxPercentChangePerEpoch", cfg.maxPercentChangePerEpoch) + + gasPricer, err := gasprices.NewGasPricer( + currentPrice.Uint64(), + cfg.floorPrice, + func() float64 { + return float64(cfg.targetGasPerSecond) + }, + cfg.maxPercentChangePerEpoch, + ) + if err != nil { + return nil, err + } + + chainID, err := client.ChainID(context.Background()) + if err != nil { + return nil, err + } + + // If the chainid is passed in, exit if the chain id is + // not correct + if cfg.chainID != nil { + if cfg.chainID.Cmp(chainID) != 0 { + return nil, fmt.Errorf("%w: configured with %d and got %d", errWrongChainID, cfg.chainID, chainID) + } + } else { + cfg.chainID = chainID + } + + if cfg.privateKey == nil { + return nil, errNoPrivateKey + } + + tip, err := client.HeaderByNumber(context.Background(), nil) + if err != nil { + return nil, err + } + + // Start at the tip + epochStartBlockNumber := tip.Number.Uint64() + // getLatestBlockNumberFn is used by the GasPriceUpdater + // to get the latest block number + getLatestBlockNumberFn := wrapGetLatestBlockNumberFn(client) + // updateL2GasPriceFn is used by the GasPriceUpdater to + // update the gas price + updateL2GasPriceFn, err := wrapUpdateL2GasPriceFn(client, cfg) + if err != nil { + return nil, err + } + + log.Info("Creating GasPriceUpdater", "epochStartBlockNumber", epochStartBlockNumber, + "averageBlockGasLimitPerEpoch", cfg.averageBlockGasLimitPerEpoch, + "epochLengthSeconds", cfg.epochLengthSeconds) + + gasPriceUpdater, err := gasprices.NewGasPriceUpdater( + gasPricer, + epochStartBlockNumber, + cfg.averageBlockGasLimitPerEpoch, + cfg.epochLengthSeconds, + getLatestBlockNumberFn, + updateL2GasPriceFn, + ) + + if err != nil { + return nil, err + } + + gpo := GasPriceOracle{ + chainID: chainID, + ctx: context.Background(), + stop: make(chan struct{}), + contract: contract, + gasPriceUpdater: gasPriceUpdater, + config: cfg, + backend: client, + } + + if err := gpo.ensure(); err != nil { + return nil, err + } + + return &gpo, nil +} diff --git a/go/gas-oracle/oracle/updater_interface.go b/go/gas-oracle/oracle/updater_interface.go new file mode 100644 index 000000000000..91ad6560da1b --- /dev/null +++ b/go/gas-oracle/oracle/updater_interface.go @@ -0,0 +1,200 @@ +package oracle + +import ( + "context" + "errors" + "math/big" + "time" + + "github.com/ethereum-optimism/optimism/go/gas-oracle/bindings" + ometrics "github.com/ethereum-optimism/optimism/go/gas-oracle/metrics" + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" +) + +var ( + txSendCounter = metrics.NewRegisteredCounter("tx/send", ometrics.DefaultRegistry) + txNotSignificantCounter = metrics.NewRegisteredCounter("tx/not-significant", ometrics.DefaultRegistry) + gasPriceGauge = metrics.NewRegisteredGauge("gas-price", ometrics.DefaultRegistry) + txConfTimer = metrics.NewRegisteredTimer("tx/confirmed", ometrics.DefaultRegistry) + txSendTimer = metrics.NewRegisteredTimer("tx/send", ometrics.DefaultRegistry) +) + +// getLatestBlockNumberFn is used by the GasPriceUpdater +// to get the latest block number. The outer function binds the +// inner function to a `bind.ContractBackend` which is implemented +// by the `ethclient.Client` +func wrapGetLatestBlockNumberFn(backend bind.ContractBackend) func() (uint64, error) { + return func() (uint64, error) { + tip, err := backend.HeaderByNumber(context.Background(), nil) + if err != nil { + return 0, err + } + return tip.Number.Uint64(), nil + } +} + +// DeployContractBackend represents the union of the +// DeployBackend and the ContractBackend +type DeployContractBackend interface { + bind.DeployBackend + bind.ContractBackend +} + +// updateL2GasPriceFn is used by the GasPriceUpdater +// to update the L2 gas price +// perhaps this should take an options struct along with the backend? +// how can this continue to be decomposed? +func wrapUpdateL2GasPriceFn(backend DeployContractBackend, cfg *Config) (func(uint64) error, error) { + if cfg.privateKey == nil { + return nil, errNoPrivateKey + } + if cfg.chainID == nil { + return nil, errNoChainID + } + + opts, err := bind.NewKeyedTransactorWithChainID(cfg.privateKey, cfg.chainID) + if err != nil { + return nil, err + } + // Once https://github.com/ethereum/go-ethereum/pull/23062 is released + // then we can remove setting the context here + if opts.Context == nil { + opts.Context = context.Background() + } + // Don't send the transaction using the `contract` so that we can inspect + // it beforehand + opts.NoSend = true + + // Create a new contract bindings in scope of the updateL2GasPriceFn + // that is returned from this function + contract, err := bindings.NewGasPriceOracle(cfg.gasPriceOracleAddress, backend) + if err != nil { + return nil, err + } + + return func(updatedGasPrice uint64) error { + log.Trace("UpdateL2GasPriceFn", "gas-price", updatedGasPrice) + if cfg.gasPrice == nil { + // Set the gas price manually to use legacy transactions + gasPrice, err := backend.SuggestGasPrice(context.Background()) + if err != nil { + log.Error("cannot fetch gas price", "message", err) + return err + } + log.Trace("fetched L2 tx.gasPrice", "gas-price", gasPrice) + opts.GasPrice = gasPrice + } else { + // Allow a configurable gas price to be set + opts.GasPrice = cfg.gasPrice + } + + // Query the current L2 gas price + currentPrice, err := contract.GasPrice(&bind.CallOpts{ + Context: context.Background(), + }) + if err != nil { + log.Error("cannot fetch current gas price", "message", err) + return err + } + + // no need to update when they are the same + if currentPrice.Uint64() == updatedGasPrice { + log.Info("gas price did not change", "gas-price", updatedGasPrice) + txNotSignificantCounter.Inc(1) + return nil + } + + // Only update the gas price when it must be changed by at least + // a paramaterizable amount. + if !isDifferenceSignificant(currentPrice.Uint64(), updatedGasPrice, cfg.significanceFactor) { + log.Info("gas price did not significantly change", "min-factor", cfg.significanceFactor, + "current-price", currentPrice, "next-price", updatedGasPrice) + txNotSignificantCounter.Inc(1) + return nil + } + + // Set the gas price by sending a transaction + tx, err := contract.SetGasPrice(opts, new(big.Int).SetUint64(updatedGasPrice)) + if err != nil { + return err + } + + log.Debug("sending transaction", "tx.gasPrice", tx.GasPrice(), "tx.gasLimit", tx.Gas(), + "tx.data", hexutil.Encode(tx.Data()), "tx.to", tx.To().Hex(), "tx.nonce", tx.Nonce()) + pre := time.Now() + if err := backend.SendTransaction(context.Background(), tx); err != nil { + return err + } + txSendTimer.Update(time.Since(pre)) + log.Info("transaction sent", "hash", tx.Hash().Hex()) + + gasPriceGauge.Update(int64(updatedGasPrice)) + txSendCounter.Inc(1) + + if cfg.waitForReceipt { + // Keep track of the time it takes to confirm the transaction + pre := time.Now() + // Wait for the receipt + receipt, err := waitForReceipt(backend, tx) + if err != nil { + return err + } + txConfTimer.Update(time.Since(pre)) + + log.Info("transaction confirmed", "hash", tx.Hash().Hex(), + "gas-used", receipt.GasUsed, "blocknumber", receipt.BlockNumber) + } + return nil + }, nil +} + +// Only update the gas price when it must be changed by at least +// a paramaterizable amount. If the param is greater than the result +// of 1 - (min/max) where min and max are the gas prices then do not +// update the gas price +func isDifferenceSignificant(a, b uint64, c float64) bool { + max := max(a, b) + min := min(a, b) + factor := 1 - (float64(min) / float64(max)) + return c <= factor +} + +// Wait for the receipt by polling the backend +func waitForReceipt(backend DeployContractBackend, tx *types.Transaction) (*types.Receipt, error) { + t := time.NewTicker(300 * time.Millisecond) + receipt := new(types.Receipt) + var err error + for range t.C { + receipt, err = backend.TransactionReceipt(context.Background(), tx.Hash()) + if errors.Is(err, ethereum.NotFound) { + continue + } + if err != nil { + return nil, err + } + if receipt != nil { + t.Stop() + break + } + } + return receipt, nil +} + +func max(a, b uint64) uint64 { + if a >= b { + return a + } + return b +} + +func min(a, b uint64) uint64 { + if a >= b { + return b + } + return a +} diff --git a/go/gas-oracle/oracle/updater_interface_test.go b/go/gas-oracle/oracle/updater_interface_test.go new file mode 100644 index 000000000000..3f471dd6a85a --- /dev/null +++ b/go/gas-oracle/oracle/updater_interface_test.go @@ -0,0 +1,202 @@ +package oracle + +import ( + "context" + "crypto/ecdsa" + "math/big" + "testing" + + "github.com/ethereum-optimism/optimism/go/gas-oracle/bindings" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethdb" +) + +func TestWrapGetLatestBlockNumberFn(t *testing.T) { + key, _ := crypto.GenerateKey() + sim, db := newSimulatedBackend(key) + chain := sim.Blockchain() + + getLatest := wrapGetLatestBlockNumberFn(sim) + + // Generate a valid chain of 10 blocks + blocks, _ := core.GenerateChain(chain.Config(), chain.CurrentBlock(), chain.Engine(), db, 10, nil) + + // Check that the latest is 0 to start + latest, err := getLatest() + if err != nil { + t.Fatal(err) + } + if latest != 0 { + t.Fatal("not zero") + } + + // Insert the blocks one by one and assert that they are incrementing + for i, block := range blocks { + if _, err := chain.InsertChain([]*types.Block{block}); err != nil { + t.Fatal(err) + } + latest, err := getLatest() + if err != nil { + t.Fatal(err) + } + // Handle zero index by adding 1 + if latest != uint64(i+1) { + t.Fatal("mismatch") + } + } +} + +func TestWrapUpdateL2GasPriceFn(t *testing.T) { + key, _ := crypto.GenerateKey() + sim, _ := newSimulatedBackend(key) + + opts, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) + addr, _, gpo, err := bindings.DeployGasPriceOracle(opts, sim, opts.From, big.NewInt(0)) + if err != nil { + t.Fatal(err) + } + sim.Commit() + + cfg := &Config{ + privateKey: key, + chainID: big.NewInt(1337), + gasPriceOracleAddress: addr, + gasPrice: big.NewInt(676167759), + } + + updateL2GasPriceFn, err := wrapUpdateL2GasPriceFn(sim, cfg) + if err != nil { + t.Fatal(err) + } + + for i := uint64(0); i < 10; i++ { + err := updateL2GasPriceFn(i) + if err != nil { + t.Fatal(err) + } + sim.Commit() + gasPrice, err := gpo.GasPrice(&bind.CallOpts{Context: context.Background()}) + if err != nil { + t.Fatal(err) + } + if gasPrice.Uint64() != i { + t.Fatal("mismatched gas price") + } + } +} + +func TestWrapUpdateL2GasPriceFnNoUpdates(t *testing.T) { + key, _ := crypto.GenerateKey() + sim, _ := newSimulatedBackend(key) + + opts, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) + // Deploy the contract + addr, _, gpo, err := bindings.DeployGasPriceOracle(opts, sim, opts.From, big.NewInt(0)) + if err != nil { + t.Fatal(err) + } + sim.Commit() + + cfg := &Config{ + privateKey: key, + chainID: big.NewInt(1337), + gasPriceOracleAddress: addr, + gasPrice: big.NewInt(772763153), + // the new gas price must change be 50% for it to actually update + significanceFactor: 0.5, + } + updateL2GasPriceFn, err := wrapUpdateL2GasPriceFn(sim, cfg) + if err != nil { + t.Fatal(err) + } + + // Create a function to do the assertions + tryUpdate := func(price uint64, shouldUpdate bool) { + // Get a reference to the original gas price + original, err := gpo.GasPrice(&bind.CallOpts{Context: context.Background()}) + if err != nil { + t.Fatal(err) + } + + // Call the updateL2GasPriceFn and commit the state + if err := updateL2GasPriceFn(price); err != nil { + t.Fatal(err) + } + sim.Commit() + + // Get a reference to the potentially updated state + updated, err := gpo.GasPrice(&bind.CallOpts{Context: context.Background()}) + if err != nil { + t.Fatal(err) + } + + // the assertion differs depending on if it is expected that the + // update occurs or not + switch shouldUpdate { + case true: + // the price passed in should equal updated + if updated.Uint64() != price { + t.Fatalf("mismatched gas price, expect %d - got %d - should update (%t)", updated, price, shouldUpdate) + } + case false: + // the original should match the updated + if original.Uint64() != updated.Uint64() { + t.Fatalf("mismatched gas price, expect %d - got %d - should update (%t)", original, updated, shouldUpdate) + } + } + } + + // tryUpdate(newGasPrice, shouldUpdate) + // The gas price starts out at 0 + // try to update it to 0 and it should not update + tryUpdate(0, false) + // update it to 2 and it should update + tryUpdate(2, true) + // it should not update to 3 + tryUpdate(3, false) + // it should update to 4 + tryUpdate(4, true) + // it should not update back down to 3 + tryUpdate(3, false) + // it should update to 1 + tryUpdate(1, true) +} + +func TestIsDifferenceSignificant(t *testing.T) { + tests := []struct { + name string + a uint64 + b uint64 + sig float64 + expect bool + }{ + {name: "test 1", a: 1, b: 1, sig: 0.05, expect: false}, + {name: "test 2", a: 4, b: 1, sig: 0.25, expect: true}, + {name: "test 3", a: 3, b: 1, sig: 0.1, expect: true}, + {name: "test 4", a: 4, b: 1, sig: 0.9, expect: false}, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + result := isDifferenceSignificant(tc.a, tc.b, tc.sig) + if result != tc.expect { + t.Fatalf("mismatch %s", tc.name) + } + }) + } +} + +func newSimulatedBackend(key *ecdsa.PrivateKey) (*backends.SimulatedBackend, ethdb.Database) { + var gasLimit uint64 = 9_000_000 + auth, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337)) + genAlloc := make(core.GenesisAlloc) + genAlloc[auth.From] = core.GenesisAccount{Balance: big.NewInt(9223372036854775807)} + db := rawdb.NewMemoryDatabase() + sim := backends.NewSimulatedBackendWithDatabase(db, genAlloc, gasLimit) + return sim, db +} diff --git a/go/gas-oracle/package.json b/go/gas-oracle/package.json new file mode 100644 index 000000000000..aff8ad8e87f7 --- /dev/null +++ b/go/gas-oracle/package.json @@ -0,0 +1,6 @@ +{ + "name": "@eth-optimism/gas-oracle", + "version": "0.0.1", + "private": true, + "devDependencies": {} +} diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 9791365d6404..152c82dc0d8c 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -157,7 +157,7 @@ services: ports: - ${VERIFIER_HTTP_PORT:-8547}:8545 - ${VERIFIER_WS_PORT:-8548}:8546 - + replica: depends_on: - dtl @@ -198,3 +198,14 @@ services: ENABLE_GAS_REPORT: 1 NO_NETWORK: 1 + gas_oracle: + image: ethereumoptimism/gas-oracle + deploy: + replicas: 0 + build: + context: .. + dockerfile: ./ops/docker/Dockerfile.gas-oracle + entrypoint: ./gas-oracle.sh + environment: + GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL: http://l2geth:8545 + GAS_PRICE_ORACLE_PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" diff --git a/ops/docker/Dockerfile.gas-oracle b/ops/docker/Dockerfile.gas-oracle new file mode 100644 index 000000000000..23af993d2068 --- /dev/null +++ b/ops/docker/Dockerfile.gas-oracle @@ -0,0 +1,14 @@ +FROM golang:1.15-alpine3.13 as builder + +RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash + +ADD ./go/gas-oracle /gas-oracle +RUN cd /gas-oracle && make gas-oracle + +FROM alpine:3.13 + +RUN apk add --no-cache ca-certificates jq curl +COPY --from=builder /gas-oracle/gas-oracle /usr/local/bin/ + +COPY ./ops/scripts/gas-oracle.sh . +ENTRYPOINT ["gas-oracle"] diff --git a/ops/envs/geth.env b/ops/envs/geth.env index 6c0a2dfadcb5..60e7c50e59f7 100644 --- a/ops/envs/geth.env +++ b/ops/envs/geth.env @@ -7,6 +7,7 @@ ROLLUP_CLIENT_HTTP= ROLLUP_STATE_DUMP_PATH= ROLLUP_POLL_INTERVAL_FLAG=500ms ROLLUP_ENABLE_L2_GAS_POLLING=true +ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 # ROLLUP_ENFORCE_FEES= ETHERBASE=0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf diff --git a/ops/scripts/gas-oracle.sh b/ops/scripts/gas-oracle.sh new file mode 100755 index 000000000000..a8ed6c5d27fb --- /dev/null +++ b/ops/scripts/gas-oracle.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +RETRIES=${RETRIES:-40} + +if [[ -z $GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL ]]; then + echo "Must set env GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL" + exit 1 +fi + +# waits for l2geth to be up +curl --fail \ + --show-error \ + --silent \ + --retry-connrefused \ + --retry $RETRIES \ + --retry-delay 1 \ + --output /dev/null \ + $GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL + +exec gas-oracle "$@" diff --git a/package.json b/package.json index 21cd488ee6f7..91152a3c51cc 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "packages/*", "l2geth", "integration-tests", - "specs" + "specs", + "go/gas-oracle" ], "nohoist": [ "examples/*"