diff --git a/.gitignore b/.gitignore index 65a1b1ac..42854428 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ main .DS_Store bin/ celo/ -*.tar.gz \ No newline at end of file +*.tar.gz +.vscode diff --git a/.golangci.yml b/.golangci.yml index fb7dfb0e..02e579ff 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,13 +10,11 @@ run: linters: disable-all: true enable: - - deadcode - errcheck - govet - ineffassign - staticcheck - unused - - varcheck - goconst - goimports @@ -41,4 +39,4 @@ issues: - misspell exclude: - - composites \ No newline at end of file + - composites diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index bb2f7da5..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Test package", - "type": "go", - "request": "launch", - "mode": "test", - "program": "${workspaceFolder}" - }, - { - "name": "Launch", - "type": "go", - "request": "launch", - "mode": "auto", - "program": "${fileDirname}", - "env": {}, - "args": [] - } - ] -} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e024bf79..5e37c17f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ RUN go build --tags musl -o rosetta . # Outputs: rosetta & geth binaries on /usr/loca/bin #--------------------------------------------------------------------- # geth mainnet (1.5.1) -FROM us.gcr.io/celo-org/geth:1.5.4 +FROM us.gcr.io/celo-org/geth:1.6.1 ARG COMMIT_SHA RUN apk add --no-cache ca-certificates diff --git a/Makefile b/Makefile index 822a37b7..a8175cc5 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ GO ?= latest GITHUB_ORG?=celo-org GITHUB_REPO?=rosetta -GOLANGCI_VERSION=1.32.2 +GOLANGCI_VERSION=1.50.0 GOLANGCI_exists := $(shell command -v golangci-lint 2> /dev/null) GOLANGCI_v_installed := $(shell echo $(shell golangci-lint --version) | cut -d " " -f 4) diff --git a/README.md b/README.md index fbc0e2d4..d17d0ba2 100644 --- a/README.md +++ b/README.md @@ -40,35 +40,7 @@ For an understanding of inputs & outputs check [servicer.go](./service/rpc/servi ## Command line arguments -The main command is `rosetta run`, whose arguments are: - -```txt -Usage: - rosetta run [flags] - -Flags: - --datadir string datadir to use - --geth.binary string Path to the celo-blockchain binary - --geth.bootnodes string Bootnodes to use (separated by ,) - --geth.cache string Memory (in MB) allocated to geth's internal caching - --geth.gcmode string Geth garbage collection mode (full, archive) (default "full") - --geth.genesis string (Optional) path to the genesis.json, for use with custom chains - --geth.ipcpath string Path to the geth ipc file - --geth.logfile string Path to logs file - --geth.maxpeers string Maximum number of network peers (network disabled if set to 0) (default: 1100) (default "1100") - --geth.network string Network to use, either 'mainnet', 'alfajores', or 'baklava' - --geth.publicip string Public Ip to configure geth (sometimes required for discovery) - --geth.rpcaddr string Geth HTTP-RPC server listening interface (default "127.0.0.1") - --geth.rpcport string Geth HTTP-RPC server listening port (default "8545") - --geth.rpcvhosts string Geth comma separated list of virtual hostnames from which to accept requests (default "localhost") - --geth.staticnodes string StaticNode to use (separated by ,) - --geth.syncmode string Geth blockchain sync mode (fast, full, light) (default "fast") - --geth.verbosity string Geth log verbosity (number between [1-5]) - -h, --help help for run - --rpc.address string Listening address for http server - --rpc.port uint Listening port for http server (default 8080) - --rpc.reqTimeout duration Timeout for requests to this service, this also controls the timeout sent to the blockchain node for trace transaction requests (default 2m0s) -``` +Arguments are described in the help output of the CLI. Every argument can be defined using environment variables using `ROSETTA_` prefix; and replacing `.` for `_`; for example: @@ -77,11 +49,9 @@ ROSETTA_DATADIR="/my/dir" ROSETTA_GETH_NETWORK="alfajores" ``` -Note that from Rosetta `v0.8.4` onwards, it is no longer necessary to pass in either `--geth.bootnodes` or `--geth.staticnodes`, as the geth flag `--alfajores`, `--baklava`, or no flag (for mainnet) will be set automatically, which sets the geth bootnodes appropriately. These flags may still optionally be used but are not recommended if there is not a specific reason to do so. - ## Running the Rosetta RPC Server -Running the Rosetta RPC Server from scratch will take some time to sync, since it runs a full archive node in the background. While it may be possible to run the Construction API in the future with a non-archive node, this is still required by the Rosetta spec for the Data API implementation in order to perform balance reconciliation. +Running the Rosetta RPC Server from scratch will take a very long time to sync and require at least 1.5TB of storage space, since it runs a full archive node in the background. While it may be possible to run the Construction API in the future with a non-archive node, this is still required by the Rosetta spec for the Data API implementation in order to perform balance reconciliation. ### Version 1: Running from `rosetta` source code @@ -211,6 +181,14 @@ Rosetta uses [kliento](https://github.com/celo-org/kliento) to interact with the ## How to run rosetta-cli-checks +_Note that running these checks is most likely infeasible for most people on +mainnet because you will need at least 1.5 terrabytes of space and several days +to be able to sync the chain. Under the hood, the service is syncing a full +archive node, which takes a long time. The construction service needs to reach +the tip before submitting transactions. The data checks will take a while to +complete as well (likely a couple of days on a normal laptop with the current +settings) as they reconcile balances for the entire chain._ + - Install the [`rosetta-cli`](https://github.com/coinbase/rosetta-cli) according to the instructions. (Note that on Mac, installing the `rosetta-cli` to `/usr/local/bin` or adding its location to you `$PATH` will allow you to call `rosetta-cli` directly on the command line rather than needing to provide the path to the executable). Current testing has been done with `v0.5.16` of the `rosetta-cli`. - Run the Rosetta service in the background for the respective network (currently only alfajores for both Data and Construction checks) - Run the CLI checks for alfajores as follows: @@ -220,7 +198,6 @@ Rosetta uses [kliento](https://github.com/celo-org/kliento) to interact with the rosetta-cli check:construction --configuration-file PATH/TO/rosetta/rosetta-cli-conf/testnet/cli-config.json ``` -_Note that running the checks to completion will take a long time if this is the first time you are running Rosetta locally. Under the hood, the service is syncing a full archive node, which takes time (likely a couple of days on a normal laptop). The construction service needs to reach the tip before submitting transactions. The data checks will take a while to complete as well (likely a couple of days on a normal laptop with the current settings) as they reconcile balances for the entire chain._ ### How to generate `bootstrap_balances.json` diff --git a/analyzer/operations.go b/analyzer/operations.go index 7c19ae4b..5e6e1790 100644 --- a/analyzer/operations.go +++ b/analyzer/operations.go @@ -198,17 +198,20 @@ func NewAuthorizeSigner(from common.Address, signer common.Address, authorizeOp // Ex. Slash(penalty=110, reward=100 cGlD), tobinTax == 10% // Transfer Operation: -// lockedGoldContractAccMain -9 -// communityFundAccMain 9 -// lockedGoldContractAccMain -1 -// tobinRecipientAccMain 1 +// +// lockedGoldContractAccMain -9 +// communityFundAccMain 9 +// lockedGoldContractAccMain -1 +// tobinRecipientAccMain 1 +// // LockedGold Operation (created from `AccountSlashed(slashed, -100, reporter, 110)` event): -// slashedAccLockedGoldNonVoting -110 -// reporterAccLockedGoldNonVoting 100 -// lockedGoldContractAccMain -9 -// communityFundAccMain 9 -// lockedGoldContractAccMain -1 -// tobinRecipientAccMain 1 +// +// slashedAccLockedGoldNonVoting -110 +// reporterAccLockedGoldNonVoting 100 +// lockedGoldContractAccMain -9 +// communityFundAccMain 9 +// lockedGoldContractAccMain -1 +// tobinRecipientAccMain 1 func NewSlash(slashed, slasher, communityFund, lockedGoldAddr common.Address, penalty, reward *big.Int, tobinTax *TobinTax) *Operation { communityFundReward := new(big.Int).Sub(penalty, reward) return &Operation{ @@ -223,20 +226,25 @@ func NewSlash(slashed, slasher, communityFund, lockedGoldAddr common.Address, pe // Ex. lock(100 cGlD), tobinTax == 10% // Transfer Operation: -// fromAccMain -90 -// lockedGoldContractAccMain 90 -// fromAccMain -10 -// tobinRecipientAccMain 10 +// +// fromAccMain -90 +// lockedGoldContractAccMain 90 +// fromAccMain -10 +// tobinRecipientAccMain 10 +// // LockedGold Operation (created from `GoldLocked(fromAccount, 90)` event): -// fromAccMain -90 -// lockedGoldContractAccMain 90 -// fromAccLockedNonVoting 90 +// +// fromAccMain -90 +// lockedGoldContractAccMain 90 +// fromAccLockedNonVoting 90 +// // Reconciled Operation: -// fromAccMain -90 -// lockedGoldContractAccMain 90 -// fromAccMain -10 -// tobinRecipientAccMain 10 -// fromAccLockedNonVoting 90 +// +// fromAccMain -90 +// lockedGoldContractAccMain 90 +// fromAccMain -10 +// tobinRecipientAccMain 10 +// fromAccLockedNonVoting 90 func NewLockGold(addr, lockedGoldAddr common.Address, value *big.Int) *Operation { return &Operation{ Type: OpLockGold, @@ -251,16 +259,19 @@ func NewLockGold(addr, lockedGoldAddr common.Address, value *big.Int) *Operation // Ex. Withdraw(100 cGlD), tobinTax == 10% // Transfer Operation: -// lockedGoldContractAccMain -90 -// toAccMain 90 -// lockedGoldContractAccMain -10 -// tobinRecipientAccMain 10 +// +// lockedGoldContractAccMain -90 +// toAccMain 90 +// lockedGoldContractAccMain -10 +// tobinRecipientAccMain 10 +// // LockedGold Operation (created from `GoldWithdraw(toAccount, 100)` event): -// lockedGoldContractAccMain -90 -// toAccMain 90 -// lockedGoldContractAccMain -10 -// tobinRecipientAccMain 10 -// AccLockedPending -100 +// +// lockedGoldContractAccMain -90 +// toAccMain 90 +// lockedGoldContractAccMain -10 +// tobinRecipientAccMain 10 +// AccLockedPending -100 func NewWithdrawGold(addr, lockedGoldAddr common.Address, value *big.Int, tobinTax *TobinTax) *Operation { return &Operation{ Type: OpWithdrawGold, @@ -435,26 +446,32 @@ func ReconcileLogOpsWithTransfers(logOps, transferOps []Operation, tobinTax *Tob // by combining their balance changes // // operations match with tobin tax iff -// logOp.Type == OpLockGold && -// logOp.lockedGoldContractAccMain.diff == trOp.lockedGoldContractAccMain.diff && -// logOp.fromAccMain.diff - trOp.fromAccMain.diff == trOp.tobinRecipientAccMain.diff +// +// logOp.Type == OpLockGold && +// logOp.lockedGoldContractAccMain.diff == trOp.lockedGoldContractAccMain.diff && +// logOp.fromAccMain.diff - trOp.fromAccMain.diff == trOp.tobinRecipientAccMain.diff // // Ex. lock(100 cGlD), tobinTax == 10% // Transfer Operation: -// fromAccMain -90 -// lockedGoldContractAccMain 90 -// fromAccMain -10 // diff == -100 -// tobinRecipientAccMain 10 +// +// fromAccMain -90 +// lockedGoldContractAccMain 90 +// fromAccMain -10 // diff == -100 +// tobinRecipientAccMain 10 +// // LockedGold Operation (created from `GoldLocked(fromAccount, 90)` event): -// fromAccMain -90 // diff == -90 -// lockedGoldContractAccMain 90 -// fromAccLockedNonVoting 90 +// +// fromAccMain -90 // diff == -90 +// lockedGoldContractAccMain 90 +// fromAccLockedNonVoting 90 +// // Reconciled Operation: -// fromAccMain -90 -// lockedGoldContractAccMain 90 -// fromAccMain -10 -// tobinRecipientAccMain 10 -// fromAccLockedNonVoting 90 +// +// fromAccMain -90 +// lockedGoldContractAccMain 90 +// fromAccMain -10 +// tobinRecipientAccMain 10 +// fromAccLockedNonVoting 90 func MatchAndReconcileLogOpWithTransfer(logOp, trOp *Operation, tobinTax *TobinTax, lockedGold common.Address) bool { // If the operations match as is then we can just return true diff --git a/cmd/cli/block.go b/cmd/cli/block.go index 36d3d91e..c6cba6bb 100644 --- a/cmd/cli/block.go +++ b/cmd/cli/block.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index 936bad5e..e9dd5fbc 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/cmd/cli/reconcile.go b/cmd/cli/reconcile.go index 98551b47..26bce92d 100644 --- a/cmd/cli/reconcile.go +++ b/cmd/cli/reconcile.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/cmd/root.go b/cmd/root.go index b8290902..135d8201 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/cmd/run.go b/cmd/run.go index c9de9759..663cc103 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -35,6 +35,7 @@ import ( "github.com/celo-org/rosetta/service/rpc" "github.com/spf13/cobra" "github.com/spf13/viper" + "golang.org/x/sync/errgroup" ) // serveCmd represents the serve command @@ -70,29 +71,30 @@ func init() { flagSet.String("geth.binary", "", "Path to the celo-blockchain binary") utils.ExitOnError(serveCmd.MarkFlagFilename("geth.binary")) - flagSet.String("geth.logfile", "", "Path to logs file") + flagSet.String("geth.logfile", "", "Path to logs file (default /celo.log)") utils.ExitOnError(serveCmd.MarkFlagDirname("geth.logfile")) - flagSet.String("geth.ipcpath", "", "Path to the geth ipc file") + flagSet.String("geth.ipcpath", "geth.ipc", "Path to the geth ipc file. Under if path is relative") utils.ExitOnError(serveCmd.MarkFlagFilename("geth.ipcpath")) flagSet.String("geth.genesis", "", "(Optional) path to the genesis.json, for use with custom chains") utils.ExitOnError(serveCmd.MarkFlagFilename("geth.genesis", "json")) + // Note that we do not set any default here because it would clash with geth.genesis if that was defined. flagSet.String("geth.network", "", "Network to use, either 'mainnet', 'alfajores', or 'baklava'") - flagSet.String("geth.staticnodes", "", "StaticNode to use (separated by ,)") - flagSet.String("geth.bootnodes", "", "Bootnodes to use (separated by ,)") - flagSet.String("geth.verbosity", "", "Geth log verbosity (number between [1-5])") + flagSet.String("geth.staticnodes", "", "List of nodes to remain permanently connected to (separated by ,) (default empty)") + flagSet.String("geth.bootnodes", "", "Bootnodes to use (separated by ,) (default, hardcoded based on geth.network flag)") + flagSet.String("geth.verbosity", "3", "Geth log verbosity (number between [1-5])") flagSet.String("geth.publicip", "", "Public Ip to configure geth (sometimes required for discovery)") - flagSet.String("geth.cache", "", "Memory (in MB) allocated to geth's internal caching") + flagSet.String("geth.cache", "1024", "Memory (in MB) allocated to geth's internal caching") - flagSet.String("geth.rpcaddr", "127.0.0.1", "Geth HTTP-RPC server listening interface") + flagSet.String("geth.rpcaddr", "localhost", "Geth HTTP-RPC server listening interface") flagSet.String("geth.rpcport", "8545", "Geth HTTP-RPC server listening port") flagSet.String("geth.rpcvhosts", "localhost", "Geth comma separated list of virtual hostnames from which to accept requests") flagSet.String("geth.syncmode", "fast", "Geth blockchain sync mode (fast, full, light)") flagSet.String("geth.gcmode", "full", "Geth garbage collection mode (full, archive)") - flagSet.String("geth.maxpeers", "1100", "Maximum number of network peers (network disabled if set to 0) (default: 1100)") + flagSet.String("geth.maxpeers", "1100", "Maximum number of network peers (network disabled if set to 0)") } func getDatadir(cmd *cobra.Command) string { @@ -168,10 +170,6 @@ func runRunCmd(cmd *cobra.Command, args []string) { } func runAllServices(ctx context.Context, sqlitePath string, gethOpts *geth.GethOpts, rpcConfig *rpc.RosettaServerConfig) error { - ctx, stopServices := context.WithCancel(ctx) - defer stopServices() - - sm := service.NewServiceManager(ctx) gethSrv := geth.NewGethService(gethOpts) @@ -184,14 +182,36 @@ func runAllServices(ctx context.Context, sqlitePath string, gethOpts *geth.GethO return fmt.Errorf("can't open rosetta.db: %w", err) } - sm.Add(gethSrv) - - gethStarted := utils.WaitUntil(500*time.Millisecond, 5*time.Minute, func() bool { - return fileutils.FileExists(gethSrv.IpcFilePath()) + ec := service.NewErrorCollector() + grp, ctx := errgroup.WithContext(ctx) + grp.Go(func() error { + err := gethSrv.Start(ctx) + if err != nil { + fmt.Println("error running geth serrvice") + ec.Add(fmt.Errorf("error running geth service: %w", err)) + return err + } + return nil }) - if !gethStarted { - return fmt.Errorf("geth service failed to start before timeout: %d", time.Millisecond) + ctxWithTimeout, stop := context.WithTimeout(ctx, 5*time.Minute) + defer stop() +loop: + for { + select { + case <-time.After(500 * time.Millisecond): + if fileutils.FileExists(gethSrv.IpcFilePath()) { + break loop // break out of the for loop + } + case <-ctxWithTimeout.Done(): + err := ctxWithTimeout.Err() + switch { + case err == context.Canceled: + return fmt.Errorf("Geth service died before deadline, check the log %s", gethOpts.LogFile()) + case err == context.DeadlineExceeded: + return fmt.Errorf("Geth service did not create ipc file within deadline, check the log: %s", gethOpts.LogFile()) + } + } } chainParams := gethSrv.ChainParameters() @@ -207,7 +227,26 @@ func runAllServices(ctx context.Context, sqlitePath string, gethOpts *geth.GethO return fmt.Errorf("can't create rpc server: %w", err) } - sm.Add(rpcService) - sm.Add(monitor.NewMonitorService(cc, celoStore)) - return sm.Wait() + grp.Go(func() error { + err := rpcService.Start(ctx) + if err != nil { + fmt.Println("error running rpc serrvice") + ec.Add(fmt.Errorf("error running rpc service : %w", err)) + return err + } + return nil + }) + grp.Go(func() error { + err = monitor.NewMonitorService(cc, celoStore).Start(ctx) + if err != nil { + fmt.Println("error running mon serrvice") + ec.Add(fmt.Errorf("error running monitor service : %w", err)) + return err + } + return nil + }) + // We gather errors in the error collector, so no need to check the error group error. + //nolint:errcheck + grp.Wait() + return ec.Error() } diff --git a/go.mod b/go.mod index 92201c45..25d28e8a 100644 --- a/go.mod +++ b/go.mod @@ -4,16 +4,25 @@ go 1.15 require ( github.com/allegro/bigcache v1.2.1 // indirect - github.com/celo-org/celo-blockchain v1.5.4 - github.com/celo-org/kliento v0.2.1-0.20220301112806-fb1968d272c2 + github.com/celo-org/celo-blockchain v1.6.1 + github.com/celo-org/celo-bls-go v0.6.4 // indirect + github.com/celo-org/celo-bls-go-android v0.6.4 // indirect + github.com/celo-org/celo-bls-go-ios v0.6.4 // indirect + github.com/celo-org/celo-bls-go-linux v0.6.4 // indirect + github.com/celo-org/celo-bls-go-macos v0.6.4 // indirect + github.com/celo-org/celo-bls-go-other v0.6.4 // indirect + github.com/celo-org/celo-bls-go-windows v0.6.4 // indirect + github.com/celo-org/kliento v0.2.1-0.20221024130050-896466f9e8df github.com/coinbase/rosetta-sdk-go v0.5.9 github.com/felixge/httpsnoop v1.0.1 + github.com/go-stack/stack v1.8.1 // indirect github.com/gorilla/handlers v1.4.2 github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/onsi/gomega v1.10.1 github.com/rjeczalik/notify v0.9.2 // indirect github.com/spf13/cobra v1.0.0 github.com/spf13/viper v1.6.3 - golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + golang.org/x/crypto v0.1.0 // indirect + golang.org/x/net v0.1.0 + golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 ) diff --git a/go.sum b/go.sum index 12d10866..5c32b627 100644 --- a/go.sum +++ b/go.sum @@ -88,12 +88,31 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/buraksezer/consistent v0.0.0-20191006190839-693edf70fd72 h1:fUmDBbSvv1uOzo/t8WaxZMVb7BxJ8JECo5lGoR9c5bA= github.com/buraksezer/consistent v0.0.0-20191006190839-693edf70fd72/go.mod h1:OEE5igu/CDjGegM1Jn6ZMo7R6LlV/JChAkjfQQIRLpg= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= -github.com/celo-org/celo-blockchain v1.5.4 h1:FUdTkegJZx5MwK4juMgDodpA1OOirey8HvUsqS7A6mA= -github.com/celo-org/celo-blockchain v1.5.4/go.mod h1:j18Hg9JZeOg6d5pbFC8Y5ykt1NDs9lmHesyHd91r0PE= -github.com/celo-org/celo-bls-go v0.2.4 h1:V1y92kM5IRJWQZ6DCwqiKLW7swmUA5y/dPJ9YbU4HfA= +github.com/celo-org/celo-blockchain v1.6.1 h1:Kv+OXLXwdORDz3aIrGY1oCuw0aYSlK4KH7o8cGxO8FU= +github.com/celo-org/celo-blockchain v1.6.1/go.mod h1:NdcP5idffWajmOP79Q0PCRfaFNTmTdSKBMbngLDxjpQ= github.com/celo-org/celo-bls-go v0.2.4/go.mod h1:eXUCLXu5F1yfd3M+3VaUk5ZUXaA0sLK2rWdLC1Cfaqo= -github.com/celo-org/kliento v0.2.1-0.20220301112806-fb1968d272c2 h1:eVkrAvceM07Th1n1drLwZYeRdL+xkPUXVRz+dekcbuA= -github.com/celo-org/kliento v0.2.1-0.20220301112806-fb1968d272c2/go.mod h1:H/MBXntXRVilGnGuBb197O1epsMe/Im9xYGMFNZIxoU= +github.com/celo-org/celo-bls-go v0.6.4 h1:zBf6pEr9k64gaO0VSYnDfLCBmrxDigc4yUaDvWub5G8= +github.com/celo-org/celo-bls-go v0.6.4/go.mod h1:apSlSDPoXIdGseCS4Z2AMrhO5B1xpIVTXYpfv/uRd04= +github.com/celo-org/celo-bls-go-android v0.6.3/go.mod h1:N8rOFwyCS3Ff9p45/rLfdLWfoyFwOvjVQ6F+VKbmIbU= +github.com/celo-org/celo-bls-go-android v0.6.4 h1:l7TclAz+z88ezJMSzO2dVAWIEaeYoJJfmZdCyJEc4hM= +github.com/celo-org/celo-bls-go-android v0.6.4/go.mod h1:N8rOFwyCS3Ff9p45/rLfdLWfoyFwOvjVQ6F+VKbmIbU= +github.com/celo-org/celo-bls-go-ios v0.6.3/go.mod h1:huG1qfXZVMDkFmEZo4UYOAu46EEzYrR8brE4flPul5c= +github.com/celo-org/celo-bls-go-ios v0.6.4 h1:B0d4xlFR5ohIjd4L3czk0dSOI3ei77TcrhKvmn15CMI= +github.com/celo-org/celo-bls-go-ios v0.6.4/go.mod h1:huG1qfXZVMDkFmEZo4UYOAu46EEzYrR8brE4flPul5c= +github.com/celo-org/celo-bls-go-linux v0.6.3/go.mod h1:E6fEQ+whLgMqEToE1e3FWf/9+ikG+wNE5ik7z5Dxgbc= +github.com/celo-org/celo-bls-go-linux v0.6.4 h1:3tA8unMy5/fDVo7eisW4csIvxu+H6cI22+vTpBvVrRE= +github.com/celo-org/celo-bls-go-linux v0.6.4/go.mod h1:E6fEQ+whLgMqEToE1e3FWf/9+ikG+wNE5ik7z5Dxgbc= +github.com/celo-org/celo-bls-go-macos v0.6.3/go.mod h1:RC05VQ2cvF8vMc0tpLc7pfp8oSKrrGcI+o5LLXGequk= +github.com/celo-org/celo-bls-go-macos v0.6.4 h1:GzgNGCyCeHH3nSynbeQ/l4lxiHMg3qo7I8y0LPnY94A= +github.com/celo-org/celo-bls-go-macos v0.6.4/go.mod h1:RC05VQ2cvF8vMc0tpLc7pfp8oSKrrGcI+o5LLXGequk= +github.com/celo-org/celo-bls-go-other v0.6.3/go.mod h1:1xEWTbCXUrDx3Z6R9YlLi1zFNNn1oMMnEcpLbcW+q74= +github.com/celo-org/celo-bls-go-other v0.6.4 h1:eLSX8338ZC9YzYjeoEsVnODtSbzq22F4B0WCni3/BF8= +github.com/celo-org/celo-bls-go-other v0.6.4/go.mod h1:1xEWTbCXUrDx3Z6R9YlLi1zFNNn1oMMnEcpLbcW+q74= +github.com/celo-org/celo-bls-go-windows v0.6.3/go.mod h1:8bRJbLcHREIAWn+5iZM3u8rGPBsWepp9BdF3SexisuM= +github.com/celo-org/celo-bls-go-windows v0.6.4 h1:4w+NllEORQbsQnqpXO7UC+xDUbZQgiMPMnnyzLFA+ck= +github.com/celo-org/celo-bls-go-windows v0.6.4/go.mod h1:8bRJbLcHREIAWn+5iZM3u8rGPBsWepp9BdF3SexisuM= +github.com/celo-org/kliento v0.2.1-0.20221024130050-896466f9e8df h1:Th3X69EV3bYVtGDq+oJXV1LHi3vFSOGBDHe1n8K2fP8= +github.com/celo-org/kliento v0.2.1-0.20221024130050-896466f9e8df/go.mod h1:E5olI06v1Ax1O6Ad8vKU4TYkWNxxki7CSpO2EHK79Qc= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -123,6 +142,7 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= 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= @@ -131,6 +151,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs 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/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= +github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= @@ -141,6 +163,7 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUn 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/docker/docker v1.6.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= @@ -162,9 +185,12 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo 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/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 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-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= 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= @@ -175,14 +201,18 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-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/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= 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.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 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= @@ -207,8 +237,10 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw 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.2-0.20200707131729-196ae77b8a26/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/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= 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= @@ -243,10 +275,12 @@ github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qH 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-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= -github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -272,8 +306,11 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= 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/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= 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= @@ -299,10 +336,10 @@ github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod 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.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -319,6 +356,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 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/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= 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/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= @@ -326,16 +365,22 @@ github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-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/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= @@ -350,8 +395,11 @@ github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4f github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -464,14 +512,15 @@ github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -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/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tidwall/gjson v1.6.1/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= @@ -488,6 +537,9 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/vmihailenco/msgpack/v5 v5.0.0-beta.9/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo= github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= @@ -495,7 +547,9 @@ github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+m github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -517,8 +571,11 @@ golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= +golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= 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= @@ -548,8 +605,10 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG 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.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 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= @@ -569,14 +628,19 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL 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-20200226121028-0de0cce0169b/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-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200904194848-62affa334b73/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-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 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/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= 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= @@ -591,8 +655,9 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/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= @@ -610,6 +675,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -624,26 +690,41 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w 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-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-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/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 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/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= @@ -672,7 +753,10 @@ golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapK 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.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 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= @@ -752,10 +836,12 @@ 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.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= 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= diff --git a/internal/build/util.go b/internal/build/util.go deleted file mode 100644 index eea57e56..00000000 --- a/internal/build/util.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package build - -import ( - "fmt" - "log" - "os" - "os/exec" - "strings" -) - -// var DryRunFlag = flag.Bool("n", false, "dry run, don't execute commands") - -// MustRun executes the given command and exits the host process for -// any error. -func MustRun(cmd *exec.Cmd) { - fmt.Println(">>>", strings.Join(cmd.Args, " ")) - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stdout - if err := cmd.Run(); err != nil { - log.Printf("Command failed \"%s\", err: \"%v\"", strings.Join(cmd.Args, " "), err) - log.Fatal(fmt.Sprintf("Command failed \"%s\", err: \"%v\"", strings.Join(cmd.Args, " "), err)) - } -} - -func MustRunCommand(cmd string, args ...string) { - MustRun(exec.Command(cmd, args...)) -} diff --git a/main.go b/main.go index e4811b59..543312a0 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/service/geth/geth.go b/service/geth/geth.go index d808af8d..1da78361 100644 --- a/service/geth/geth.go +++ b/service/geth/geth.go @@ -130,6 +130,12 @@ func (gs *gethService) Setup() error { } } + if gs.opts.StaticNodes != "" { + if err := gs.setupStaticNodes(); err != nil { + return err + } + } + return nil } @@ -139,16 +145,6 @@ func (gs *gethService) Start(ctx context.Context) error { } defer gs.running.Disable() - if err := gs.Setup(); err != nil { - return err - } - - if gs.opts.StaticNodes != "" { - if err := gs.setupStaticNodes(); err != nil { - return err - } - } - gethStderr, err := os.OpenFile(gs.opts.LogFile(), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { gs.logger.Error("Can't open geth logfile", "err", err) @@ -165,16 +161,11 @@ func (gs *gethService) Start(ctx context.Context) error { <-ctx.Done() if err := gs.cmd.Process.Signal(os.Interrupt); err != nil { // Not much else to do. Failed to send a signal - panic(fmt.Errorf("Error sending signal: %w ", err)) + fmt.Printf("Error sending close signal to geth: %v\n", err) } }() - if err := gs.cmd.Wait(); err != nil { - return err - } - - return nil - + return gs.cmd.Wait() } func (gs *gethService) gethCmd(args ...string) *exec.Cmd { @@ -226,18 +217,19 @@ func (gs *gethService) ensureGethInit() error { func (gs *gethService) startGeth(stdErr *os.File) error { gethArgs := []string{ "--nousb", - "--rpc", - "--rpcaddr", gs.opts.RpcAddr, - "--rpcport", gs.opts.RpcPort, - "--rpcvhosts", gs.opts.RpcVHosts, + "--http", + "--http.addr", gs.opts.RpcAddr, + "--http.port", gs.opts.RpcPort, + "--http.vhosts", gs.opts.RpcVHosts, "--syncmode", gs.opts.SyncMode, "--gcmode", gs.opts.GcMode, - "--rpcapi", "eth,net,web3,debug,admin,personal", + "--http.api", "eth,net,web3,debug,admin,personal", "--ipcpath", gs.IpcFilePath(), "--light.serve", "0", "--light.maxpeers", "0", "--maxpeers", gs.opts.MaxPeers, "--consoleformat", "term", + "--txlookuplimit", "0", // "--consoleoutput", "split", } @@ -269,12 +261,11 @@ func (gs *gethService) startGeth(stdErr *os.File) error { gethArgs = append(gethArgs, "--cache", gs.opts.Cache) } - fmt.Println("geth", strings.Join(gethArgs, " ")) - cmd := gs.gethCmd(gethArgs...) cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true} cmd.Stderr = stdErr + fmt.Println("Executing:", strings.Join(cmd.Args, " ")) if err := cmd.Start(); err != nil { gs.logger.Error("Error starting geth", "err", err) return err @@ -296,14 +287,16 @@ func (gopts GethOpts) LogFile() string { } func (gopts GethOpts) IpcFile() string { - if gopts.IpcPath == "" { - return filepath.Join(gopts.Datadir, "geth.ipc") + // If the ipc file is just a file name then place it in the datadir, + // otherwise use the exact path. + if filepath.Base(gopts.IpcPath) == gopts.IpcPath { + return filepath.Join(gopts.Datadir, gopts.IpcPath) } return gopts.IpcPath } func (gopts GethOpts) StaticNodesFile() string { - return filepath.Join(gopts.Datadir, "/celo/static-nodes.json") + return filepath.Join(gopts.Datadir, "/static-nodes.json") } func chainParamsFromGenesisFile(genesisPath string) *chain.ChainParameters { diff --git a/service/geth/geth_test.go b/service/geth/geth_test.go deleted file mode 100644 index 05fc0fc4..00000000 --- a/service/geth/geth_test.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Celo Org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package geth - -import "github.com/celo-org/rosetta/service" - -var _ service.Service = (*gethService)(nil) diff --git a/service/group.go b/service/group.go deleted file mode 100644 index 37cc804f..00000000 --- a/service/group.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2020 Celo Org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package service - -import ( - "context" -) - -type serviceGroup struct { - services []Service - running RunningLock -} - -func Group(services ...Service) *serviceGroup { - return &serviceGroup{ - services: services, - } - -} - -func (sg *serviceGroup) Name() string { - return "servicegroup" -} - -func (sg *serviceGroup) Running() bool { - return sg.running.Running() -} - -func (sg *serviceGroup) Start(ctx context.Context) error { - if err := sg.running.EnableOrFail(); err != nil { - return err - } - defer sg.running.Disable() - - return RunServices(ctx, sg.services...) -} diff --git a/service/group_test.go b/service/group_test.go deleted file mode 100644 index 3319d346..00000000 --- a/service/group_test.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2020 Celo Org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package service - -var _ Service = (*serviceGroup)(nil) diff --git a/service/monitor/service.go b/service/monitor/service.go index 0567db35..d8b4cab2 100644 --- a/service/monitor/service.go +++ b/service/monitor/service.go @@ -80,5 +80,9 @@ func (ms *monitorService) Start(ctx context.Context) error { group.Go(func() error { return HeaderListener(ctx, headerCh, ms.cc, ms.logger, startBlock) }) group.Go(func() error { return BlockProcessor(ctx, headerCh, changeSetsCh, ms.cc, ms.db, ms.logger) }) group.Go(func() error { return ProcessChanges(ctx, changeSetsCh, ms.db, ms.logger) }) - return group.Wait() + err = group.Wait() + if err == context.Canceled { + return nil + } + return err } diff --git a/service/monitor/service_test.go b/service/monitor/service_test.go deleted file mode 100644 index c475b7d7..00000000 --- a/service/monitor/service_test.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Celo Org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package monitor - -import "github.com/celo-org/rosetta/service" - -var _ service.Service = (*monitorService)(nil) diff --git a/service/rpc/rpc_test.go b/service/rpc/rpc_test.go deleted file mode 100644 index 1102a4e9..00000000 --- a/service/rpc/rpc_test.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 Celo Org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package rpc - -import "github.com/celo-org/rosetta/service" - -var _ service.Service = (*rosettaServer)(nil) diff --git a/service/running_lock.go b/service/running_lock.go index 92450dd8..56de02bf 100644 --- a/service/running_lock.go +++ b/service/running_lock.go @@ -14,7 +14,12 @@ package service -import "sync" +import ( + "errors" + "sync" +) + +var ErrAlreadyRunning = errors.New("Service already running") type RunningLock struct { running bool diff --git a/service/service.go b/service/service.go deleted file mode 100644 index efedf0a7..00000000 --- a/service/service.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2020 Celo Org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package service - -import ( - "context" - "errors" - "sync" -) - -var ErrAlreadyRunning = errors.New("Service already running") - -type Service interface { - // Name retrieves the name of the service, that will be used - // to identify the service in log messages - Name() string - - // Running indicates if the service is currently running - Running() bool - - // Start runs the service and blocks until the service finishes, - // returns an error when service failed - Start(ctx context.Context) error -} - -// Rosetta HTTP Service -// Geth Node Service -// Monitor Service (package monitor) - -func RunServices(ctx context.Context, services ...Service) error { - sm := NewServiceManager(ctx) - for _, srv := range services { - sm.Add(srv) - } - return sm.Wait() -} - -type ServiceManager struct { - wg sync.WaitGroup - errorCollector ErrorCollector - ctx context.Context - stopAll context.CancelFunc -} - -func NewServiceManager(ctx context.Context) *ServiceManager { - - ctx, stopAll := context.WithCancel(ctx) - return &ServiceManager{ - ctx: ctx, - stopAll: stopAll, - } - -} - -func (sm *ServiceManager) Add(srv Service) { - sm.wg.Add(1) - go func() { - defer sm.wg.Done() - err := srv.Start(sm.ctx) - if err != nil { - if errors.Is(err, context.Canceled) { - sm.errorCollector.Add(err) - } - sm.stopAll() - } - }() -} - -func (sm *ServiceManager) Wait() error { - sm.wg.Wait() - return sm.errorCollector.Error() -} diff --git a/service/utils.go b/service/utils.go index 21290f2c..d3ff68a7 100644 --- a/service/utils.go +++ b/service/utils.go @@ -15,11 +15,9 @@ package service import ( - "context" "errors" "strings" "sync" - "time" ) type ErrorCollector struct { @@ -57,79 +55,3 @@ func (ec *ErrorCollector) Error() error { return errors.New(errStr.String()) } - -type delayedService struct { - srv Service - delay time.Duration - running RunningLock -} - -func WithDelay(srv Service, delay time.Duration) Service { - return &delayedService{ - srv: srv, - delay: delay, - } -} - -func (ds *delayedService) Name() string { - return ds.srv.Name() -} - -func (ds *delayedService) Running() bool { - return ds.running.Running() -} - -func (ds *delayedService) Start(ctx context.Context) error { - select { - case <-time.After(ds.delay): - case <-ctx.Done(): - return nil - } - - return ds.srv.Start(ctx) -} - -type ServieFactory func() (Service, error) - -type lazyService struct { - factory ServieFactory - srv Service - name string -} - -func LazyService(name string, factory func() (Service, error)) *lazyService { - return &lazyService{ - name: name, - factory: factory, - } -} - -func (ls *lazyService) Name() string { - if ls.srv == nil { - return ls.name - } - return ls.srv.Name() -} - -func (ls *lazyService) Running() bool { - if ls.srv == nil { - return false - } - return ls.srv.Running() -} - -func (ls *lazyService) Start(ctx context.Context) error { - // TODO improve - if ls.srv != nil { - return ErrAlreadyRunning - } - - srv, err := ls.factory() - if err != nil { - return err - } - - ls.srv = srv - - return ls.srv.Start(ctx) -} diff --git a/service/utils_test.go b/service/utils_test.go deleted file mode 100644 index 38fa7b88..00000000 --- a/service/utils_test.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2020 Celo Org -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package service - -var _ Service = (*lazyService)(nil) -var _ Service = (*delayedService)(nil)