Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix lint #341

Merged
merged 4 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix linter
  • Loading branch information
RafilxTenfen committed Aug 8, 2022
commit 9aae95baf64577b318f2bdf7478a90e118c99977
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ run:
skip-dirs:
- test
- diagrams
go: '1.17'

govet:
# Enable analyzers by name (in addition to default).
Expand Down Expand Up @@ -67,6 +68,7 @@ linters-settings:
locale: US
nolintlint:
allow-unused: false
# Disable to ensure that nolint directives don't have a leading space. Default is true.
allow-leading-space: true
require-explanation: false
require-specific: false
2 changes: 1 addition & 1 deletion cmd/peggo/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

var (
// nolint: lll
//nolint: lll
maxUint256 = new(big.Int).SetBytes(ethcmn.Hex2Bytes("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))
halfMaxUint256 = new(big.Int).Div(maxUint256, big.NewInt(2))
)
Expand Down
10 changes: 5 additions & 5 deletions cmd/peggo/flags.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint: lll
package peggo

import (
Expand Down Expand Up @@ -72,7 +71,7 @@ func cosmosKeyringFlagSet() *pflag.FlagSet {
fs.String(flagCosmosKeyring, keyring.BackendFile, "Specify Cosmos keyring backend (os|file|kwallet|pass|test)")
fs.String(flagCosmosKeyringDir, "", "Specify Cosmos keyring directory, if using file keyring")
fs.String(flagCosmosKeyringApp, "peggo", "Specify Cosmos keyring app name")
fs.String(flagCosmosFrom, "", "Specify the Cosmos orchestrator key name or address. If specified, must exist in keyring, ledger or match the privkey")
fs.String(flagCosmosFrom, "", "Specify the Cosmos orchestrator key name or address. If specified, must exist in keyring, ledger or match the privkey") //nolint: lll
fs.String(flagCosmosFromPassphrase, "", "Specify the keyring passphrase, otherwise STDIN will be used")
fs.String(flagCosmosPK, "", "Specify a Cosmos account private key of the orchestrator in hex")
fs.Bool(flagCosmosUseLedger, false, "Use the Cosmos app on a hardware ledger to sign transactions")
Expand All @@ -86,8 +85,9 @@ func ethereumKeyOptsFlagSet() *pflag.FlagSet {
fs := pflag.NewFlagSet("", pflag.ContinueOnError)

fs.String(flagEthKeystoreDir, "", "Specify the Ethereum keystore directory (Geth-format) prefix")
fs.String(flagEthFrom, "", "Specify the Ethereum from address; If specified, it must exist in the keystore, ledger or match the privkey")
fs.String(flagEthPassphrase, "", "Specify the passphrase to unlock the private key from armor; If empty then STDIN is used")
fs.String(flagEthFrom, "", "Specify the Ethereum from address; If specified, it must exist in the keystore, ledger or match the privkey") //nolint: lll
fs.String(flagEthPassphrase, "", "Specify the passphrase to unlock the private key from armor; If empty then STDIN is used") //nolint: lll

fs.Bool(flagEthUseLedger, false, "Use the Ethereum app on hardware ledger to sign transactions")
return fs
}
Expand All @@ -106,7 +106,7 @@ func bridgeFlagSet() *pflag.FlagSet {
fs := pflag.NewFlagSet("", pflag.ContinueOnError)

fs.String(flagEthRPC, "http:https://localhost:8545", "Specify the RPC address of an Ethereum node")
fs.Int64(flagEthGasPrice, 0, "The Ethereum gas price (in wei) to include in the transaction; If zero, gas price will be estimated")
fs.Int64(flagEthGasPrice, 0, "The Ethereum gas price (in wei) to include in the transaction; If zero, gas price will be estimated") //nolint: lll
fs.Int64(flagEthGasLimit, 6000000, "The Ethereum gas limit to include in the transaction")

return fs
Expand Down
8 changes: 4 additions & 4 deletions cmd/peggo/orchestrator.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint: lll
package peggo

import (
Expand Down Expand Up @@ -274,19 +273,20 @@ func getOrchestratorCmd() *cobra.Command {
},
}

cmd.Flags().String(flagValsetRelayMode, relayer.ValsetRelayModeNone.String(), "Set an (optional) relaying mode for valset updates to Ethereum. Possible values: none, minimum, all")
cmd.Flags().String(flagValsetRelayMode, relayer.ValsetRelayModeNone.String(), "Set an (optional) relaying mode for valset updates to Ethereum. Possible values: none, minimum, all") //nolint: lll
cmd.Flags().Bool(flagRelayBatches, false, "Relay transaction batches to Ethereum")
cmd.Flags().Int64(flagEthBlocksPerLoop, 2000, "Number of Ethereum blocks to process per orchestrator loop")
cmd.Flags().String(flagCoinGeckoAPI, "https://api.coingecko.com/api/v3", "Specify the coingecko API endpoint")
//nolint: lll
cmd.Flags().StringSlice(flagOracleProviders, []string{umeedpfconfig.ProviderBinance, umeedpfconfig.ProviderHuobi},
fmt.Sprintf("Specify the providers to use in the oracle, options \"%s\"", strings.Join([]string{umeedpfconfig.ProviderBinance, umeedpfconfig.ProviderHuobi,
umeedpfconfig.ProviderKraken, umeedpfconfig.ProviderGate, umeedpfconfig.ProviderOkx, umeedpfconfig.ProviderOsmosis}, ",")))
cmd.Flags().Duration(flagEthPendingTXWait, 20*time.Minute, "Time for a pending tx to be considered stale")
cmd.Flags().String(flagEthAlchemyWS, "", "Specify the Alchemy websocket endpoint")
cmd.Flags().Float64(flagProfitMultiplier, 1.0, "Multiplier to apply to relayer profit")
cmd.Flags().Float64(flagRelayerLoopMultiplier, 3.0, "Multiplier for the relayer loop duration (in ETH blocks)")
cmd.Flags().Float64(flagRequesterLoopMultiplier, 60.0, "Multiplier for the batch requester loop duration (in Cosmos blocks)")
cmd.Flags().String(flagCosmosFeeGranter, "", "Set an (optional) fee granter address that will pay for Cosmos fees (feegrant must exist)")
cmd.Flags().Float64(flagRequesterLoopMultiplier, 60.0, "Multiplier for the batch requester loop duration (in Cosmos blocks)") //nolint: lll
cmd.Flags().String(flagCosmosFeeGranter, "", "Set an (optional) fee granter address that will pay for Cosmos fees (feegrant must exist)") //nolint: lll
cmd.Flags().Int64(flagBridgeStartHeight, 0, "Set an (optional) height to wait for the bridge to be available")
cmd.Flags().Int(flagCosmosMsgsPerTx, 10, "Set a maximum number of messages to send per transaction (used for claims)")
cmd.Flags().AddFlagSet(cosmosFlagSet())
Expand Down
3 changes: 1 addition & 2 deletions cmd/peggo/peggo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// nolint: lll
package peggo

import (
Expand Down Expand Up @@ -27,7 +26,7 @@ flag (e.g. PEGGO_COSMOS_PK).`,

cmd.PersistentFlags().String(flagLogLevel, zerolog.InfoLevel.String(), "logging level")
cmd.PersistentFlags().String(flagLogFormat, logLevelText, "logging format (text|json)")
cmd.PersistentFlags().String(flagSvcWaitTimeout, "1m", "Standard wait timeout for external services (e.g. Cosmos daemon gRPC connection)")
cmd.PersistentFlags().String(flagSvcWaitTimeout, "1m", "Standard wait timeout for external services (e.g. Cosmos daemon gRPC connection)") //nolint: lll

cmd.AddCommand(
getOrchestratorCmd(),
Expand Down
4 changes: 2 additions & 2 deletions orchestrator/ethereum/keystore/keycache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"crypto/ecdsa"
// #nosec G505
"crypto/sha1"
"io/ioutil"
"math/big"
"os"
"strings"
"sync"

Expand Down Expand Up @@ -87,7 +87,7 @@ func (k *keyCache) PrivateKey(account ethcmn.Address, password string) (*ecdsa.P

path = strings.TrimPrefix(path, "keystore:https://")

keyJSON, err := ioutil.ReadFile(path)
keyJSON, err := os.ReadFile(path)
if err != nil {
err = errors.Wrap(err, "failed to load a file from keystore")
return nil, err
Expand Down
3 changes: 1 addition & 2 deletions orchestrator/ethereum/keystore/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -109,7 +108,7 @@ func (ks *keyStore) forEachWallet(keystorePath string, fn func(spec *WalletSpec)
// return filepath.SkipDir
// }
var spec *WalletSpec
if data, err := ioutil.ReadFile(path); err != nil {
if data, err := os.ReadFile(path); err != nil {
return err
} else if err = json.Unmarshal(data, &spec); err != nil {
return err
Expand Down