diff --git a/cmd/go-quai/root.go b/cmd/go-quai/root.go index d0cb62d52e..1bcbb2dcdc 100644 --- a/cmd/go-quai/root.go +++ b/cmd/go-quai/root.go @@ -8,7 +8,6 @@ import ( "github.com/spf13/viper" "github.com/dominant-strategies/go-quai/cmd/utils" - "github.com/dominant-strategies/go-quai/common" "github.com/dominant-strategies/go-quai/common/constants" "github.com/dominant-strategies/go-quai/log" ) @@ -40,7 +39,7 @@ func rootCmdPreRun(cmd *cobra.Command, args []string) error { viper.SetConfigFile(configDir + constants.CONFIG_FILE_NAME) viper.SetConfigType("yaml") // load config from file and environment variables - common.InitConfig() + utils.InitConfig() // bind cobra flags to viper instance err := viper.BindPFlags(cmd.Flags()) if err != nil { @@ -57,7 +56,7 @@ func rootCmdPreRun(cmd *cobra.Command, args []string) error { // save config file if SAVE_CONFIG_FILE flag is set to true saveConfigFile := viper.GetBool(utils.SaveConfigFlag.Name) if saveConfigFile { - err := common.SaveConfig() + err := utils.SaveConfig() if err != nil { log.Errorf("error saving config file: %s . Skipping...", err) } else { diff --git a/cmd/go-quai/start.go b/cmd/go-quai/start.go index 1c6aad5f7f..ddbefa9681 100644 --- a/cmd/go-quai/start.go +++ b/cmd/go-quai/start.go @@ -11,7 +11,6 @@ import ( "github.com/dominant-strategies/go-quai/cmd/utils" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/consensus/quai" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/p2p/node" ) @@ -70,7 +69,7 @@ func runStart(cmd *cobra.Command, args []string) error { } // create instance of consensus backend - consensus, err := quai.NewQuaiBackend() + consensus, err := utils.StartQuaiBackend() if err != nil { log.Fatalf("error creating consensus backend: %s", err) } diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go new file mode 100644 index 0000000000..6642a3242a --- /dev/null +++ b/cmd/utils/cmd.go @@ -0,0 +1,156 @@ +package utils + +import ( + "fmt" + + "github.com/dominant-strategies/go-quai/common" + "github.com/dominant-strategies/go-quai/core/vm" + "github.com/dominant-strategies/go-quai/eth" + quai "github.com/dominant-strategies/go-quai/eth" + "github.com/dominant-strategies/go-quai/eth/ethconfig" + "github.com/dominant-strategies/go-quai/internal/quaiapi" + "github.com/dominant-strategies/go-quai/log" + "github.com/dominant-strategies/go-quai/node" + "github.com/dominant-strategies/go-quai/params" + "github.com/dominant-strategies/go-quai/quaistats" + "github.com/spf13/viper" + "io" + "os" + "runtime" + "time" +) + +// Create a new instance of the QuaiBackend consensus service +func StartQuaiBackend() (*quai.QuaiBackend, error) { + + // Make full node + go func() { + log.Info("Starting Prime") + stackPrime := makeFullNode(nil) + defer stackPrime.Close() + StartNode(stackPrime) + stackPrime.Wait() + }() + + time.Sleep(2 * time.Second) + + go func() { + log.Info("Starting Region") + stackRegion := makeFullNode(common.Location{0}) + defer stackRegion.Close() + StartNode(stackRegion) + stackRegion.Wait() + }() + + time.Sleep(2 * time.Second) + + go func() { + log.Info("Starting Zone") + stackZone := makeFullNode(common.Location{0, 0}) + defer stackZone.Close() + StartNode(stackZone) + stackZone.Wait() + }() + + return ð.QuaiBackend{}, nil +} + +func StartNode(stack *node.Node) { + if err := stack.Start(); err != nil { + Fatalf("Error starting protocol stack: %v", err) + } + // TODO: Stop the node if the memory pressure +} + +// makeConfigNode loads quai configuration and creates a blank node instance. +func makeConfigNode(nodeLocation common.Location) (*node.Node, ethconfig.QuaiConfig) { + // Load defaults. + cfg := ethconfig.QuaiConfig{ + Quai: ethconfig.Defaults, + Node: defaultNodeConfig(), + } + + // Apply flags. + // set the node location + log.Info("Node", "Location", nodeLocation) + cfg.Node.NodeLocation = nodeLocation + + SetNodeConfig(&cfg.Node, nodeLocation) + stack, err := node.New(&cfg.Node) + if err != nil { + Fatalf("Failed to create the protocol stack: %v", err) + } + SetQuaiConfig(stack, &cfg.Quai, nodeLocation) + + // TODO: Apply stats + if viper.IsSet(QuaiStatsURLFlag.Name) { + cfg.Ethstats.URL = viper.GetString(QuaiStatsURLFlag.Name) + } + + nodeCtx := nodeLocation.Context() + // Onlt initialize the precompile for the zone chain + if nodeCtx == common.ZONE_CTX { + vm.InitializePrecompiles(nodeLocation) + } + return stack, cfg +} + +func defaultNodeConfig() node.Config { + cfg := node.DefaultConfig + cfg.Name = "" + cfg.Version = params.VersionWithCommit("", "") + cfg.HTTPModules = append(cfg.HTTPModules, "eth") + cfg.WSModules = append(cfg.WSModules, "eth") + return cfg +} + +// makeFullNode loads quai configuration and creates the Quai backend. +func makeFullNode(nodeLocation common.Location) *node.Node { + stack, cfg := makeConfigNode(nodeLocation) + backend, _ := RegisterQuaiService(stack, cfg.Quai, cfg.Node.NodeLocation.Context()) + sendfullstats := viper.GetBool(SendFullStatsFlag.Name) + // Add the Quai Stats daemon if requested. + if cfg.Ethstats.URL != "" { + RegisterQuaiStatsService(stack, backend, cfg.Ethstats.URL, sendfullstats) + } + return stack +} + +// RegisterQuaiService adds a Quai client to the stack. +// The second return value is the full node instance, which may be nil if the +// node is running as a light client. +func RegisterQuaiService(stack *node.Node, cfg ethconfig.Config, nodeCtx int) (quaiapi.Backend, error) { + backend, err := eth.New(stack, &cfg, nodeCtx) + if err != nil { + Fatalf("Failed to register the Quai service: %v", err) + } + return backend.APIBackend, nil +} + +// RegisterQuaiStatsService configures the Quai Stats daemon and adds it to +// the given node. +func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string, sendfullstats bool) { + if err := quaistats.New(stack, backend, backend.Engine(), url, sendfullstats); err != nil { + Fatalf("Failed to register the Quai Stats service: %v", err) + } +} + +// Fatalf formats a message to standard error and exits the program. +// The message is also printed to standard output if standard error +// is redirected to a different file. +func Fatalf(format string, args ...interface{}) { + w := io.MultiWriter(os.Stdout, os.Stderr) + if runtime.GOOS == "windows" { + // The SameFile check below doesn't work on Windows. + // stdout is unlikely to get redirected though, so just print there. + w = os.Stdout + } else { + outf, _ := os.Stdout.Stat() + errf, _ := os.Stderr.Stat() + if outf != nil && errf != nil && os.SameFile(outf, errf) { + w = os.Stderr + } + } + fmt.Fprintf(w, "Fatal: "+format+"\n", args...) + os.Exit(1) +} diff --git a/cmd/utils/defaults.go b/cmd/utils/defaults.go deleted file mode 100644 index e33a60b56f..0000000000 --- a/cmd/utils/defaults.go +++ /dev/null @@ -1,550 +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 utils - -import ( - "database/sql/driver" - "fmt" - "log" - "math/big" - "os" - "os/user" - "path/filepath" - "runtime" - "time" -) - -const ( - DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server - DefaultHTTPPort = 8545 // Default TCP port for the HTTP RPC server - DefaultWSHost = "localhost" // Default host interface for the websocket RPC server - DefaultWSPort = 8546 // Default TCP port for the websocket RPC server - Width = 16 // Width of the network ontology -) - -var ( - DefaultMaxPrice = big.NewInt(500 * 1e9) - DefaultIgnorePrice = big.NewInt(2 * 1) -) - -// ********************************** -// ** ** -// ** Eth Config Defaults ** -// ** & Empty Structs ** -// ** ** -// ********************************** - -var EthConfigDefaults = EthConfig{ - SyncMode: 0, - Progpow: ProgpowConfig{}, - NetworkId: 1, - TxLookupLimit: 2350000, - DatabaseCache: 512, - TrieCleanCache: 154, - TrieCleanCacheJournal: "triecache", - TrieCleanCacheRejournal: 60 * time.Minute, - TrieDirtyCache: 256, - TrieTimeout: 60 * time.Minute, - SnapshotCache: 102, - Miner: MinerConfig{ - GasCeil: 18000000, - GasPrice: big.NewInt(1e9), - Recommit: 3 * time.Second, - }, - TxPool: TxPoolConfig{}, - RPCGasCap: 50000000, - GPO: FullNodeGPOConfig, - RPCTxFeeCap: 1, // 1 ether - DomUrl: "ws://127.0.0.1:8546", - SubUrls: []string{"ws://127.0.0.1:8546", "ws://127.0.0.1:8546", "ws://127.0.0.1:8546"}, -} - -type EthConfig struct { - // The genesis block, which is inserted if the database is empty. - // If nil, the Quai main net block is used. - Genesis Genesis `toml:",omitempty"` - - // Protocol options - NetworkId uint64 // Network ID to use for selecting peers to connect to - SyncMode SyncMode - - // This can be set to list of enrtree:// URLs which will be queried for - // for nodes to connect to. - EthDiscoveryURLs []string - SnapDiscoveryURLs []string - - NoPruning bool // Whether to disable pruning and flush everything to disk - NoPrefetch bool // Whether to disable prefetching and only load state on demand - - TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved. - - // Whitelist of required block number -> hash values to accept - Whitelist map[uint64]Hash `toml:"-"` - - // Database options - SkipBcVersionCheck bool `toml:"-"` - DatabaseHandles int `toml:"-"` - DatabaseCache int - DatabaseFreezer string - - TrieCleanCache int - TrieCleanCacheJournal string `toml:",omitempty"` // Disk journal directory for trie cache to survive node restarts - TrieCleanCacheRejournal time.Duration `toml:",omitempty"` // Time interval to regenerate the journal for clean cache - TrieDirtyCache int - TrieTimeout time.Duration - SnapshotCache int - Preimages bool - - // Mining options - Miner MinerConfig - - // Consensus Engine - ConsensusEngine string - - // Progpow options - Progpow ProgpowConfig - - // Blake3 options - Blake3Pow Blake3PowConfig - - // Transaction pool options - TxPool TxPoolConfig - - // Gas Price Oracle options - GPO GasPriceConfig - - // Enables tracking of SHA3 preimages in the VM - EnablePreimageRecording bool - - // Miscellaneous options - DocRoot string `toml:"-"` - - // RPCGasCap is the global gas cap for eth-call variants. - RPCGasCap uint64 - - // RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for - // send-transction variants. The unit is ether. - RPCTxFeeCap float64 - - // Region location options - Region int - - // Zone location options - Zone int - - // Dom node websocket url - DomUrl string - - // Sub node websocket urls - SubUrls []string - - // Slices running on the node - SlicesRunning []Location -} - -type SyncMode uint32 - -const ( - FullSync SyncMode = iota // Synchronise the entire blockchain history from full blocks -) - -func (mode SyncMode) MarshalText() ([]byte, error) { - switch mode { - case FullSync: - return []byte("full"), nil - default: - return nil, fmt.Errorf("unknown sync mode %d", mode) - } -} - -func (mode *SyncMode) UnmarshalText(text []byte) error { - switch string(text) { - case "full": - *mode = FullSync - default: - return fmt.Errorf(`unknown sync mode %q, want "full", "fast" or "light"`, text) - } - return nil -} - -type Genesis struct { -} - -type MinerConfig struct { - Etherbase Address `toml:",omitempty"` // Public address for block mining rewards (default = first account) - Notify []string `toml:",omitempty"` // HTTP URL list to be notified of new work packages (only useful in ethash). - NotifyFull bool `toml:",omitempty"` // Notify with pending block headers instead of work packages - ExtraData Bytes `toml:",omitempty"` // Block extra data set by the miner - GasFloor uint64 // Target gas floor for mined blocks. - GasCeil uint64 // Target gas ceiling for mined blocks. - GasPrice *big.Int // Minimum gas price for mining a transaction - Recommit time.Duration // The time interval for miner to re-create mining work. - Noverify bool // Disable remote mining solution verification(only useful in ethash). -} - -type Address struct { -} - -type AddressData interface { - Bytes() []byte - Hash() Hash - Hex() string - String() string - checksumHex() []byte - Format(s fmt.State, c rune) - MarshalText() ([]byte, error) - UnmarshalText(input []byte) error - UnmarshalJSON(input []byte) error - Scan(src interface{}) error - Value() (driver.Value, error) - Location() *Location - setBytes(b []byte) -} - -type Bytes []byte - -type ProgpowConfig struct { -} - -type Blake3PowConfig struct { -} - -type TxPoolConfig struct { - Locals []InternalAddress // Addresses that should be treated by default as local - NoLocals bool // Whether local transaction handling should be disabled - Journal string // Journal of local transactions to survive node restarts - Rejournal time.Duration // Time interval to regenerate the local transaction journal - - PriceLimit uint64 // Minimum gas price to enforce for acceptance into the pool - PriceBump uint64 // Minimum price bump percentage to replace an already existing transaction (nonce) - - AccountSlots uint64 // Number of executable transaction slots guaranteed per account - GlobalSlots uint64 // Maximum number of executable transaction slots for all accounts - MaxSenders uint64 // Maximum number of senders in the senders cache - SendersChBuffer uint64 // Senders cache channel buffer size - AccountQueue uint64 // Maximum number of non-executable transaction slots permitted per account - GlobalQueue uint64 // Maximum number of non-executable transaction slots for all accounts - - Lifetime time.Duration // Maximum amount of time non-executable transaction are queued -} - -// FullNodeGPO contains default gasprice oracle settings for full node. -var FullNodeGPOConfig = GasPriceConfig{ - Blocks: 20, - Percentile: 60, - MaxHeaderHistory: 0, - MaxBlockHistory: 0, - MaxPrice: DefaultMaxPrice, - IgnorePrice: DefaultIgnorePrice, -} - -type GasPriceConfig struct { - Blocks int - Percentile int - MaxHeaderHistory int - MaxBlockHistory int - Default *big.Int `toml:",omitempty"` - MaxPrice *big.Int `toml:",omitempty"` - IgnorePrice *big.Int `toml:",omitempty"` -} - -type Location []byte -type Hash [32]byte - -// ********************************** -// ** ** -// ** Core Config Defaults ** -// ** & Empty Structs ** -// ** ** -// ********************************** - -var CoreConfigDefaults = TxPoolConfig{ - Journal: "transactions.rlp", - Rejournal: time.Hour, - - PriceLimit: 1, - PriceBump: 10, - - AccountSlots: 1, - GlobalSlots: 9000 + 1024, // urgent + floating queue capacity with 4:1 ratio - MaxSenders: 100000, // 5 MB - at least 10 blocks worth of transactions in case of reorg or high production rate - SendersChBuffer: 1024, // at 500 TPS in zone, 2s buffer - AccountQueue: 1, - GlobalQueue: 2048, - - Lifetime: 3 * time.Hour, -} - -type InternalAddress [20]byte - -// ********************************** -// ** ** -// ** Metrics Config Defaults ** -// ** & Empty Structs ** -// ** ** -// ********************************** - -var DefaultMetricsConfig = MetricsConfig{ - Enabled: false, - EnabledExpensive: false, - HTTP: "127.0.0.1", - Port: 6060, - EnableInfluxDB: false, - InfluxDBEndpoint: "http://localhost:8086", - InfluxDBDatabase: "quai", - InfluxDBUsername: "test", - InfluxDBPassword: "test", - InfluxDBTags: "host=localhost", -} - -type MetricsConfig struct { - Enabled bool `toml:",omitempty"` - EnabledExpensive bool `toml:",omitempty"` - HTTP string `toml:",omitempty"` - Port int `toml:",omitempty"` - EnableInfluxDB bool `toml:",omitempty"` - InfluxDBEndpoint string `toml:",omitempty"` - InfluxDBDatabase string `toml:",omitempty"` - InfluxDBUsername string `toml:",omitempty"` - InfluxDBPassword string `toml:",omitempty"` - InfluxDBTags string `toml:",omitempty"` -} - -// ********************************** -// ** ** -// ** Node Config Defaults ** -// ** & Empty Structs ** -// ** ** -// ********************************** - -var NodeDefaultConfig = Config{ - DataDir: DefaultDataDir(), - HTTPPort: DefaultHTTPPort, - HTTPModules: []string{"net", "web3"}, - HTTPVirtualHosts: []string{"localhost"}, - HTTPTimeouts: DefaultHTTPTimeouts, - WSPort: DefaultWSPort, - WSModules: []string{"net", "web3"}, - P2P: P2PConfig{ - MaxPendingPeers: 50, - }, - DBEngine: "", -} - -type Config struct { - // Name sets the instance name of the node. It must not contain the / character and is - // used in the devp2p node identifier. The instance name of go-quai is "go-quai". If no - // value is specified, the basename of the current executable is used. - Name string `toml:"-"` - - // UserIdent, if set, is used as an additional component in the devp2p node identifier. - UserIdent string `toml:",omitempty"` - - // Version should be set to the version number of the program. It is used - // in the devp2p node identifier. - Version string `toml:"-"` - - // DataDir is the file system folder the node should use for any data storage - // requirements. The configured data directory will not be directly shared with - // registered services, instead those can use utility methods to create/access - // databases or flat files. This enables ephemeral nodes which can fully reside - // in memory. - DataDir string - - // Configuration of peer-to-peer networking. - P2P P2PConfig - - // KeyStoreDir is the file system folder that contains private keys. The directory can - // be specified as a relative path, in which case it is resolved relative to the - // current directory. - // - // If KeyStoreDir is empty, the default location is the "keystore" subdirectory of - // DataDir. If DataDir is unspecified and KeyStoreDir is empty, an ephemeral directory - // is created by New and destroyed when the node is stopped. - KeyStoreDir string `toml:",omitempty"` - - // ExternalSigner specifies an external URI for a clef-type signer - ExternalSigner string `toml:",omitempty"` - - // UseLightweightKDF lowers the memory and CPU requirements of the key store - // scrypt KDF at the expense of security. - UseLightweightKDF bool `toml:",omitempty"` - - // InsecureUnlockAllowed allows user to unlock accounts in unsafe http environment. - InsecureUnlockAllowed bool `toml:",omitempty"` - - // NoUSB disables hardware wallet monitoring and connectivity. - NoUSB bool `toml:",omitempty"` - - // USB enables hardware wallet monitoring and connectivity. - USB bool `toml:",omitempty"` - - // HTTPHost is the host interface on which to start the HTTP RPC server. If this - // field is empty, no HTTP API endpoint will be started. - HTTPHost string - - // HTTPPort is the TCP port number on which to start the HTTP RPC server. The - // default zero value is/ valid and will pick a port number randomly (useful - // for ephemeral nodes). - HTTPPort int `toml:",omitempty"` - - // HTTPCors is the Cross-Origin Resource Sharing header to send to requesting - // clients. Please be aware that CORS is a browser enforced security, it's fully - // useless for custom HTTP clients. - HTTPCors []string `toml:",omitempty"` - - // HTTPVirtualHosts is the list of virtual hostnames which are allowed on incoming requests. - // This is by default {'localhost'}. Using this prevents attacks like - // DNS rebinding, which bypasses SOP by simply masquerading as being within the same - // origin. These attacks do not utilize CORS, since they are not cross-domain. - // By explicitly checking the Host-header, the server will not allow requests - // made against the server with a malicious host domain. - // Requests using ip address directly are not affected - HTTPVirtualHosts []string `toml:",omitempty"` - - // HTTPModules is a list of API modules to expose via the HTTP RPC interface. - // If the module list is empty, all RPC API endpoints designated public will be - // exposed. - HTTPModules []string - - // HTTPTimeouts allows for customization of the timeout values used by the HTTP RPC - // interface. - HTTPTimeouts HTTPTimeouts - - // HTTPPathPrefix specifies a path prefix on which http-rpc is to be served. - HTTPPathPrefix string `toml:",omitempty"` - - // WSHost is the host interface on which to start the websocket RPC server. If - // this field is empty, no websocket API endpoint will be started. - WSHost string - - // WSPort is the TCP port number on which to start the websocket RPC server. The - // default zero value is/ valid and will pick a port number randomly (useful for - // ephemeral nodes). - WSPort int `toml:",omitempty"` - - // WSPathPrefix specifies a path prefix on which ws-rpc is to be served. - WSPathPrefix string `toml:",omitempty"` - - // WSOrigins is the list of domain to accept websocket requests from. Please be - // aware that the server can only act upon the HTTP request the client sends and - // cannot verify the validity of the request header. - WSOrigins []string `toml:",omitempty"` - - // WSModules is a list of API modules to expose via the websocket RPC interface. - // If the module list is empty, all RPC API endpoints designated public will be - // exposed. - WSModules []string - - // WSExposeAll exposes all API modules via the WebSocket RPC interface rather - // than just the public ones. - // - // *WARNING* Only set this if the node is running in a trusted network, exposing - // private APIs to untrusted users is a major security risk. - WSExposeAll bool `toml:",omitempty"` - - // Logger is a custom logger to use with the p2p.Server. - Logger *log.Logger `toml:",omitempty"` - - // AllowUnprotectedTxs allows non EIP-155 protected transactions to be send over RPC. - AllowUnprotectedTxs bool `toml:",omitempty"` - - // JWTSecret is the path to the hex-encoded jwt secret. - JWTSecret string `toml:",omitempty"` - - // EnablePersonal enables the deprecated personal namespace. - EnablePersonal bool `toml:"-"` - - DBEngine string `toml:",omitempty"` -} - -type HTTPTimeouts struct { - ReadTimeout time.Duration - WriteTimeout time.Duration - IdleTimeout time.Duration -} - -var DefaultHTTPTimeouts = HTTPTimeouts{ - ReadTimeout: 30 * time.Second, - WriteTimeout: 30 * time.Second, - IdleTimeout: 120 * time.Second, -} - -type P2PConfig struct { - // MaxPendingPeers is the maximum number of peers that can be pending in the - // handshake phase, counted separately for inbound and outbound connections. - // Zero defaults to preset values. - MaxPendingPeers int `toml:",omitempty"` -} - -// DefaultDataDir is the default data directory to use for the databases and other -// persistence requirements. -func DefaultDataDir() string { - // Try to place the data folder in the user's home dir - home := homeDir() - if home != "" { - switch runtime.GOOS { - case "darwin": - return filepath.Join(home, "Library", "Quai") - case "windows": - // We used to put everything in %HOME%\AppData\Roaming, but this caused - // problems with non-typical setups. If this fallback location exists and - // is non-empty, use it, otherwise DTRT and check %LOCALAPPDATA%. - fallback := filepath.Join(home, "AppData", "Roaming", "Quai") - appdata := windowsAppData() - if appdata == "" || isNonEmptyDir(fallback) { - return fallback - } - return filepath.Join(appdata, "Quai") - default: - return filepath.Join(home, ".quai") - } - } - // As we cannot guess a stable location, return empty and handle later - return "" -} - -func windowsAppData() string { - v := os.Getenv("LOCALAPPDATA") - if v == "" { - // Windows XP and below don't have LocalAppData. Crash here because - // we don't support Windows XP and undefining the variable will cause - // other issues. - panic("environment variable LocalAppData is undefined") - } - return v -} - -func isNonEmptyDir(dir string) bool { - f, err := os.Open(dir) - if err != nil { - return false - } - names, _ := f.Readdir(1) - f.Close() - return len(names) > 0 -} - -func homeDir() string { - if home := os.Getenv("HOME"); home != "" { - return home - } - if usr, err := user.Current(); err == nil { - return usr.HomeDir - } - return "" -} diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 637fdc750a..d91426c1b9 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1,23 +1,37 @@ package utils import ( + "errors" "fmt" + "math" + "math/big" "os" + "path/filepath" "regexp" + godebug "runtime/debug" + "strconv" "strings" "time" "github.com/adrg/xdg" + "github.com/dominant-strategies/go-quai/common" "github.com/dominant-strategies/go-quai/common/constants" + "github.com/dominant-strategies/go-quai/common/fdlimit" + "github.com/dominant-strategies/go-quai/core" + "github.com/dominant-strategies/go-quai/core/rawdb" + "github.com/dominant-strategies/go-quai/eth/ethconfig" + "github.com/dominant-strategies/go-quai/eth/gasprice" + "github.com/dominant-strategies/go-quai/ethdb" "github.com/dominant-strategies/go-quai/log" + "github.com/dominant-strategies/go-quai/node" + "github.com/dominant-strategies/go-quai/params" "github.com/pelletier/go-toml/v2" + gopsutil "github.com/shirou/gopsutil/mem" "github.com/spf13/cobra" "github.com/spf13/viper" ) -var GlobalFlags = []Flag{ - ConfigDirFlag, - DataDirFlag, +var GlobalFlags = []Flag{ConfigDirFlag, DataDirFlag, AncientDirFlag, LogLevelFlag, SaveConfigFlag, @@ -101,6 +115,7 @@ var RPCFlags = []Flag{ WSAllowedOriginsFlag, WSPathPrefixFlag, PreloadJSFlag, + RPCGlobalTxFeeCapFlag, RPCGlobalGasCapFlag, QuaiStatsURLFlag, SendFullStatsFlag, @@ -309,6 +324,7 @@ var ( TxLookupLimitFlag = Flag{ Name: "txlookuplimit", + Value: ethconfig.Defaults.TxLookupLimit, Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)" + generateEnvDoc("txlookuplimit"), } @@ -336,38 +352,47 @@ var ( } TxPoolJournalFlag = Flag{ Name: "txpool.journal", + Value: core.DefaultTxPoolConfig.Journal, Usage: "Disk journal for local transaction to survive node restarts" + generateEnvDoc("txpool.journal"), } TxPoolRejournalFlag = Flag{ Name: "txpool.rejournal", + Value: core.DefaultTxPoolConfig.Rejournal, Usage: "Time interval to regenerate the local transaction journal" + generateEnvDoc("txpool.rejournal"), } TxPoolPriceLimitFlag = Flag{ Name: "txpool.pricelimit", + Value: ethconfig.Defaults.TxPool.PriceLimit, Usage: "Minimum gas price limit to enforce for acceptance into the pool" + generateEnvDoc("txpool.pricelimit"), } TxPoolPriceBumpFlag = Flag{ Name: "txpool.pricebump", + Value: ethconfig.Defaults.TxPool.PriceBump, Usage: "Price bump percentage to replace an already existing transaction" + generateEnvDoc("txpool.pricebump"), } TxPoolAccountSlotsFlag = Flag{ Name: "txpool.accountslots", + Value: ethconfig.Defaults.TxPool.AccountSlots, Usage: "Minimum number of executable transaction slots guaranteed per account" + generateEnvDoc("txpool.accountslots"), } TxPoolGlobalSlotsFlag = Flag{ Name: "txpool.globalslots", + Value: ethconfig.Defaults.TxPool.GlobalSlots, Usage: "Maximum number of executable transaction slots for all accounts" + generateEnvDoc("txpool.globalslots"), } TxPoolAccountQueueFlag = Flag{ Name: "txpool.accountqueue", + Value: ethconfig.Defaults.TxPool.AccountQueue, Usage: "Maximum number of non-executable transaction slots permitted per account" + generateEnvDoc("txpool.accountqueue"), } TxPoolGlobalQueueFlag = Flag{ Name: "txpool.globalqueue", + Value: ethconfig.Defaults.TxPool.GlobalQueue, Usage: "Maximum number of non-executable transaction slots for all accounts" + generateEnvDoc("txpool.globalqueue"), } TxPoolLifetimeFlag = Flag{ Name: "txpool.lifetime", + Value: ethconfig.Defaults.TxPool.Lifetime, Usage: "Maximum amount of time non-executable transaction are queued" + generateEnvDoc("txpool.lifetime"), } CacheFlag = Flag{ @@ -387,10 +412,12 @@ var ( } CacheTrieJournalFlag = Flag{ Name: "cache.trie.journal", + Value: ethconfig.Defaults.TrieCleanCacheJournal, Usage: "Disk journal directory for trie cache to survive node restarts" + generateEnvDoc("cache.trie.journal"), } CacheTrieRejournalFlag = Flag{ Name: "cache.trie.rejournal", + Value: ethconfig.Defaults.TrieCleanCacheRejournal, Usage: "Time interval to regenerate the trie cache journal" + generateEnvDoc("cache.trie.rejournal"), } CacheGCFlag = Flag{ @@ -422,6 +449,7 @@ var ( // Miner settings MinerGasPriceFlag = Flag{ Name: "miner.gasprice", + Value: newBigIntValue(ethconfig.Defaults.Miner.GasPrice), Usage: "Minimum gas price for mining a transaction" + generateEnvDoc("miner.gasprice"), } // Account settings @@ -437,6 +465,11 @@ var ( Usage: "Password file to use for non-interactive password input" + generateEnvDoc("password"), } + KeyStoreDirFlag = Flag{ + Name: "keystore", + Value: "", + Usage: "Directory for the keystore (default = inside the datadir)", + } ExternalSignerFlag = Flag{ Name: "signer", Value: "", @@ -459,6 +492,7 @@ var ( } RPCGlobalGasCapFlag = Flag{ Name: "rpc.gascap", + Value: ethconfig.Defaults.RPCGasCap, Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)" + generateEnvDoc("vmdebug"), } QuaiStatsURLFlag = Flag{ @@ -479,6 +513,7 @@ var ( } HTTPListenAddrFlag = Flag{ Name: "http.addr", + Value: node.DefaultHTTPHost, Usage: "HTTP-RPC server listening interface" + generateEnvDoc("http.addr"), } HTTPCORSDomainFlag = Flag{ @@ -488,6 +523,7 @@ var ( } HTTPVirtualHostsFlag = Flag{ Name: "http.vhosts", + Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","), Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard." + generateEnvDoc("http"), } HTTPApiFlag = Flag{ @@ -508,6 +544,7 @@ var ( } WSListenAddrFlag = Flag{ Name: "ws.addr", + Value: node.DefaultWSHost, Usage: "WS-RPC server listening interface" + generateEnvDoc("ws"), } WSApiFlag = Flag{ @@ -533,27 +570,33 @@ var ( // Gas price oracle settings GpoBlocksFlag = Flag{ Name: "gpo.blocks", + Value: ethconfig.Defaults.GPO.Blocks, Usage: "Number of recent blocks to check for gas prices" + generateEnvDoc("gpo.blocks"), } GpoPercentileFlag = Flag{ Name: "gpo.percentile", + Value: ethconfig.Defaults.GPO.Percentile, Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices" + generateEnvDoc("gpo.percentile"), } GpoMaxGasPriceFlag = Flag{ Name: "gpo.maxprice", + Value: ethconfig.Defaults.GPO.MaxPrice.Int64(), Usage: "Maximum gas price will be recommended by gpo" + generateEnvDoc("gpo.maxprice"), } GpoIgnoreGasPriceFlag = Flag{ Name: "gpo.ignoreprice", + Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(), Usage: "Gas price below which gpo will ignore transactions" + generateEnvDoc("gpo.ignoreprice"), } DomUrl = Flag{ Name: "dom.url", + Value: ethconfig.Defaults.DomUrl, Usage: "Dominant chain websocket url" + generateEnvDoc("dom.url"), } SubUrls = Flag{ Name: "sub.urls", + Value: ethconfig.Defaults.DomUrl, Usage: "Subordinate chain websocket urls" + generateEnvDoc("sub.urls"), } CoinbaseAddressFlag = Flag{ @@ -603,29 +646,6 @@ func ParseCoinbaseAddresses() (map[string]string, error) { }{ Coinbases: make(map[string]string), } -} - -// setBootstrapNodes creates a list of bootstrap nodes from the pre-configured -// ones if none have been specified. -func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config, nodeLocation common.Location) { - urls := params.ColosseumBootnodes[nodeLocation.Name()] - //TODO: fix bootnode parsing for other networks - - cfg.BootstrapNodes = make([]*enode.Node, 0, len(urls)) - for _, url := range urls { - if url != "" { - node, err := enode.Parse(enode.ValidSchemes, url+cfg.ListenAddr) - if err != nil { - log.Fatal("Bootstrap URL invalid", "enode", url, "err", err) - continue - } - cfg.BootstrapNodes = append(cfg.BootstrapNodes, node) - } - } -} - - } - } // Scenario 1: User specifies a file path if _, err := os.Stat(coinbaseInput); err == nil { @@ -718,14 +738,151 @@ func CreateAndBindFlag(flag Flag, cmd *cobra.Command) { viper.BindPFlag(flag.GetName(), cmd.PersistentFlags().Lookup(flag.GetName())) } +// helper function that given a cobra flag name, returns the corresponding +// help legend for the equivalent environment variable +func generateEnvDoc(flag string) string { + envVar := constants.ENV_PREFIX + "_" + strings.ReplaceAll(strings.ToUpper(flag), "-", "_") + return fmt.Sprintf(" [%s]", envVar) +} + +// setNodeUserIdent creates the user identifier from CLI flags. +func setNodeUserIdent(cfg *node.Config) { + if identity := viper.GetString(IdentityFlag.Name); len(identity) > 0 { + cfg.UserIdent = identity + } +} + +// SplitAndTrim splits input separated by a comma +// and trims excessive white space from the substrings. +func SplitAndTrim(input string) (ret []string) { + l := strings.Split(input, ",") + for _, r := range l { + if r = strings.TrimSpace(r); r != "" { + ret = append(ret, r) + } + } + return ret +} + +// setHTTP creates the HTTP RPC listener interface string from the set +// command line flags, returning empty if the HTTP endpoint is disabled. +func setHTTP(cfg *node.Config, nodeLocation common.Location) { + if viper.GetBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" { + cfg.HTTPHost = "127.0.0.1" + if viper.IsSet(HTTPListenAddrFlag.Name) { + cfg.HTTPHost = viper.GetString(HTTPListenAddrFlag.Name) + } + } + + if nodeLocation == nil { + cfg.HTTPPort = 9001 + } else if len(nodeLocation) == 1 { + cfg.HTTPPort = 9002 + } else if len(nodeLocation) == 2 { + cfg.HTTPPort = 9003 + } + + if viper.IsSet(HTTPCORSDomainFlag.Name) { + cfg.HTTPCors = SplitAndTrim(viper.GetString(HTTPCORSDomainFlag.Name)) + } + + if viper.IsSet(HTTPApiFlag.Name) { + cfg.HTTPModules = SplitAndTrim(viper.GetString(HTTPApiFlag.Name)) + } + + if viper.IsSet(HTTPVirtualHostsFlag.Name) { + cfg.HTTPVirtualHosts = SplitAndTrim(viper.GetString(HTTPVirtualHostsFlag.Name)) + } + + if viper.IsSet(HTTPPathPrefixFlag.Name) { + cfg.HTTPPathPrefix = viper.GetString(HTTPPathPrefixFlag.Name) + } +} + +// setWS creates the WebSocket RPC listener interface string from the set +// command line flags, returning empty if the HTTP endpoint is disabled. +func setWS(cfg *node.Config, nodeLocation common.Location) { + if viper.GetBool(WSEnabledFlag.Name) && cfg.WSHost == "" { + cfg.WSHost = "127.0.0.1" + if viper.IsSet(WSListenAddrFlag.Name) { + cfg.WSHost = viper.GetString(WSListenAddrFlag.Name) + } + } + if nodeLocation == nil { + cfg.WSPort = 8001 + } else if len(nodeLocation) == 1 { + cfg.WSPort = 8002 + } else if len(nodeLocation) == 2 { + cfg.WSPort = 8003 + } + + if viper.IsSet(WSAllowedOriginsFlag.Name) { + cfg.WSOrigins = SplitAndTrim(viper.GetString(WSAllowedOriginsFlag.Name)) + } + + if viper.IsSet(WSApiFlag.Name) { + cfg.WSModules = SplitAndTrim(viper.GetString(WSApiFlag.Name)) + } + + if viper.IsSet(WSPathPrefixFlag.Name) { + cfg.WSPathPrefix = viper.GetString(WSPathPrefixFlag.Name) + } +} + +// setDomUrl sets the dominant chain websocket url. +func setDomUrl(cfg *ethconfig.Config, nodeLocation common.Location) { + // only set the dom url if the node is not prime + if nodeLocation != nil { + if len(nodeLocation) == 1 { + cfg.DomUrl = "ws://127.0.0.1:8001" + } else if len(nodeLocation) == 2 { + cfg.DomUrl = "ws://127.0.0.1:8002" + } + } + log.Info("Node", "Location", nodeLocation, "domurl", cfg.DomUrl) +} + +// setSubUrls sets the subordinate chain urls +func setSubUrls(cfg *ethconfig.Config, nodeLocation common.Location) { + // only set the sub urls if its not the zone + if len(nodeLocation) != 2 { + if nodeLocation == nil { + cfg.SubUrls = []string{"ws://127.0.0.1:8002"} + } else if len(nodeLocation) == 1 { + cfg.SubUrls = []string{"ws://127.0.0.1:8003"} + } + } +} + +// setGasLimitCeil sets the gas limit ceils based on the network that is +// running +func setGasLimitCeil(cfg *ethconfig.Config) { + switch { + case viper.GetBool(ColosseumFlag.Name): + cfg.Miner.GasCeil = params.ColosseumGasCeil + case viper.GetBool(GardenFlag.Name): + cfg.Miner.GasCeil = params.GardenGasCeil + case viper.GetBool(OrchardFlag.Name): + cfg.Miner.GasCeil = params.OrchardGasCeil + case viper.GetBool(LighthouseFlag.Name): + cfg.Miner.GasCeil = params.LighthouseGasCeil + case viper.GetBool(LocalFlag.Name): + cfg.Miner.GasCeil = params.LocalGasCeil + case viper.GetBool(DeveloperFlag.Name): + cfg.Miner.GasCeil = params.LocalGasCeil + default: + cfg.Miner.GasCeil = params.ColosseumGasCeil + } +} + // makeSubUrls returns the subordinate chain urls -func makeSubUrls(ctx *cli.Context) []string { - return strings.Split(ctx.GlobalString(SubUrls.Name), ",") +func makeSubUrls() []string { + return strings.Split(viper.GetString(SubUrls.Name), ",") } // setSlicesRunning sets the slices running flag -func setSlicesRunning(ctx *cli.Context, cfg *ethconfig.Config) { - slices := strings.Split(ctx.GlobalString(SlicesRunningFlag.Name), ",") +func setSlicesRunning(cfg *ethconfig.Config) { + slices := strings.Split(viper.GetString(SlicesRunningFlag.Name), ",") // Sanity checks if len(slices) == 0 { @@ -767,12 +924,13 @@ func HexAddress(account string, nodeLocation common.Location) (common.Address, e // setEtherbase retrieves the etherbase either from the directly specified // command line flags or from the keystore if CLI indexed. -func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) { - // Extract the current etherbase - var etherbase string - if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) { - etherbase = ctx.GlobalString(MinerEtherbaseFlag.Name) +func setEtherbase(cfg *ethconfig.Config) { + coinbaseMap, err := ParseCoinbaseAddresses() + if err != nil { + log.Fatalf("error parsing coinbase addresses: %s", err) } + // TODO: Have to handle more shards in the future + etherbase := coinbaseMap["00"] // Convert the etherbase into an address and configure it if etherbase != "" { account, err := HexAddress(etherbase, cfg.NodeLocation) @@ -784,12 +942,12 @@ func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) { } // MakePasswordList reads password lines from the file specified by the global --password flag. -func MakePasswordList(ctx *cli.Context) []string { - path := ctx.GlobalString(PasswordFileFlag.Name) +func MakePasswordList() []string { + path := viper.GetString(PasswordFileFlag.Name) if path == "" { return nil } - text, err := ioutil.ReadFile(path) + text, err := os.ReadFile(path) if err != nil { Fatalf("Failed to read password file: %v", err) } @@ -801,81 +959,28 @@ func MakePasswordList(ctx *cli.Context) []string { return lines } -func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config, nodeLocation common.Location) { - setNodeKey(ctx, cfg, nodeLocation) - setNAT(ctx, cfg) - setListenAddress(ctx, cfg) - setBootstrapNodes(ctx, cfg, nodeLocation) - setBootstrapNodesV5(ctx, cfg) - - if ctx.GlobalIsSet(MaxPeersFlag.Name) { - cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name) - } - ethPeers := cfg.MaxPeers - - log.Info("Maximum peer count", "ETH", ethPeers, "total", cfg.MaxPeers) - - if ctx.GlobalIsSet(MaxPendingPeersFlag.Name) { - cfg.MaxPendingPeers = ctx.GlobalInt(MaxPendingPeersFlag.Name) - } - if ctx.GlobalIsSet(NoDiscoverFlag.Name) { - cfg.NoDiscovery = true - } - - // if we're running a light client or server, force enable the v5 peer discovery - // unless it is explicitly disabled with --nodiscover note that explicitly specifying - // --v5disc overrides --nodiscover, in which case the later only disables v4 discovery - if ctx.GlobalIsSet(DiscoveryV5Flag.Name) { - cfg.DiscoveryV5 = ctx.GlobalBool(DiscoveryV5Flag.Name) - } - - if netrestrict := ctx.GlobalString(NetrestrictFlag.Name); netrestrict != "" { - list, err := netutil.ParseNetlist(netrestrict) - if err != nil { - Fatalf("Option %q: %v", NetrestrictFlag.Name, err) - } - cfg.NetRestrict = list - } - - if ctx.GlobalBool(DeveloperFlag.Name) { - // --dev mode can't use p2p networking. - cfg.MaxPeers = 0 - cfg.ListenAddr = "" - cfg.NoDial = true - cfg.NoDiscovery = true - cfg.DiscoveryV5 = false - } -} - // SetNodeConfig applies node-related command line flags to the config. -func SetNodeConfig(ctx *cli.Context, cfg *node.Config) { - SetP2PConfig(ctx, &cfg.P2P, cfg.NodeLocation) - setHTTP(ctx, cfg) - setWS(ctx, cfg) - setNodeUserIdent(ctx, cfg) - setDataDir(ctx, cfg) +func SetNodeConfig(cfg *node.Config, nodeLocation common.Location) { + setHTTP(cfg, nodeLocation) + setWS(cfg, nodeLocation) + setNodeUserIdent(cfg) + setDataDir(cfg) - if ctx.GlobalIsSet(ExternalSignerFlag.Name) { - cfg.ExternalSigner = ctx.GlobalString(ExternalSignerFlag.Name) + if viper.IsSet(ExternalSignerFlag.Name) { + cfg.ExternalSigner = viper.GetString(ExternalSignerFlag.Name) } - if ctx.GlobalIsSet(KeyStoreDirFlag.Name) { - cfg.KeyStoreDir = ctx.GlobalString(KeyStoreDirFlag.Name) + if viper.IsSet(KeyStoreDirFlag.Name) { + cfg.KeyStoreDir = viper.GetString(KeyStoreDirFlag.Name) } - if ctx.GlobalIsSet(DeveloperFlag.Name) { + if viper.IsSet(DeveloperFlag.Name) { cfg.UseLightweightKDF = true } - if ctx.GlobalIsSet(NoUSBFlag.Name) || cfg.NoUSB { - log.Warn("Option nousb is deprecated and USB is deactivated by default. Use --usb to enable") - } - if ctx.GlobalIsSet(USBFlag.Name) { - cfg.USB = ctx.GlobalBool(USBFlag.Name) + if viper.IsSet(InsecureUnlockAllowedFlag.Name) { + cfg.InsecureUnlockAllowed = viper.GetBool(InsecureUnlockAllowedFlag.Name) } - if ctx.GlobalIsSet(InsecureUnlockAllowedFlag.Name) { - cfg.InsecureUnlockAllowed = ctx.GlobalBool(InsecureUnlockAllowedFlag.Name) - } - if ctx.IsSet(DBEngineFlag.Name) { - dbEngine := ctx.String(DBEngineFlag.Name) + if viper.IsSet(DBEngineFlag.Name) { + dbEngine := viper.GetString(DBEngineFlag.Name) if dbEngine != "leveldb" && dbEngine != "pebble" { Fatalf("Invalid choice for db.engine '%s', allowed 'leveldb' or 'pebble'", dbEngine) } @@ -884,19 +989,19 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) { } } -func setDataDir(ctx *cli.Context, cfg *node.Config) { +func setDataDir(cfg *node.Config) { switch { - case ctx.GlobalIsSet(DataDirFlag.Name): - cfg.DataDir = ctx.GlobalString(DataDirFlag.Name) - case ctx.GlobalBool(DeveloperFlag.Name): + case viper.IsSet(DataDirFlag.Name): + cfg.DataDir = viper.GetString(DataDirFlag.Name) + case viper.GetBool(DeveloperFlag.Name): cfg.DataDir = "" // unless explicitly requested, use memory databases - case ctx.GlobalBool(GardenFlag.Name) && cfg.DataDir == node.DefaultDataDir(): + case viper.GetBool(GardenFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "garden") - case ctx.GlobalBool(OrchardFlag.Name) && cfg.DataDir == node.DefaultDataDir(): + case viper.GetBool(OrchardFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "orchard") - case ctx.GlobalBool(LighthouseFlag.Name) && cfg.DataDir == node.DefaultDataDir(): + case viper.GetBool(LighthouseFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "lighthouse") - case ctx.GlobalBool(LocalFlag.Name) && cfg.DataDir == node.DefaultDataDir(): + case viper.GetBool(LocalFlag.Name) && cfg.DataDir == node.DefaultDataDir(): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "local") } // Set specific directory for node location within the hierarchy @@ -913,29 +1018,24 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) { } } -func setGPO(ctx *cli.Context, cfg *gasprice.Config, light bool) { - // If we are running the light client, apply another group - // settings for gas oracle. - if light { - *cfg = ethconfig.LightClientGPO - } - if ctx.GlobalIsSet(GpoBlocksFlag.Name) { - cfg.Blocks = ctx.GlobalInt(GpoBlocksFlag.Name) +func setGPO(cfg *gasprice.Config) { + if viper.IsSet(GpoBlocksFlag.Name) { + cfg.Blocks = viper.GetInt(GpoBlocksFlag.Name) } - if ctx.GlobalIsSet(GpoPercentileFlag.Name) { - cfg.Percentile = ctx.GlobalInt(GpoPercentileFlag.Name) + if viper.IsSet(GpoPercentileFlag.Name) { + cfg.Percentile = viper.GetInt(GpoPercentileFlag.Name) } - if ctx.GlobalIsSet(GpoMaxGasPriceFlag.Name) { - cfg.MaxPrice = big.NewInt(ctx.GlobalInt64(GpoMaxGasPriceFlag.Name)) + if viper.IsSet(GpoMaxGasPriceFlag.Name) { + cfg.MaxPrice = big.NewInt(viper.GetInt64(GpoMaxGasPriceFlag.Name)) } - if ctx.GlobalIsSet(GpoIgnoreGasPriceFlag.Name) { - cfg.IgnorePrice = big.NewInt(ctx.GlobalInt64(GpoIgnoreGasPriceFlag.Name)) + if viper.IsSet(GpoIgnoreGasPriceFlag.Name) { + cfg.IgnorePrice = big.NewInt(viper.GetInt64(GpoIgnoreGasPriceFlag.Name)) } } -func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig, nodeLocation common.Location) { - if ctx.GlobalIsSet(TxPoolLocalsFlag.Name) { - locals := strings.Split(ctx.GlobalString(TxPoolLocalsFlag.Name), ",") +func setTxPool(cfg *core.TxPoolConfig, nodeLocation common.Location) { + if viper.IsSet(TxPoolLocalsFlag.Name) { + locals := strings.Split(viper.GetString(TxPoolLocalsFlag.Name), ",") for _, account := range locals { if trimmed := strings.TrimSpace(account); !common.IsHexAddress(trimmed) { Fatalf("Invalid account in --txpool.locals: %s", trimmed) @@ -948,63 +1048,63 @@ func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig, nodeLocation common.Loc } } } - if ctx.GlobalIsSet(TxPoolNoLocalsFlag.Name) { - cfg.NoLocals = ctx.GlobalBool(TxPoolNoLocalsFlag.Name) + if viper.IsSet(TxPoolNoLocalsFlag.Name) { + cfg.NoLocals = viper.GetBool(TxPoolNoLocalsFlag.Name) } - if ctx.GlobalIsSet(TxPoolJournalFlag.Name) { - cfg.Journal = ctx.GlobalString(TxPoolJournalFlag.Name) + if viper.IsSet(TxPoolJournalFlag.Name) { + cfg.Journal = viper.GetString(TxPoolJournalFlag.Name) } - if ctx.GlobalIsSet(TxPoolRejournalFlag.Name) { - cfg.Rejournal = ctx.GlobalDuration(TxPoolRejournalFlag.Name) + if viper.IsSet(TxPoolRejournalFlag.Name) { + cfg.Rejournal = viper.GetDuration(TxPoolRejournalFlag.Name) } - if ctx.GlobalIsSet(TxPoolPriceLimitFlag.Name) { - cfg.PriceLimit = ctx.GlobalUint64(TxPoolPriceLimitFlag.Name) + if viper.IsSet(TxPoolPriceLimitFlag.Name) { + cfg.PriceLimit = viper.GetUint64(TxPoolPriceLimitFlag.Name) } - if ctx.GlobalIsSet(TxPoolPriceBumpFlag.Name) { - cfg.PriceBump = ctx.GlobalUint64(TxPoolPriceBumpFlag.Name) + if viper.IsSet(TxPoolPriceBumpFlag.Name) { + cfg.PriceBump = viper.GetUint64(TxPoolPriceBumpFlag.Name) } - if ctx.GlobalIsSet(TxPoolAccountSlotsFlag.Name) { - cfg.AccountSlots = ctx.GlobalUint64(TxPoolAccountSlotsFlag.Name) + if viper.IsSet(TxPoolAccountSlotsFlag.Name) { + cfg.AccountSlots = viper.GetUint64(TxPoolAccountSlotsFlag.Name) } - if ctx.GlobalIsSet(TxPoolGlobalSlotsFlag.Name) { - cfg.GlobalSlots = ctx.GlobalUint64(TxPoolGlobalSlotsFlag.Name) + if viper.IsSet(TxPoolGlobalSlotsFlag.Name) { + cfg.GlobalSlots = viper.GetUint64(TxPoolGlobalSlotsFlag.Name) } - if ctx.GlobalIsSet(TxPoolAccountQueueFlag.Name) { - cfg.AccountQueue = ctx.GlobalUint64(TxPoolAccountQueueFlag.Name) + if viper.IsSet(TxPoolAccountQueueFlag.Name) { + cfg.AccountQueue = viper.GetUint64(TxPoolAccountQueueFlag.Name) } - if ctx.GlobalIsSet(TxPoolGlobalQueueFlag.Name) { - cfg.GlobalQueue = ctx.GlobalUint64(TxPoolGlobalQueueFlag.Name) + if viper.IsSet(TxPoolGlobalQueueFlag.Name) { + cfg.GlobalQueue = viper.GetUint64(TxPoolGlobalQueueFlag.Name) } - if ctx.GlobalIsSet(TxPoolLifetimeFlag.Name) { - cfg.Lifetime = ctx.GlobalDuration(TxPoolLifetimeFlag.Name) + if viper.IsSet(TxPoolLifetimeFlag.Name) { + cfg.Lifetime = viper.GetDuration(TxPoolLifetimeFlag.Name) } } -func setConsensusEngineConfig(ctx *cli.Context, cfg *ethconfig.Config) { +func setConsensusEngineConfig(cfg *ethconfig.Config) { if cfg.ConsensusEngine == "blake3" { // Override any default configs for hard coded networks. switch { - case ctx.GlobalBool(ColosseumFlag.Name): + case viper.GetBool(ColosseumFlag.Name): cfg.Blake3Pow.DurationLimit = params.DurationLimit cfg.Blake3Pow.GasCeil = params.ColosseumGasCeil cfg.Blake3Pow.MinDifficulty = new(big.Int).Div(core.DefaultColosseumGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(GardenFlag.Name): + case viper.GetBool(GardenFlag.Name): cfg.Blake3Pow.DurationLimit = params.GardenDurationLimit cfg.Blake3Pow.GasCeil = params.GardenGasCeil cfg.Blake3Pow.MinDifficulty = new(big.Int).Div(core.DefaultGardenGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(OrchardFlag.Name): + case viper.GetBool(OrchardFlag.Name): cfg.Blake3Pow.DurationLimit = params.OrchardDurationLimit cfg.Blake3Pow.GasCeil = params.OrchardGasCeil cfg.Blake3Pow.MinDifficulty = new(big.Int).Div(core.DefaultOrchardGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(LighthouseFlag.Name): + case viper.GetBool(LighthouseFlag.Name): cfg.Blake3Pow.DurationLimit = params.LighthouseDurationLimit cfg.Blake3Pow.GasCeil = params.LighthouseGasCeil cfg.Blake3Pow.MinDifficulty = new(big.Int).Div(core.DefaultLighthouseGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(LocalFlag.Name): + case viper.GetBool(LocalFlag.Name): cfg.Blake3Pow.DurationLimit = params.LocalDurationLimit cfg.Blake3Pow.GasCeil = params.LocalGasCeil cfg.Blake3Pow.MinDifficulty = new(big.Int).Div(core.DefaultLocalGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(DeveloperFlag.Name): + case viper.GetBool(DeveloperFlag.Name): cfg.Blake3Pow.DurationLimit = params.DurationLimit cfg.Blake3Pow.GasCeil = params.LocalGasCeil cfg.Blake3Pow.MinDifficulty = new(big.Int).Div(core.DefaultLocalGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) @@ -1017,28 +1117,28 @@ func setConsensusEngineConfig(ctx *cli.Context, cfg *ethconfig.Config) { } else { // Override any default configs for hard coded networks. switch { - case ctx.GlobalBool(ColosseumFlag.Name): + case viper.GetBool(ColosseumFlag.Name): cfg.Progpow.DurationLimit = params.DurationLimit cfg.Progpow.GasCeil = params.ColosseumGasCeil cfg.Progpow.MinDifficulty = new(big.Int).Div(core.DefaultColosseumGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(GardenFlag.Name): + case viper.GetBool(GardenFlag.Name): cfg.Progpow.DurationLimit = params.GardenDurationLimit cfg.Progpow.GasCeil = params.GardenGasCeil cfg.Progpow.MinDifficulty = new(big.Int).Div(core.DefaultGardenGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(OrchardFlag.Name): + case viper.GetBool(OrchardFlag.Name): cfg.Progpow.DurationLimit = params.OrchardDurationLimit cfg.Progpow.GasCeil = params.OrchardGasCeil cfg.Progpow.GasCeil = params.ColosseumGasCeil cfg.Progpow.MinDifficulty = new(big.Int).Div(core.DefaultOrchardGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(LighthouseFlag.Name): + case viper.GetBool(LighthouseFlag.Name): cfg.Progpow.DurationLimit = params.LighthouseDurationLimit cfg.Progpow.GasCeil = params.LighthouseGasCeil cfg.Progpow.MinDifficulty = new(big.Int).Div(core.DefaultLighthouseGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(LocalFlag.Name): + case viper.GetBool(LocalFlag.Name): cfg.Progpow.DurationLimit = params.LocalDurationLimit cfg.Progpow.GasCeil = params.LocalGasCeil cfg.Progpow.MinDifficulty = new(big.Int).Div(core.DefaultLocalGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) - case ctx.GlobalBool(DeveloperFlag.Name): + case viper.GetBool(DeveloperFlag.Name): cfg.Progpow.DurationLimit = params.DurationLimit cfg.Progpow.GasCeil = params.LocalGasCeil cfg.Progpow.MinDifficulty = new(big.Int).Div(core.DefaultLocalGenesisBlock(cfg.ConsensusEngine).Difficulty, common.Big2) @@ -1051,8 +1151,8 @@ func setConsensusEngineConfig(ctx *cli.Context, cfg *ethconfig.Config) { } } -func setWhitelist(ctx *cli.Context, cfg *ethconfig.Config) { - whitelist := ctx.GlobalString(WhitelistFlag.Name) +func setWhitelist(cfg *ethconfig.Config) { + whitelist := viper.GetString(WhitelistFlag.Name) if whitelist == "" { return } @@ -1077,101 +1177,83 @@ func setWhitelist(ctx *cli.Context, cfg *ethconfig.Config) { // CheckExclusive verifies that only a single instance of the provided flags was // set by the user. Each flag might optionally be followed by a string type to // specialize it further. -func CheckExclusive(ctx *cli.Context, args ...interface{}) { +func CheckExclusive(args ...interface{}) { set := make([]string, 0, 1) for i := 0; i < len(args); i++ { - // Make sure the next argument is a flag and skip if not set - flag, ok := args[i].(cli.Flag) + // Ensure the argument is a string (flag name) + flag, ok := args[i].(Flag) if !ok { - panic(fmt.Sprintf("invalid argument, not cli.Flag type: %T", args[i])) + panic(fmt.Sprintf("invalid argument, not string type: %T", args[i])) } - // Check if next arg extends current and expand its name if so - name := flag.GetName() + // Check if the next arg extends the current flag if i+1 < len(args) { - switch option := args[i+1].(type) { + switch extension := args[i+1].(type) { case string: - // Extended flag check, make sure value set doesn't conflict with passed in option - if ctx.GlobalString(flag.GetName()) == option { - name += "=" + option - set = append(set, "--"+name) + // Extended flag check + if viper.GetString(flag.Name) == extension { + set = append(set, "--"+flag.Name+"="+extension) } - // shift arguments and continue - i++ + i++ // skip the next argument as it's processed continue - - case cli.Flag: + case Flag: default: - panic(fmt.Sprintf("invalid argument, not cli.Flag or string extension: %T", args[i+1])) + panic(fmt.Sprintf("invalid argument, not string extension: %T", args[i+1])) } } - // Mark the flag if it's set - if ctx.GlobalIsSet(flag.GetName()) { - set = append(set, "--"+name) + + // Check if the flag is set + if viper.IsSet(flag.Name) { + set = append(set, "--"+flag.Name) } } + if len(set) > 1 { Fatalf("Flags %v can't be used at the same time", strings.Join(set, ", ")) } } -func GetNodeLocation(ctx *cli.Context) common.Location { - // Configure global NodeLocation - if !ctx.GlobalIsSet(RegionFlag.Name) && ctx.GlobalIsSet(ZoneFlag.Name) { - log.Fatal("zone idx given, but missing region idx!") - } - nodeLocation := common.Location{} - if ctx.GlobalIsSet(RegionFlag.Name) { - region := ctx.GlobalInt(RegionFlag.Name) - nodeLocation = append(nodeLocation, byte(region)) - } - if ctx.GlobalIsSet(ZoneFlag.Name) { - zone := ctx.GlobalInt(ZoneFlag.Name) - nodeLocation = append(nodeLocation, byte(zone)) - } - return nodeLocation -} - -// SetEthConfig applies eth-related command line flags to the config. -func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config, nodeLocation common.Location) { +// SetQuaiConfig applies eth-related command line flags to the config. +func SetQuaiConfig(stack *node.Node, cfg *ethconfig.Config, nodeLocation common.Location) { // Avoid conflicting network flags - CheckExclusive(ctx, ColosseumFlag, DeveloperFlag, GardenFlag, OrchardFlag, LocalFlag, LighthouseFlag) - CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer + CheckExclusive(ColosseumFlag, DeveloperFlag, GardenFlag, OrchardFlag, LocalFlag, LighthouseFlag) + CheckExclusive(DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer - if ctx.GlobalString(GCModeFlag.Name) == "archive" && ctx.GlobalUint64(TxLookupLimitFlag.Name) != 0 { - ctx.GlobalSet(TxLookupLimitFlag.Name, "0") + if viper.GetString(GCModeFlag.Name) == "archive" && viper.GetUint64(TxLookupLimitFlag.Name) != 0 { + // TODO: see what this is supposed to do + viper.IsSet(TxLookupLimitFlag.Name) log.Warn("Disable transaction unindexing for archive node") } cfg.NodeLocation = nodeLocation // only set etherbase if its a zone chain - if ctx.GlobalIsSet(RegionFlag.Name) && ctx.GlobalIsSet(ZoneFlag.Name) { - setEtherbase(ctx, cfg) + if len(nodeLocation) == 2 { + setEtherbase(cfg) } - setGPO(ctx, &cfg.GPO, ctx.GlobalString(SyncModeFlag.Name) == "light") - setTxPool(ctx, &cfg.TxPool, nodeLocation) + setGPO(&cfg.GPO) + setTxPool(&cfg.TxPool, nodeLocation) // If blake3 consensus engine is specifically asked use the blake3 engine - if ctx.GlobalString(ConsensusEngineFlag.Name) == "blake3" { + if viper.GetString(ConsensusEngineFlag.Name) == "blake3" { cfg.ConsensusEngine = "blake3" } else { cfg.ConsensusEngine = "progpow" } - setConsensusEngineConfig(ctx, cfg) + setConsensusEngineConfig(cfg) - setWhitelist(ctx, cfg) + setWhitelist(cfg) // set the dominant chain websocket url - setDomUrl(ctx, cfg) + setDomUrl(cfg, nodeLocation) // set the subordinate chain websocket urls - setSubUrls(ctx, cfg) + setSubUrls(cfg, nodeLocation) // set the gas limit ceil - setGasLimitCeil(ctx, cfg) + setGasLimitCeil(cfg) // set the slices that the node is running - setSlicesRunning(ctx, cfg) + setSlicesRunning(cfg) // Cap the cache allowance and tune the garbage collector mem, err := gopsutil.VirtualMemory() @@ -1181,238 +1263,137 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config, nod mem.Total = 2 * 1024 * 1024 * 1024 } allowance := int(mem.Total / 1024 / 1024 / 3) - if cache := ctx.GlobalInt(CacheFlag.Name); cache > allowance { + if cache := viper.GetInt(CacheFlag.Name); cache > allowance { log.Warn("Sanitizing cache to Go's GC limits", "provided", cache, "updated", allowance) - ctx.GlobalSet(CacheFlag.Name, strconv.Itoa(allowance)) + viper.GetViper().Set(CacheFlag.Name, strconv.Itoa(allowance)) } } // Ensure Go's GC ignores the database cache for trigger percentage - cache := ctx.GlobalInt(CacheFlag.Name) + cache := viper.GetInt(CacheFlag.Name) gogc := math.Max(20, math.Min(100, 100/(float64(cache)/1024))) log.Debug("Sanitizing Go's GC trigger", "percent", int(gogc)) godebug.SetGCPercent(int(gogc)) - if ctx.GlobalIsSet(SyncModeFlag.Name) { - cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode) - } - if ctx.GlobalIsSet(NetworkIdFlag.Name) { - cfg.NetworkId = ctx.GlobalUint64(NetworkIdFlag.Name) + if viper.IsSet(NetworkIdFlag.Name) { + cfg.NetworkId = viper.GetUint64(NetworkIdFlag.Name) } - if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheDatabaseFlag.Name) { - cfg.DatabaseCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100 + if viper.IsSet(CacheFlag.Name) || viper.IsSet(CacheDatabaseFlag.Name) { + cfg.DatabaseCache = viper.GetInt(CacheFlag.Name) * viper.GetInt(CacheDatabaseFlag.Name) / 100 } cfg.DatabaseHandles = MakeDatabaseHandles() - if ctx.GlobalIsSet(AncientFlag.Name) { - cfg.DatabaseFreezer = ctx.GlobalString(AncientFlag.Name) + if viper.IsSet(AncientDirFlag.Name) { + cfg.DatabaseFreezer = viper.GetString(AncientDirFlag.Name) } - if gcmode := ctx.GlobalString(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" { + if gcmode := viper.GetString(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" { Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name) } - if ctx.GlobalIsSet(GCModeFlag.Name) { - cfg.NoPruning = ctx.GlobalString(GCModeFlag.Name) == "archive" + if viper.IsSet(GCModeFlag.Name) { + cfg.NoPruning = viper.GetString(GCModeFlag.Name) == "archive" } - if ctx.GlobalIsSet(CacheNoPrefetchFlag.Name) { - cfg.NoPrefetch = ctx.GlobalBool(CacheNoPrefetchFlag.Name) + if viper.IsSet(CacheNoPrefetchFlag.Name) { + cfg.NoPrefetch = viper.GetBool(CacheNoPrefetchFlag.Name) } // Read the value from the flag no matter if it's set or not. - cfg.Preimages = ctx.GlobalBool(CachePreimagesFlag.Name) + cfg.Preimages = viper.GetBool(CachePreimagesFlag.Name) if cfg.NoPruning && !cfg.Preimages { cfg.Preimages = true log.Info("Enabling recording of key preimages since archive mode is used") } - if ctx.GlobalIsSet(TxLookupLimitFlag.Name) { - cfg.TxLookupLimit = ctx.GlobalUint64(TxLookupLimitFlag.Name) + if viper.IsSet(TxLookupLimitFlag.Name) { + cfg.TxLookupLimit = viper.GetUint64(TxLookupLimitFlag.Name) } - if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) { - cfg.TrieCleanCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheTrieFlag.Name) / 100 + if viper.IsSet(CacheFlag.Name) || viper.IsSet(CacheTrieFlag.Name) { + cfg.TrieCleanCache = viper.GetInt(CacheFlag.Name) * viper.GetInt(CacheTrieFlag.Name) / 100 } - if ctx.GlobalIsSet(CacheTrieJournalFlag.Name) { - cfg.TrieCleanCacheJournal = ctx.GlobalString(CacheTrieJournalFlag.Name) + if viper.IsSet(CacheTrieJournalFlag.Name) { + cfg.TrieCleanCacheJournal = viper.GetString(CacheTrieJournalFlag.Name) } - if ctx.GlobalIsSet(CacheTrieRejournalFlag.Name) { - cfg.TrieCleanCacheRejournal = ctx.GlobalDuration(CacheTrieRejournalFlag.Name) + if viper.IsSet(CacheTrieRejournalFlag.Name) { + cfg.TrieCleanCacheRejournal = viper.GetDuration(CacheTrieRejournalFlag.Name) } - if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) { - cfg.TrieDirtyCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100 + if viper.IsSet(CacheFlag.Name) || viper.IsSet(CacheGCFlag.Name) { + cfg.TrieDirtyCache = viper.GetInt(CacheFlag.Name) * viper.GetInt(CacheGCFlag.Name) / 100 } - if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheSnapshotFlag.Name) { - cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100 + if viper.IsSet(CacheFlag.Name) || viper.IsSet(CacheSnapshotFlag.Name) { + cfg.SnapshotCache = viper.GetInt(CacheFlag.Name) * viper.GetInt(CacheSnapshotFlag.Name) / 100 } - if !ctx.GlobalBool(SnapshotFlag.Name) { + if !viper.GetBool(SnapshotFlag.Name) { cfg.TrieCleanCache += cfg.SnapshotCache cfg.SnapshotCache = 0 // Disabled } - if ctx.GlobalIsSet(DocRootFlag.Name) { - cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name) + if viper.IsSet(DocRootFlag.Name) { + cfg.DocRoot = viper.GetString(DocRootFlag.Name) } - if ctx.GlobalIsSet(VMEnableDebugFlag.Name) { + if viper.IsSet(VMEnableDebugFlag.Name) { // TODO(fjl): force-enable this in --dev mode - cfg.EnablePreimageRecording = ctx.GlobalBool(VMEnableDebugFlag.Name) + cfg.EnablePreimageRecording = viper.GetBool(VMEnableDebugFlag.Name) } - if ctx.GlobalIsSet(RPCGlobalGasCapFlag.Name) { - cfg.RPCGasCap = ctx.GlobalUint64(RPCGlobalGasCapFlag.Name) + if viper.IsSet(RPCGlobalGasCapFlag.Name) { + cfg.RPCGasCap = viper.GetUint64(RPCGlobalGasCapFlag.Name) } if cfg.RPCGasCap != 0 { log.Info("Set global gas cap", "cap", cfg.RPCGasCap) } else { log.Info("Global gas cap disabled") } - if ctx.GlobalIsSet(RPCGlobalTxFeeCapFlag.Name) { - cfg.RPCTxFeeCap = ctx.GlobalFloat64(RPCGlobalTxFeeCapFlag.Name) - } - if ctx.GlobalIsSet(NoDiscoverFlag.Name) { - cfg.EthDiscoveryURLs, cfg.SnapDiscoveryURLs = []string{}, []string{} - } else if ctx.GlobalIsSet(DNSDiscoveryFlag.Name) { - urls := ctx.GlobalString(DNSDiscoveryFlag.Name) - if urls == "" { - cfg.EthDiscoveryURLs = []string{} - } else { - cfg.EthDiscoveryURLs = SplitAndTrim(urls) - } + if viper.IsSet(RPCGlobalTxFeeCapFlag.Name) { + cfg.RPCTxFeeCap = viper.GetFloat64(RPCGlobalTxFeeCapFlag.Name) } // Override any default configs for hard coded networks. switch { - case ctx.GlobalBool(ColosseumFlag.Name): - if !ctx.GlobalIsSet(NetworkIdFlag.Name) { + case viper.GetBool(ColosseumFlag.Name): + if !viper.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 1 } cfg.Genesis = core.DefaultColosseumGenesisBlock(cfg.ConsensusEngine) - if cfg.ConsensusEngine == "blake3" { - SetDNSDiscoveryDefaults(cfg, params.Blake3PowColosseumGenesisHash) - } else { - SetDNSDiscoveryDefaults(cfg, params.ProgpowColosseumGenesisHash) - } - case ctx.GlobalBool(GardenFlag.Name): - if !ctx.GlobalIsSet(NetworkIdFlag.Name) { + case viper.GetBool(GardenFlag.Name): + if !viper.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 2 } cfg.Genesis = core.DefaultGardenGenesisBlock(cfg.ConsensusEngine) - if cfg.ConsensusEngine == "blake3" { - SetDNSDiscoveryDefaults(cfg, params.Blake3PowGardenGenesisHash) - } else { - SetDNSDiscoveryDefaults(cfg, params.ProgpowGardenGenesisHash) - } - case ctx.GlobalBool(OrchardFlag.Name): - if !ctx.GlobalIsSet(NetworkIdFlag.Name) { + case viper.GetBool(OrchardFlag.Name): + if !viper.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 3 } cfg.Genesis = core.DefaultOrchardGenesisBlock(cfg.ConsensusEngine) - if cfg.ConsensusEngine == "blake3" { - SetDNSDiscoveryDefaults(cfg, params.Blake3PowOrchardGenesisHash) - } else { - SetDNSDiscoveryDefaults(cfg, params.ProgpowOrchardGenesisHash) - } - case ctx.GlobalBool(LocalFlag.Name): - if !ctx.GlobalIsSet(NetworkIdFlag.Name) { + case viper.GetBool(LocalFlag.Name): + if !viper.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 4 } cfg.Genesis = core.DefaultLocalGenesisBlock(cfg.ConsensusEngine) - if cfg.ConsensusEngine == "blake3" { - SetDNSDiscoveryDefaults(cfg, params.Blake3PowLocalGenesisHash) - } else { - SetDNSDiscoveryDefaults(cfg, params.ProgpowLocalGenesisHash) - } - case ctx.GlobalBool(LighthouseFlag.Name): - if !ctx.GlobalIsSet(NetworkIdFlag.Name) { + case viper.GetBool(LighthouseFlag.Name): + if !viper.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 5 } cfg.Genesis = core.DefaultLighthouseGenesisBlock(cfg.ConsensusEngine) - if cfg.ConsensusEngine == "blake3" { - SetDNSDiscoveryDefaults(cfg, params.Blake3PowLighthouseGenesisHash) - } else { - SetDNSDiscoveryDefaults(cfg, params.ProgpowLighthouseGenesisHash) - } - case ctx.GlobalBool(DeveloperFlag.Name): - if !ctx.GlobalIsSet(NetworkIdFlag.Name) { + case viper.GetBool(DeveloperFlag.Name): + if !viper.IsSet(NetworkIdFlag.Name) { cfg.NetworkId = 1337 } - cfg.SyncMode = downloader.FullSync - if ctx.GlobalIsSet(DataDirFlag.Name) { + if viper.IsSet(DataDirFlag.Name) { // Check if we have an already initialized chain and fall back to // that if so. Otherwise we need to generate a new genesis spec. - chaindb := MakeChainDatabase(ctx, stack, false) // TODO (MariusVanDerWijden) make this read only + chaindb := MakeChainDatabase(stack, false) // TODO (MariusVanDerWijden) make this read only if rawdb.ReadCanonicalHash(chaindb, 0) != (common.Hash{}) { cfg.Genesis = nil // fallback to db content } chaindb.Close() } - if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) { + if !viper.IsSet(MinerGasPriceFlag.Name) { cfg.Miner.GasPrice = big.NewInt(1) } - default: - if cfg.NetworkId == 1 { - SetDNSDiscoveryDefaults(cfg, params.ProgpowColosseumGenesisHash) - } - } - if !ctx.GlobalBool(LocalFlag.Name) { - cfg.Genesis.Nonce = ctx.GlobalUint64(GenesisNonceFlag.Name) } - - cfg.Genesis.Config.SetLocation(cfg.NodeLocation) -} - -// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if -// no URLs are set. -func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) { - if cfg.EthDiscoveryURLs != nil && len(cfg.EthDiscoveryURLs) > 0 { - return // already set through flags/config + if !viper.GetBool(LocalFlag.Name) { + cfg.Genesis.Nonce = viper.GetUint64(GenesisNonceFlag.Name) } - protocol := "all" - if url := params.KnownDNSNetwork(genesis, protocol, cfg.NodeLocation); url != "" { - cfg.EthDiscoveryURLs = []string{url} - cfg.SnapDiscoveryURLs = cfg.EthDiscoveryURLs - } -} -// RegisterEthService adds a Quai client to the stack. -// The second return value is the full node instance, which may be nil if the -// node is running as a light client. -func RegisterEthService(stack *node.Node, cfg *ethconfig.Config, nodeCtx int) (quaiapi.Backend, *eth.Quai) { - backend, err := eth.New(stack, cfg, nodeCtx) - if err != nil { - Fatalf("Failed to register the Quai service: %v", err) - } - return backend.APIBackend, backend -} - -// RegisterQuaiStatsService configures the Quai Stats daemon and adds it to -// the given node. -func RegisterQuaiStatsService(stack *node.Node, backend quaiapi.Backend, url string, sendfullstats bool) { - if err := quaistats.New(stack, backend, backend.Engine(), url, sendfullstats); err != nil { - Fatalf("Failed to register the Quai Stats service: %v", err) - } -} - -func SetupMetrics(ctx *cli.Context) { - if metrics.Enabled { - log.Info("Enabling metrics collection") - - var ( - enableExport = ctx.GlobalBool(MetricsEnableInfluxDBFlag.Name) - endpoint = ctx.GlobalString(MetricsInfluxDBEndpointFlag.Name) - database = ctx.GlobalString(MetricsInfluxDBDatabaseFlag.Name) - username = ctx.GlobalString(MetricsInfluxDBUsernameFlag.Name) - password = ctx.GlobalString(MetricsInfluxDBPasswordFlag.Name) - ) - - if enableExport { - tagsMap := SplitTagsFlag(ctx.GlobalString(MetricsInfluxDBTagsFlag.Name)) - - log.Info("Enabling metrics export to InfluxDB") - - go influxdb.InfluxDBWithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, database, username, password, "quai.", tagsMap) - } - - if ctx.GlobalIsSet(MetricsHTTPFlag.Name) { - address := fmt.Sprintf("%s:%d", ctx.GlobalString(MetricsHTTPFlag.Name), ctx.GlobalInt(MetricsPortFlag.Name)) - log.Info("Enabling stand-alone metrics HTTP endpoint", "address", address) - exp.Setup(address) - } - } + log.Info("Setting genesis Location", "node", nodeLocation) + cfg.Genesis.Config.Location = nodeLocation + log.Info("Location after setting", "genesis", cfg.Genesis.Config.Location) } func SplitTagsFlag(tagsFlag string) map[string]string { @@ -1433,134 +1414,53 @@ func SplitTagsFlag(tagsFlag string) map[string]string { } // MakeChainDatabase open an LevelDB using the flags passed to the client and will hard crash if it fails. -func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb.Database { +func MakeChainDatabase(stack *node.Node, readonly bool) ethdb.Database { var ( - cache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100 + cache = viper.GetInt(CacheFlag.Name) * viper.GetInt(CacheDatabaseFlag.Name) / 100 handles = MakeDatabaseHandles() err error chainDb ethdb.Database ) name := "chaindata" - chainDb, err = stack.OpenDatabaseWithFreezer(name, cache, handles, ctx.GlobalString(AncientFlag.Name), "", readonly) + chainDb, err = stack.OpenDatabaseWithFreezer(name, cache, handles, viper.GetString(AncientDirFlag.Name), "", readonly) if err != nil { Fatalf("Could not open database: %v", err) } return chainDb } -func MakeGenesis(ctx *cli.Context) *core.Genesis { +func MakeGenesis() *core.Genesis { var genesis *core.Genesis switch { - case ctx.GlobalBool(ColosseumFlag.Name): - genesis = core.DefaultColosseumGenesisBlock(ctx.GlobalString(ConsensusEngineFlag.Name)) - case ctx.GlobalBool(GardenFlag.Name): - genesis = core.DefaultGardenGenesisBlock(ctx.GlobalString(ConsensusEngineFlag.Name)) - case ctx.GlobalBool(OrchardFlag.Name): - genesis = core.DefaultOrchardGenesisBlock(ctx.GlobalString(ConsensusEngineFlag.Name)) - case ctx.GlobalBool(LighthouseFlag.Name): - genesis = core.DefaultLighthouseGenesisBlock(ctx.GlobalString(ConsensusEngineFlag.Name)) - case ctx.GlobalBool(LocalFlag.Name): - genesis = core.DefaultLocalGenesisBlock(ctx.GlobalString(ConsensusEngineFlag.Name)) - case ctx.GlobalBool(DeveloperFlag.Name): + case viper.GetBool(ColosseumFlag.Name): + genesis = core.DefaultColosseumGenesisBlock(viper.GetString(ConsensusEngineFlag.Name)) + case viper.GetBool(GardenFlag.Name): + genesis = core.DefaultGardenGenesisBlock(viper.GetString(ConsensusEngineFlag.Name)) + case viper.GetBool(OrchardFlag.Name): + genesis = core.DefaultOrchardGenesisBlock(viper.GetString(ConsensusEngineFlag.Name)) + case viper.GetBool(LighthouseFlag.Name): + genesis = core.DefaultLighthouseGenesisBlock(viper.GetString(ConsensusEngineFlag.Name)) + case viper.GetBool(LocalFlag.Name): + genesis = core.DefaultLocalGenesisBlock(viper.GetString(ConsensusEngineFlag.Name)) + case viper.GetBool(DeveloperFlag.Name): Fatalf("Developer chains are ephemeral") } return genesis } -// MakeChain creates a chain manager from set command line flags. -func MakeChain(ctx *cli.Context, stack *node.Node) (*core.Core, ethdb.Database) { - var err error - chainDb := MakeChainDatabase(ctx, stack, false) // TODO(rjl493456442) support read-only database - config, _, err := core.SetupGenesisBlock(chainDb, MakeGenesis(ctx), stack.Config().NodeLocation) - if err != nil { - Fatalf("%v", err) - } - var engine consensus.Engine - - engine = progpow.NewFaker() - if !ctx.GlobalBool(FakePoWFlag.Name) { - engine = progpow.New(progpow.Config{}, nil, false) - } - - // If blake3 consensus engine is selected use the blake3 engine - if ctx.GlobalString(ConsensusEngineFlag.Name) == "blake3" { - engine = blake3pow.New(blake3pow.Config{}, nil, false) - } - - if gcmode := ctx.GlobalString(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" { - Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name) - } - cache := &core.CacheConfig{ - TrieCleanLimit: ethconfig.Defaults.TrieCleanCache, - TrieCleanNoPrefetch: ctx.GlobalBool(CacheNoPrefetchFlag.Name), - TrieDirtyLimit: ethconfig.Defaults.TrieDirtyCache, - TrieDirtyDisabled: ctx.GlobalString(GCModeFlag.Name) == "archive", - TrieTimeLimit: ethconfig.Defaults.TrieTimeout, - SnapshotLimit: ethconfig.Defaults.SnapshotCache, - Preimages: ctx.GlobalBool(CachePreimagesFlag.Name), - } - if cache.TrieDirtyDisabled && !cache.Preimages { - cache.Preimages = true - log.Info("Enabling recording of key preimages since archive mode is used") - } - if !ctx.GlobalBool(SnapshotFlag.Name) { - cache.SnapshotLimit = 0 // Disabled - } - if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) { - cache.TrieCleanLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheTrieFlag.Name) / 100 - } - if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) { - cache.TrieDirtyLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100 - } - vmcfg := vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)} - - // TODO(rjl493456442) disable snapshot generation/wiping if the chain is read only. - // Disable transaction indexing/unindexing by default. - protocol, err := core.NewCore(chainDb, nil, nil, nil, nil, config, nil, ctx.GlobalString(DomUrl.Name), makeSubUrls(ctx), engine, cache, vmcfg, &core.Genesis{}) - if err != nil { - Fatalf("Can't create BlockChain: %v", err) - } - return protocol, chainDb -} - // MakeConsolePreloads retrieves the absolute paths for the console JavaScript // scripts to preload before starting. -func MakeConsolePreloads(ctx *cli.Context) []string { +func MakeConsolePreloads() []string { // Skip preloading if there's nothing to preload - if ctx.GlobalString(PreloadJSFlag.Name) == "" { + if viper.GetString(PreloadJSFlag.Name) == "" { return nil } // Otherwise resolve absolute paths and return them var preloads []string - for _, file := range strings.Split(ctx.GlobalString(PreloadJSFlag.Name), ",") { + for _, file := range strings.Split(viper.GetString(PreloadJSFlag.Name), ",") { preloads = append(preloads, strings.TrimSpace(file)) } return preloads } - -// MigrateFlags sets the global flag from a local flag when it's set. -// This is a temporary function used for migrating old command/flags to the -// new format. -// -// e.g. quai account new --keystore /tmp/mykeystore --lightkdf -// -// is equivalent after calling this method with: -// -// quai --keystore /tmp/mykeystore --lightkdf account new -// -// This allows the use of the existing configuration functionality. -// When all flags are migrated this function can be removed and the existing -// configuration functionality must be changed that is uses local flags -func MigrateFlags(action func(ctx *cli.Context) error) func(*cli.Context) error { - return func(ctx *cli.Context) error { - for _, name := range ctx.FlagNames() { - if ctx.IsSet(name) { - ctx.GlobalSet(name, ctx.String(name)) - } - } - return action(ctx) - } ->>>>>>> 88c428a1 (Removing NodeLocation from common) -} diff --git a/common/utils.go b/cmd/utils/utils.go similarity index 95% rename from common/utils.go rename to cmd/utils/utils.go index e2bcbf9777..1dc0540e66 100644 --- a/common/utils.go +++ b/cmd/utils/utils.go @@ -1,11 +1,10 @@ -package common +package utils import ( "errors" "io/fs" "os" - "github.com/dominant-strategies/go-quai/cmd/utils" "github.com/dominant-strategies/go-quai/common/constants" "github.com/dominant-strategies/go-quai/log" "github.com/spf13/viper" @@ -56,7 +55,7 @@ func SaveConfig() error { } else if os.IsNotExist(err) { // config file does not exist, create directory if it does not exist if _, err := os.Stat(configFile); os.IsNotExist(err) { - configDir := viper.GetString(utils.ConfigDirFlag.Name) + configDir := viper.GetString(ConfigDirFlag.Name) if err := os.MkdirAll(configDir, 0755); err != nil { return err } diff --git a/common/utils_test.go b/cmd/utils/utils_test.go similarity index 80% rename from common/utils_test.go rename to cmd/utils/utils_test.go index 5e1fcec913..ec98f198c3 100644 --- a/common/utils_test.go +++ b/cmd/utils/utils_test.go @@ -1,10 +1,9 @@ -package common +package utils import ( "os" "testing" - "github.com/dominant-strategies/go-quai/cmd/utils" "github.com/dominant-strategies/go-quai/common/constants" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -20,7 +19,7 @@ func TestSaveConfig(t *testing.T) { defer tempFile.Close() defer os.RemoveAll(mockConfigPath) // write LOG_LEVEL config to mock config.yaml file - _, err := tempFile.WriteString(utils.LogLevelFlag.Name + " : " + "debug\n") + _, err := tempFile.WriteString(LogLevelFlag.Name + " : " + "debug\n") require.NoError(t, err) // Clear viper instance to simulate a fresh start viper.Reset() @@ -39,7 +38,7 @@ func TestSaveConfig(t *testing.T) { // Load config from mock file into viper and assert that the new config parameters were saved err = viper.ReadInConfig() require.NoError(t, err) - assert.Equal(t, "8080", viper.GetString(utils.P2PPortFlag.Name)) + assert.Equal(t, "8080", viper.GetString(P2PPortFlag.Name)) // Assert a .bak config file was created backupFile, err := os.Stat(mockConfigPath + constants.CONFIG_FILE_NAME + ".bak") assert.False(t, os.IsNotExist(err)) @@ -57,7 +56,7 @@ func testXDGConfigLoading(t *testing.T) { defer os.RemoveAll(mockConfigPath) // write 'LOG_LEVEL=debug' config to mock config.yaml file - _, err := tempFile.WriteString(utils.LogLevelFlag.Name + " : " + "debug\n") + _, err := tempFile.WriteString(LogLevelFlag.Name + " : " + "debug\n") require.NoError(t, err) // Set config path to the temporary config directory @@ -66,7 +65,7 @@ func testXDGConfigLoading(t *testing.T) { InitConfig() // Assert log level is set to "debug" as per the mock config file - assert.Equal(t, "debug", viper.GetString(utils.LogLevelFlag.Name)) + assert.Equal(t, "debug", viper.GetString(LogLevelFlag.Name)) } // TestCobraFlagConfigLoading tests the loading of the config file from the XDG config home, @@ -79,21 +78,21 @@ func TestCobraFlagConfigLoading(t *testing.T) { // Test loading config from XDG config home testXDGConfigLoading(t) - assert.Equal(t, "debug", viper.GetString(utils.LogLevelFlag.Name)) + assert.Equal(t, "debug", viper.GetString(LogLevelFlag.Name)) // Test loading config from environment variable err := os.Setenv(constants.ENV_PREFIX+"_"+"LOG-LEVEL", "error") defer os.Unsetenv(constants.ENV_PREFIX + "_" + "LOG-LEVEL") require.NoError(t, err) - assert.Equal(t, "error", viper.GetString(utils.LogLevelFlag.Name)) + assert.Equal(t, "error", viper.GetString(LogLevelFlag.Name)) // Test loading config from cobra flag rootCmd := &cobra.Command{} - rootCmd.PersistentFlags().StringP(utils.LogLevelFlag.Name, "l", "warn", "log level (trace, debug, info, warn, error, fatal, panic") - err = rootCmd.PersistentFlags().Set(utils.LogLevelFlag.Name, "trace") + rootCmd.PersistentFlags().StringP(LogLevelFlag.Name, "l", "warn", "log level (trace, debug, info, warn, error, fatal, panic") + err = rootCmd.PersistentFlags().Set(LogLevelFlag.Name, "trace") require.NoError(t, err) viper.BindPFlags(rootCmd.PersistentFlags()) - assert.Equal(t, "trace", viper.GetString(utils.LogLevelFlag.Name)) + assert.Equal(t, "trace", viper.GetString(LogLevelFlag.Name)) } diff --git a/consensus/blake3pow/api.go b/consensus/blake3pow/api.go index 7e553afac1..cd532072d7 100644 --- a/consensus/blake3pow/api.go +++ b/consensus/blake3pow/api.go @@ -20,7 +20,6 @@ import ( "errors" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/common/hexutil" "github.com/dominant-strategies/go-quai/core/types" ) diff --git a/consensus/blake3pow/blake3pow.go b/consensus/blake3pow/blake3pow.go index 3b2cda32fc..4b6643b775 100644 --- a/consensus/blake3pow/blake3pow.go +++ b/consensus/blake3pow/blake3pow.go @@ -7,7 +7,6 @@ import ( "time" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/common/hexutil" "github.com/dominant-strategies/go-quai/consensus" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/rpc" @@ -78,9 +77,6 @@ type Blake3pow struct { // remote mining, also optionally notifying a batch of remote services of new work // packages. func New(config Config, notify []string, noverify bool) *Blake3pow { - if config.Log == nil { - config.Log = &log.Log - } blake3pow := &Blake3pow{ config: config, update: make(chan struct{}), @@ -105,7 +101,6 @@ func NewFaker() *Blake3pow { return &Blake3pow{ config: Config{ PowMode: ModeFake, - Log: &log.Log, }, } } @@ -117,7 +112,6 @@ func NewFakeFailer(fail uint64) *Blake3pow { return &Blake3pow{ config: Config{ PowMode: ModeFake, - Log: &log.Log, }, fakeFail: fail, } @@ -130,7 +124,6 @@ func NewFakeDelayer(delay time.Duration) *Blake3pow { return &Blake3pow{ config: Config{ PowMode: ModeFake, - Log: &log.Log, }, fakeDelay: delay, } @@ -142,7 +135,6 @@ func NewFullFaker() *Blake3pow { return &Blake3pow{ config: Config{ PowMode: ModeFullFake, - Log: &log.Log, }, } } diff --git a/consensus/blake3pow/sealer.go b/consensus/blake3pow/sealer.go index c0423bb9bb..1f876d98df 100644 --- a/consensus/blake3pow/sealer.go +++ b/consensus/blake3pow/sealer.go @@ -40,7 +40,7 @@ func (blake3pow *Blake3pow) Seal(header *types.Header, results chan<- *types.Hea select { case results <- header: default: - blake3pow.config.Log.Warn("Sealing result is not read by miner", "mode", "fake", "sealhash", header.SealHash()) + log.Warn("Sealing result is not read by miner", "mode", "fake", "sealhash", header.SealHash()) } return nil } @@ -68,10 +68,6 @@ func (blake3pow *Blake3pow) Seal(header *types.Header, results chan<- *types.Hea if threads < 0 { threads = 0 // Allows disabling local mining without extra logic around local/remote } - // Push new work to remote sealer - if blake3pow.remote != nil { - blake3pow.remote.workCh <- &sealTask{header: header, results: results} - } var ( pend sync.WaitGroup locals = make(chan *types.Header) @@ -95,14 +91,14 @@ func (blake3pow *Blake3pow) Seal(header *types.Header, results chan<- *types.Hea select { case results <- result: default: - blake3pow.config.Log.Warn("Sealing result is not read by miner", "mode", "local", "sealhash", header.SealHash()) + log.Warn("Sealing result is not read by miner", "mode", "local", "sealhash", header.SealHash()) } close(abort) case <-blake3pow.update: // Thread count was changed on user request, restart close(abort) if err := blake3pow.Seal(header, results, stop); err != nil { - blake3pow.config.Log.Error("Failed to restart sealing after update", "err", err) + log.Error("Failed to restart sealing after update", "err", err) } } // Wait for all miners to terminate and return the block @@ -124,14 +120,13 @@ func (blake3pow *Blake3pow) mine(header *types.Header, id int, seed uint64, abor nonce = seed powBuffer = new(big.Int) ) - logger := log.Log - logger.Trace("Started blake3pow search for new nonces", "seed", seed) + log.Trace("Started blake3pow search for new nonces", "seed", seed) search: for { select { case <-abort: // Mining terminated, update stats and abort - logger.Trace("Blake3pow nonce search aborted", "attempts", nonce-seed) + log.Trace("Blake3pow nonce search aborted", "attempts", nonce-seed) break search default: @@ -150,9 +145,9 @@ search: // Seal and return a block (if still needed) select { case found <- header: - logger.Trace("Blake3pow nonce found and reported", "attempts", nonce-seed, "nonce", nonce) + log.Trace("Blake3pow nonce found and reported", "attempts", nonce-seed, "nonce", nonce) case <-abort: - logger.Trace("Blake3pow nonce found but discarded", "attempts", nonce-seed, "nonce", nonce) + log.Trace("Blake3pow nonce found but discarded", "attempts", nonce-seed, "nonce", nonce) } break search } @@ -239,7 +234,7 @@ func startRemoteSealer(blake3pow *Blake3pow, urls []string, noverify bool) *remo func (s *remoteSealer) loop() { defer func() { - s.blake3pow.config.Log.Trace("Blake3pow remote sealer is exiting") + log.Trace("Blake3pow remote sealer is exiting") s.cancelNotify() s.reqWG.Wait() close(s.exitCh) @@ -355,7 +350,7 @@ func (s *remoteSealer) sendNotification(ctx context.Context, url string, json [] req, err := http.NewRequest("POST", url, bytes.NewReader(json)) if err != nil { - s.blake3pow.config.Log.Warn("Can't create remote miner notification", "err", err) + log.Warn("Can't create remote miner notification", "err", err) return } ctx, cancel := context.WithTimeout(ctx, remoteSealerTimeout) @@ -365,9 +360,9 @@ func (s *remoteSealer) sendNotification(ctx context.Context, url string, json [] resp, err := http.DefaultClient.Do(req) if err != nil { - s.blake3pow.config.Log.Warn("Failed to notify remote miner", "err", err) + log.Warn("Failed to notify remote miner", "err", err) } else { - s.blake3pow.config.Log.Trace("Notified remote miner", "miner", url, "hash", work[0], "target", work[2]) + log.Trace("Notified remote miner", "miner", url, "hash", work[0], "target", work[2]) resp.Body.Close() } } @@ -377,14 +372,14 @@ func (s *remoteSealer) sendNotification(ctx context.Context, url string, json [] // any other error, like no pending work or stale mining result). func (s *remoteSealer) submitWork(nonce types.BlockNonce, sealhash common.Hash) bool { if s.currentHeader == nil { - s.blake3pow.config.Log.Error("Pending work without block", "sealhash", sealhash) + log.Error("Pending work without block", "sealhash", sealhash) return false } nodeCtx := s.blake3pow.config.NodeLocation.Context() // Make sure the work submitted is present header := s.works[sealhash] if header == nil { - s.blake3pow.config.Log.Warn("Work submitted but none pending", "sealhash", sealhash, "curnumber", s.currentHeader.NumberU64(nodeCtx)) + log.Warn("Work submitted but none pending", "sealhash", sealhash, "curnumber", s.currentHeader.NumberU64(nodeCtx)) return false } // Verify the correctness of submitted result. @@ -393,10 +388,10 @@ func (s *remoteSealer) submitWork(nonce types.BlockNonce, sealhash common.Hash) start := time.Now() // Make sure the result channel is assigned. if s.results == nil { - s.blake3pow.config.Log.Warn("Blake3pow result channel is empty, submitted mining result is rejected") + log.Warn("Blake3pow result channel is empty, submitted mining result is rejected") return false } - s.blake3pow.config.Log.Trace("Verified correct proof-of-work", "sealhash", sealhash, "elapsed", common.PrettyDuration(time.Since(start))) + log.Trace("Verified correct proof-of-work", "sealhash", sealhash, "elapsed", common.PrettyDuration(time.Since(start))) // Solutions seems to be valid, return to the miner and notify acceptance. solution := header @@ -405,14 +400,14 @@ func (s *remoteSealer) submitWork(nonce types.BlockNonce, sealhash common.Hash) if solution.NumberU64(nodeCtx)+staleThreshold > s.currentHeader.NumberU64(nodeCtx) { select { case s.results <- solution: - s.blake3pow.config.Log.Debug("Work submitted is acceptable", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) + log.Debug("Work submitted is acceptable", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) return true default: - s.blake3pow.config.Log.Warn("Sealing result is not read by miner", "mode", "remote", "sealhash", sealhash) + log.Warn("Sealing result is not read by miner", "mode", "remote", "sealhash", sealhash) return false } } // The submitted block is too old to accept, drop it. - s.blake3pow.config.Log.Warn("Work submitted is too old", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) + log.Warn("Work submitted is too old", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) return false } diff --git a/consensus/progpow/algorithm.go b/consensus/progpow/algorithm.go index 6048c0f6cb..44856bc95b 100644 --- a/consensus/progpow/algorithm.go +++ b/consensus/progpow/algorithm.go @@ -144,15 +144,14 @@ func SeedHash(block uint64) []byte { // This method places the result into dest in machine byte order. func generateCache(dest []uint32, epoch uint64, seed []byte) { // Print some debug logs to allow analysis on low end devices - logger := log.New("epoch") start := time.Now() defer func() { elapsed := time.Since(start) - logFn := logger.Debug + logFn := log.Debug if elapsed > 3*time.Second { - logFn = logger.Info + logFn = log.Info } logFn("Generated ethash verification cache", "elapsed", common.PrettyDuration(elapsed)) }() @@ -178,7 +177,7 @@ func generateCache(dest []uint32, epoch uint64, seed []byte) { case <-done: return case <-time.After(3 * time.Second): - logger.Info("Generating ethash verification cache", "percentage", atomic.LoadUint32(&progress)*100/uint32(rows)/4, "elapsed", common.PrettyDuration(time.Since(start))) + log.Info("Generating ethash verification cache", "percentage", atomic.LoadUint32(&progress)*100/uint32(rows)/4, "elapsed", common.PrettyDuration(time.Since(start))) } } }() @@ -292,16 +291,13 @@ func generateDatasetItem(cache []uint32, index uint32, keccak512 hasher) []byte // generateDataset generates the entire ethash dataset for mining. // This method places the result into dest in machine byte order. func generateDataset(dest []uint32, epoch uint64, cache []uint32) { - // Print some debug logs to allow analysis on low end devices - logger := log.New("epoch") - start := time.Now() defer func() { elapsed := time.Since(start) - logFn := logger.Debug + logFn := log.Debug if elapsed > 3*time.Second { - logFn = logger.Info + logFn = log.Info } logFn("Generated ethash verification cache", "elapsed", common.PrettyDuration(elapsed)) }() @@ -347,7 +343,7 @@ func generateDataset(dest []uint32, epoch uint64, cache []uint32) { copy(dataset[index*hashBytes:], item) if status := atomic.AddUint32(&progress, 1); status%percent == 0 { - logger.Info("Generating DAG in progress", "percentage", uint64(status*100)/(size/hashBytes), "elapsed", common.PrettyDuration(time.Since(start))) + log.Info("Generating DAG in progress", "percentage", uint64(status*100)/(size/hashBytes), "elapsed", common.PrettyDuration(time.Since(start))) } } }(i) diff --git a/consensus/progpow/api.go b/consensus/progpow/api.go index 522bd70d97..471eee247a 100644 --- a/consensus/progpow/api.go +++ b/consensus/progpow/api.go @@ -20,7 +20,6 @@ import ( "errors" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/common/hexutil" "github.com/dominant-strategies/go-quai/core/types" ) diff --git a/consensus/progpow/progpow.go b/consensus/progpow/progpow.go index 73aeb8e540..f7bb469eb8 100644 --- a/consensus/progpow/progpow.go +++ b/consensus/progpow/progpow.go @@ -15,7 +15,6 @@ import ( "unsafe" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/common/hexutil" "github.com/dominant-strategies/go-quai/consensus" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/rpc" @@ -193,15 +192,12 @@ type Progpow struct { // remote mining, also optionally notifying a batch of remote services of new work // packages. func New(config Config, notify []string, noverify bool) *Progpow { - if config.Log == nil { - config.Log = &log.Log - } if config.CachesInMem <= 0 { - config.Log.Warn("One ethash cache must always be in memory", "requested", config.CachesInMem) + log.Warn("One ethash cache must always be in memory", "requested", config.CachesInMem) config.CachesInMem = 1 } if config.CacheDir != "" && config.CachesOnDisk > 0 { - config.Log.Info("Disk storage enabled for ethash caches", "dir", config.CacheDir, "count", config.CachesOnDisk) + log.Info("Disk storage enabled for ethash caches", "dir", config.CacheDir, "count", config.CachesOnDisk) } progpow := &Progpow{ config: config, @@ -228,7 +224,6 @@ func NewFaker() *Progpow { return &Progpow{ config: Config{ PowMode: ModeFake, - Log: &log.Log, }, } } @@ -240,7 +235,6 @@ func NewFakeFailer(fail uint64) *Progpow { return &Progpow{ config: Config{ PowMode: ModeFake, - Log: &log.Log, }, fakeFail: fail, } @@ -253,7 +247,6 @@ func NewFakeDelayer(delay time.Duration) *Progpow { return &Progpow{ config: Config{ PowMode: ModeFake, - Log: &log.Log, }, fakeDelay: delay, } @@ -265,7 +258,6 @@ func NewFullFaker() *Progpow { return &Progpow{ config: Config{ PowMode: ModeFullFake, - Log: &log.Log, }, } } @@ -379,7 +371,6 @@ func (c *cache) generate(dir string, limit int, lock bool, test bool) { endian = ".be" } path := filepath.Join(dir, fmt.Sprintf("cache-R%d-%x%s", algorithmRevision, seed[:8], endian)) - logger := log.New("epoch") // We're about to mmap the file, ensure that the mapping is cleaned up when the // cache becomes unused. @@ -389,17 +380,17 @@ func (c *cache) generate(dir string, limit int, lock bool, test bool) { var err error c.dump, c.mmap, c.cache, err = memoryMap(path, lock) if err == nil { - logger.Debug("Loaded old ethash cache from disk") + log.Debug("Loaded old ethash cache from disk") c.cDag = make([]uint32, progpowCacheWords) generateCDag(c.cDag, c.cache, c.epoch) return } - logger.Debug("Failed to load old ethash cache", "err", err) + log.Debug("Failed to load old ethash cache", "err", err) // No previous cache available, create a new cache file to fill c.dump, c.mmap, c.cache, err = memoryMapAndGenerate(path, size, lock, func(buffer []uint32) { generateCache(buffer, c.epoch, seed) }) if err != nil { - logger.Error("Failed to generate mapped ethash cache", "err", err) + log.Error("Failed to generate mapped ethash cache", "err", err) c.cache = make([]uint32, size/4) generateCache(c.cache, c.epoch, seed) diff --git a/consensus/progpow/sealer.go b/consensus/progpow/sealer.go index bedf2b1be6..24c36fd99c 100644 --- a/consensus/progpow/sealer.go +++ b/consensus/progpow/sealer.go @@ -17,6 +17,7 @@ import ( "github.com/dominant-strategies/go-quai/common" "github.com/dominant-strategies/go-quai/common/hexutil" "github.com/dominant-strategies/go-quai/core/types" + "github.com/dominant-strategies/go-quai/log" ) const ( @@ -39,7 +40,7 @@ func (progpow *Progpow) Seal(header *types.Header, results chan<- *types.Header, select { case results <- header: default: - progpow.config.Log.Warn("Sealing result is not read by miner", "mode", "fake", "sealhash", header.SealHash()) + log.Warn("Sealing result is not read by miner", "mode", "fake", "sealhash", header.SealHash()) } return nil } @@ -67,10 +68,6 @@ func (progpow *Progpow) Seal(header *types.Header, results chan<- *types.Header, if threads < 0 { threads = 0 // Allows disabling local mining without extra logic around local/remote } - // Push new work to remote sealer - if progpow.remote != nil { - progpow.remote.workCh <- &sealTask{header: header, results: results} - } var ( pend sync.WaitGroup locals = make(chan *types.Header) @@ -94,14 +91,14 @@ func (progpow *Progpow) Seal(header *types.Header, results chan<- *types.Header, select { case results <- result: default: - progpow.config.Log.Warn("Sealing result is not read by miner", "mode", "local", "sealhash", header.SealHash()) + log.Warn("Sealing result is not read by miner", "mode", "local", "sealhash", header.SealHash()) } close(abort) case <-progpow.update: // Thread count was changed on user request, restart close(abort) if err := progpow.Seal(header, results, stop); err != nil { - progpow.config.Log.Error("Failed to restart sealing after update", "err", err) + log.Error("Failed to restart sealing after update", "err", err) } } // Wait for all miners to terminate and return the block @@ -241,7 +238,7 @@ func startRemoteSealer(progpow *Progpow, urls []string, noverify bool) *remoteSe func (s *remoteSealer) loop() { defer func() { - s.progpow.config.Log.Trace("Progpow remote sealer is exiting") + log.Trace("Progpow remote sealer is exiting") s.cancelNotify() s.reqWG.Wait() close(s.exitCh) @@ -358,7 +355,7 @@ func (s *remoteSealer) sendNotification(ctx context.Context, url string, json [] req, err := http.NewRequest("POST", url, bytes.NewReader(json)) if err != nil { - s.progpow.config.Log.Warn("Can't create remote miner notification", "err", err) + log.Warn("Can't create remote miner notification", "err", err) return } ctx, cancel := context.WithTimeout(ctx, remoteSealerTimeout) @@ -368,9 +365,9 @@ func (s *remoteSealer) sendNotification(ctx context.Context, url string, json [] resp, err := http.DefaultClient.Do(req) if err != nil { - s.progpow.config.Log.Warn("Failed to notify remote miner", "err", err) + log.Warn("Failed to notify remote miner", "err", err) } else { - s.progpow.config.Log.Trace("Notified remote miner", "miner", url, "hash", work[0], "target", work[2]) + log.Trace("Notified remote miner", "miner", url, "hash", work[0], "target", work[2]) resp.Body.Close() } } @@ -380,14 +377,14 @@ func (s *remoteSealer) sendNotification(ctx context.Context, url string, json [] // any other error, like no pending work or stale mining result). func (s *remoteSealer) submitWork(nonce types.BlockNonce, sealhash common.Hash) bool { if s.currentHeader == nil { - s.progpow.config.Log.Error("Pending work without block", "sealhash", sealhash) + log.Error("Pending work without block", "sealhash", sealhash) return false } nodeCtx := s.progpow.config.NodeLocation.Context() // Make sure the work submitted is present header := s.works[sealhash] if header == nil { - s.progpow.config.Log.Warn("Work submitted but none pending", "sealhash", sealhash, "curnumber", s.currentHeader.NumberU64(nodeCtx)) + log.Warn("Work submitted but none pending", "sealhash", sealhash, "curnumber", s.currentHeader.NumberU64(nodeCtx)) return false } // Verify the correctness of submitted result. @@ -399,10 +396,10 @@ func (s *remoteSealer) submitWork(nonce types.BlockNonce, sealhash common.Hash) } // Make sure the result channel is assigned. if s.results == nil { - s.progpow.config.Log.Warn("Progpow result channel is empty, submitted mining result is rejected") + log.Warn("Progpow result channel is empty, submitted mining result is rejected") return false } - s.progpow.config.Log.Trace("Verified correct proof-of-work", "sealhash", sealhash, "elapsed", common.PrettyDuration(time.Since(start))) + log.Trace("Verified correct proof-of-work", "sealhash", sealhash, "elapsed", common.PrettyDuration(time.Since(start))) // Solutions seems to be valid, return to the miner and notify acceptance. solution := header @@ -411,14 +408,14 @@ func (s *remoteSealer) submitWork(nonce types.BlockNonce, sealhash common.Hash) if solution.NumberU64(nodeCtx)+staleThreshold > s.currentHeader.NumberU64(nodeCtx) { select { case s.results <- solution: - s.progpow.config.Log.Debug("Work submitted is acceptable", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) + log.Debug("Work submitted is acceptable", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) return true default: - s.progpow.config.Log.Warn("Sealing result is not read by miner", "mode", "remote", "sealhash", sealhash) + log.Warn("Sealing result is not read by miner", "mode", "remote", "sealhash", sealhash) return false } } // The submitted block is too old to accept, drop it. - s.progpow.config.Log.Warn("Work submitted is too old", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) + log.Warn("Work submitted is too old", "number", solution.NumberU64(nodeCtx), "sealhash", sealhash, "hash", solution.Hash()) return false } diff --git a/consensus/types/block.go b/consensus/types/block.go deleted file mode 100644 index 435808c51b..0000000000 --- a/consensus/types/block.go +++ /dev/null @@ -1,9 +0,0 @@ -package types - -type Block struct { - Hash Hash -} - -type Slice struct { - SliceID SliceID -} \ No newline at end of file diff --git a/consensus/types/transaction.go b/consensus/types/transaction.go deleted file mode 100644 index 113911cf77..0000000000 --- a/consensus/types/transaction.go +++ /dev/null @@ -1,3 +0,0 @@ -package types - -type Transaction struct{} diff --git a/core/chain_indexer.go b/core/chain_indexer.go index 30d78ee741..2dedf58c01 100644 --- a/core/chain_indexer.go +++ b/core/chain_indexer.go @@ -110,7 +110,6 @@ func NewChainIndexer(chainDb ethdb.Database, indexDb ethdb.Database, backend Cha sectionSize: section, confirmsReq: confirm, throttling: throttling, - log: log.Log, } // Initialize database dependent fields and start the updater c.loadValidSections() diff --git a/core/core.go b/core/core.go index 1ce5649146..ffbcc266b2 100644 --- a/core/core.go +++ b/core/core.go @@ -459,9 +459,7 @@ func (c *Core) printStats() { for _, hash := range c.appendQueue.Keys()[:math.Min(len(c.appendQueue.Keys()), c_appendQueuePrintSize)] { if value, exist := c.appendQueue.Peek(hash); exist { hashNumber := types.HashAndNumber{Hash: hash.(common.Hash), Number: value.(blockNumberAndRetryCounter).number} - log.Lazy(func() string { - return "AppendQueue entry. Number: " + strconv.FormatUint(hashNumber.Number, 10) + ". Hash: " + hashNumber.Hash.String() - }, "debug") + log.Debug("AppendQueue entry. Number: " + strconv.FormatUint(hashNumber.Number, 10) + ". Hash: " + hashNumber.Hash.String()) } } diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index 6acb6d45d1..4442c4bed3 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -453,7 +453,7 @@ func (f *freezer) freeze(db ethdb.KeyValueStore, nodeCtx int) { if n := len(ancients); n > 0 { context = append(context, []interface{}{"hash", ancients[n-1]}...) } - log.Info("Deep froze chain segment", context...) + log.Info("Deep froze chain segment", context) // Avoid database thrashing with tiny writes if f.frozen-first < freezerBatchLimit { diff --git a/core/rawdb/freezer_table.go b/core/rawdb/freezer_table.go index 93b811a60e..66255c26a5 100644 --- a/core/rawdb/freezer_table.go +++ b/core/rawdb/freezer_table.go @@ -95,8 +95,7 @@ type freezerTable struct { headBytes uint32 // Number of bytes written to the head file - logger log.Logger // Logger with database path and table name ambedded - lock sync.RWMutex // Mutex protecting the data file descriptors + lock sync.RWMutex // Mutex protecting the data file descriptors } // NewFreezerTable opens the given path as a freezer table. @@ -173,7 +172,6 @@ func newCustomTable(path string, name string, maxFilesize uint32, noCompression files: make(map[uint32]*os.File), name: name, path: path, - logger: log.Log, noCompression: noCompression, maxFileSize: maxFilesize, } @@ -243,7 +241,7 @@ func (t *freezerTable) repair() error { for contentExp != contentSize { // Truncate the head file to the last offset pointer if contentExp < contentSize { - t.logger.Warn("Truncating dangling head", "indexed", common.StorageSize(contentExp), "stored", common.StorageSize(contentSize)) + log.Warn("Truncating dangling head", "indexed", common.StorageSize(contentExp), "stored", common.StorageSize(contentSize)) if err := truncateFreezerFile(t.head, contentExp); err != nil { return err } @@ -251,7 +249,7 @@ func (t *freezerTable) repair() error { } // Truncate the index to point within the head file if contentExp > contentSize { - t.logger.Warn("Truncating dangling indexes", "indexed", common.StorageSize(contentExp), "stored", common.StorageSize(contentSize)) + log.Warn("Truncating dangling indexes", "indexed", common.StorageSize(contentExp), "stored", common.StorageSize(contentSize)) if err := truncateFreezerFile(t.index, offsetsSize-indexEntrySize); err != nil { return err } @@ -293,7 +291,7 @@ func (t *freezerTable) repair() error { if err := t.preopen(); err != nil { return err } - t.logger.Debug("Chain freezer table opened", "items", t.items, "size", common.StorageSize(t.headBytes)) + log.Debug("Chain freezer table opened", "items", t.items, "size", common.StorageSize(t.headBytes)) return nil } @@ -326,11 +324,11 @@ func (t *freezerTable) truncate(items uint64) error { return nil } // Something's out of sync, truncate the table's offset index - log := t.logger.Debug + logger := log.Debug if existing > items+1 { - log = t.logger.Warn // Only loud warn if we delete multiple items + logger = log.Warn // Only loud warn if we delete multiple items } - log("Truncating freezer table", "items", existing, "limit", items) + logger("Truncating freezer table", "items", existing, "limit", items) if err := truncateFreezerFile(t.index, int64(items+1)*indexEntrySize); err != nil { return err } diff --git a/core/slice.go b/core/slice.go index 0a86c9ec28..1972708d17 100644 --- a/core/slice.go +++ b/core/slice.go @@ -118,7 +118,9 @@ func NewSlice(db ethdb.Database, config *Config, txConfig *TxPoolConfig, txLooku // only set the subClients if the chain is not Zone sl.subClients = make([]*quaiclient.Client, 3) if nodeCtx != common.ZONE_CTX { - sl.subClients = makeSubClients(subClientUrls) + go func() { + sl.subClients = makeSubClients(subClientUrls) + }() } // only set domClient if the chain is not Prime. @@ -1179,6 +1181,11 @@ func (sl *Slice) combinePendingHeader(header *types.Header, slPendingHeader *typ // NewGenesisPendingHeader creates a pending header on the genesis block func (sl *Slice) NewGenesisPendingHeader(domPendingHeader *types.Header) { nodeCtx := sl.NodeLocation().Context() + + if nodeCtx == common.PRIME_CTX { + time.Sleep(10 * time.Second) + } + genesisHash := sl.config.GenesisHash // Upate the local pending header localPendingHeader, err := sl.miner.worker.GeneratePendingHeader(sl.hc.GetBlockByHash(genesisHash), false) diff --git a/core/state/snapshot/conversion.go b/core/state/snapshot/conversion.go index 084c18bfe5..4d67924a8a 100644 --- a/core/state/snapshot/conversion.go +++ b/core/state/snapshot/conversion.go @@ -203,7 +203,7 @@ func (stat *generateStats) report() { }...) } } - log.Info("Iterating state snapshot", ctx...) + log.Info("Iterating state snapshot", ctx) } // reportDone prints the last log when the whole generation is finished. @@ -217,7 +217,7 @@ func (stat *generateStats) reportDone() { ctx = append(ctx, []interface{}{"slots", stat.slots}...) } ctx = append(ctx, []interface{}{"elapsed", common.PrettyDuration(time.Since(stat.start))}...) - log.Info("Iterated snapshot", ctx...) + log.Info("Iterated snapshot", ctx) } // runReport periodically prints the progress information. diff --git a/core/state/snapshot/generate.go b/core/state/snapshot/generate.go index 2a80b134df..2cf298e85e 100644 --- a/core/state/snapshot/generate.go +++ b/core/state/snapshot/generate.go @@ -106,7 +106,7 @@ func (gs *generatorStats) Log(msg string, root common.Hash, marker []byte) { }...) } } - log.Info(msg, ctx...) + log.Info(msg, ctx) } // generateSnapshot regenerates a brand new snapshot based on an existing state @@ -347,11 +347,10 @@ func (dl *diskLayer) generateRange(root common.Hash, prefix []byte, kind string, if len(origin) > 0 { logCtx = append(logCtx, "origin", hexutil.Encode(origin)) } - logger := log.Log // The range prover says the range is correct, skip trie iteration if result.valid() { - logger.Trace("Proved state range", "last", hexutil.Encode(last)) + log.Trace("Proved state range", "last", hexutil.Encode(last)) // The verification is passed, process each state with the given // callback function. If this state represents a contract, the @@ -362,7 +361,7 @@ func (dl *diskLayer) generateRange(root common.Hash, prefix []byte, kind string, // Only abort the iteration when both database and trie are exhausted return !result.diskMore && !result.trieMore, last, nil } - logger.Trace("Detected outdated state range", "last", hexutil.Encode(last), "err", result.proofErr) + log.Trace("Detected outdated state range", "last", hexutil.Encode(last), "err", result.proofErr) // We use the snap data to build up a cache which can be used by the // main account trie as a primary lookup when resolving hashes @@ -455,7 +454,7 @@ func (dl *diskLayer) generateRange(root common.Hash, prefix []byte, kind string, } internal += time.Since(istart) - logger.Debug("Regenerated state range", "root", root, "last", hexutil.Encode(last), + log.Debug("Regenerated state range", "root", root, "last", hexutil.Encode(last), "count", count, "created", created, "updated", updated, "untouched", untouched, "deleted", deleted) // If there are either more trie items, or there are more snap items diff --git a/consensus/types/types.go b/core/types/slice.go similarity index 71% rename from consensus/types/types.go rename to core/types/slice.go index aa126bcb22..5e94cb8f1a 100644 --- a/consensus/types/types.go +++ b/core/types/slice.go @@ -4,21 +4,22 @@ import ( "encoding/hex" "strconv" + "github.com/dominant-strategies/go-quai/common" "github.com/pkg/errors" ) // Hash represents a 256 bit hash type Hash [32]byte -func NewHashFromString(s string) (Hash, error) { +func NewHashFromString(s string) (common.Hash, error) { if len(s) != 64 { // 2 hex chars per byte - return Hash{}, errors.New("invalid string length for hash") + return common.Hash{}, errors.New("invalid string length for hash") } hashSlice, err := hex.DecodeString(s) if err != nil { - return Hash{}, err + return common.Hash{}, err } - var hash Hash + var hash common.Hash copy(hash[:], hashSlice) return hash, nil } @@ -34,6 +35,10 @@ var ( ZONE_CTX = Context{"zone", 2} ) +type Slice struct { + SliceID SliceID +} + type SliceID struct { Context Context Region uint32 diff --git a/eth/api_backend.go b/eth/api_backend.go index bcc11f7e80..f22c6b811f 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -21,8 +21,6 @@ import ( "errors" "math/big" - quai "github.com/dominant-strategies/go-quai" - "github.com/dominant-strategies/go-quai/common" "github.com/dominant-strategies/go-quai/consensus" "github.com/dominant-strategies/go-quai/core" @@ -31,7 +29,6 @@ import ( "github.com/dominant-strategies/go-quai/core/state" "github.com/dominant-strategies/go-quai/core/types" "github.com/dominant-strategies/go-quai/core/vm" - "github.com/dominant-strategies/go-quai/eth/downloader" "github.com/dominant-strategies/go-quai/eth/gasprice" "github.com/dominant-strategies/go-quai/ethdb" "github.com/dominant-strategies/go-quai/event" @@ -373,10 +370,6 @@ func (b *QuaiAPIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event. return b.eth.core.SubscribeNewTxsEvent(ch) } -func (b *QuaiAPIBackend) Downloader() *downloader.Downloader { - return b.eth.Downloader() -} - func (b *QuaiAPIBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error) { nodeCtx := b.eth.core.NodeCtx() if nodeCtx != common.ZONE_CTX { @@ -452,10 +445,6 @@ func (b *QuaiAPIBackend) StateAtTransaction(ctx context.Context, block *types.Bl return b.eth.core.StateAtTransaction(block, txIndex, reexec) } -func (b *QuaiAPIBackend) SyncProgress() quai.SyncProgress { - return b.eth.Downloader().Progress() -} - func (b *QuaiAPIBackend) Append(header *types.Header, manifest types.BlockManifest, domPendingHeader *types.Header, domTerminus common.Hash, domOrigin bool, newInboundEtxs types.Transactions) (types.Transactions, bool, bool, error) { return b.eth.core.Append(header, manifest, domPendingHeader, domTerminus, domOrigin, newInboundEtxs) } diff --git a/eth/backend.go b/eth/backend.go index 45b4e72072..1fb6d52589 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -14,14 +14,13 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . -// Package eth implements the Quai protocol. +// Package quai implements the Quai protocol. package eth import ( "fmt" "math/big" "sync" - "sync/atomic" "time" "github.com/dominant-strategies/go-quai/common" @@ -32,19 +31,14 @@ import ( "github.com/dominant-strategies/go-quai/core/state/pruner" "github.com/dominant-strategies/go-quai/core/types" "github.com/dominant-strategies/go-quai/core/vm" - "github.com/dominant-strategies/go-quai/eth/downloader" "github.com/dominant-strategies/go-quai/eth/ethconfig" "github.com/dominant-strategies/go-quai/eth/filters" "github.com/dominant-strategies/go-quai/eth/gasprice" - "github.com/dominant-strategies/go-quai/eth/protocols/eth" "github.com/dominant-strategies/go-quai/ethdb" "github.com/dominant-strategies/go-quai/event" "github.com/dominant-strategies/go-quai/internal/quaiapi" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/node" - "github.com/dominant-strategies/go-quai/p2p" - "github.com/dominant-strategies/go-quai/p2p/dnsdisc" - "github.com/dominant-strategies/go-quai/p2p/enode" "github.com/dominant-strategies/go-quai/params" "github.com/dominant-strategies/go-quai/rpc" ) @@ -58,10 +52,7 @@ type Quai struct { config *ethconfig.Config // Handlers - core *core.Core - handler *handler - ethDialCandidates enode.Iterator - snapDialCandidates enode.Iterator + core *core.Core // DB interfaces chainDb ethdb.Database // Block chain database @@ -78,11 +69,6 @@ type Quai struct { gasPrice *big.Int etherbase common.Address - networkID uint64 - netRPCService *quaiapi.PublicNetAPI - - p2pServer *p2p.Server - lock sync.RWMutex // Protects the variadic fields (e.g. gas price and etherbase) } @@ -90,9 +76,6 @@ type Quai struct { // initialisation of the common Quai object) func New(stack *node.Node, config *ethconfig.Config, nodeCtx int) (*Quai, error) { // Ensure configuration values are compatible and sane - if !config.SyncMode.IsValid() { - return nil, fmt.Errorf("invalid sync mode %d", config.SyncMode) - } if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(common.Big0) <= 0 { log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice) config.Miner.GasPrice = new(big.Int).Set(ethconfig.Defaults.Miner.GasPrice) @@ -118,32 +101,46 @@ func New(stack *node.Node, config *ethconfig.Config, nodeCtx int) (*Quai, error) return nil, genesisErr } + log.Warn("Memory location of chainConfig", "location", &chainConfig) + if err := pruner.RecoverPruning(stack.ResolvePath(""), chainDb, stack.ResolvePath(config.TrieCleanCacheJournal)); err != nil { log.Error("Failed to recover state", "error", err) } - eth := &Quai{ + quai := &Quai{ config: config, chainDb: chainDb, eventMux: stack.EventMux(), closeBloomHandler: make(chan struct{}), - networkID: config.NetworkId, gasPrice: config.Miner.GasPrice, etherbase: config.Miner.Etherbase, bloomRequests: make(chan chan *bloombits.Retrieval), - p2pServer: stack.Server(), } + // Copy the chainConfig + newChainConfig := params.ChainConfig{ + ChainID: chainConfig.ChainID, + ConsensusEngine: chainConfig.ConsensusEngine, + Blake3Pow: chainConfig.Blake3Pow, + Progpow: chainConfig.Progpow, + GenesisHash: chainConfig.GenesisHash, + Location: chainConfig.Location, + } + chainConfig = &newChainConfig + + log.Info("Chain Config", config.NodeLocation) + chainConfig.Location = config.NodeLocation // TODO: See why this is necessary + log.Info("Node", "Ctx", nodeCtx, "NodeLocation", config.NodeLocation, "genesis location", config.Genesis.Config.Location, "chain config", chainConfig.Location) if config.ConsensusEngine == "blake3" { blake3Config := config.Blake3Pow blake3Config.NotifyFull = config.Miner.NotifyFull - blake3Config.NodeLocation = chainConfig.Location - eth.engine = ethconfig.CreateBlake3ConsensusEngine(stack, chainConfig, &blake3Config, config.Miner.Notify, config.Miner.Noverify, chainDb) + blake3Config.NodeLocation = config.NodeLocation + quai.engine = ethconfig.CreateBlake3ConsensusEngine(stack, config.NodeLocation, &blake3Config, config.Miner.Notify, config.Miner.Noverify, chainDb) } else { // Transfer mining-related config to the progpow config. progpowConfig := config.Progpow - progpowConfig.NodeLocation = chainConfig.Location + progpowConfig.NodeLocation = config.NodeLocation progpowConfig.NotifyFull = config.Miner.NotifyFull - eth.engine = ethconfig.CreateProgpowConsensusEngine(stack, chainConfig, &progpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb) + quai.engine = ethconfig.CreateProgpowConsensusEngine(stack, config.NodeLocation, &progpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb) } log.Info("Initialised chain configuration", "config", chainConfig) @@ -185,57 +182,31 @@ func New(stack *node.Node, config *ethconfig.Config, nodeCtx int) (*Quai, error) config.TxPool.Journal = stack.ResolvePath(config.TxPool.Journal) } - eth.core, err = core.NewCore(chainDb, &config.Miner, eth.isLocalBlock, &config.TxPool, &config.TxLookupLimit, chainConfig, eth.config.SlicesRunning, eth.config.DomUrl, eth.config.SubUrls, eth.engine, cacheConfig, vmConfig, config.Genesis) + log.Info("Dom clietn", "url", quai.config.DomUrl) + quai.core, err = core.NewCore(chainDb, &config.Miner, quai.isLocalBlock, &config.TxPool, &config.TxLookupLimit, chainConfig, quai.config.SlicesRunning, quai.config.DomUrl, quai.config.SubUrls, quai.engine, cacheConfig, vmConfig, config.Genesis) if err != nil { return nil, err } // Only index bloom if processing state - if eth.core.ProcessingState() && nodeCtx == common.ZONE_CTX { - eth.bloomIndexer = core.NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms, chainConfig.Location.Context()) - eth.bloomIndexer.Start(eth.Core().Slice().HeaderChain()) + if quai.core.ProcessingState() && nodeCtx == common.ZONE_CTX { + quai.bloomIndexer = core.NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms, chainConfig.Location.Context()) + quai.bloomIndexer.Start(quai.Core().Slice().HeaderChain()) } - // Permit the downloader to use the trie cache allowance during fast sync - cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit - if eth.handler, err = newHandler(&handlerConfig{ - Database: chainDb, - Core: eth.core, - TxPool: eth.core.TxPool(), - Network: config.NetworkId, - Sync: config.SyncMode, - BloomCache: uint64(cacheLimit), - EventMux: eth.eventMux, - Whitelist: config.Whitelist, - SlicesRunning: config.SlicesRunning, - }); err != nil { - return nil, err - } - - eth.APIBackend = &QuaiAPIBackend{stack.Config().ExtRPCEnabled(), eth, nil} + quai.APIBackend = &QuaiAPIBackend{stack.Config().ExtRPCEnabled(), quai, nil} // Gasprice oracle is only initiated in zone chains - if nodeCtx == common.ZONE_CTX && eth.core.ProcessingState() { + if nodeCtx == common.ZONE_CTX && quai.core.ProcessingState() { gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice } - eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams) - } - - // Setup DNS discovery iterators. - dnsclient := dnsdisc.NewClient(dnsdisc.Config{}) - eth.ethDialCandidates, err = dnsclient.NewIterator(eth.config.EthDiscoveryURLs...) - if err != nil { - return nil, err + quai.APIBackend.gpo = gasprice.NewOracle(quai.APIBackend, gpoParams) } - // Start the RPC service - eth.netRPCService = quaiapi.NewPublicNetAPI(eth.p2pServer, config.NetworkId) - // Register the backend on the node - stack.RegisterAPIs(eth.APIs()) - stack.RegisterProtocols(eth.Protocols()) - stack.RegisterLifecycle(eth) + stack.RegisterAPIs(quai.APIs()) + stack.RegisterLifecycle(quai) // Check for unclean shutdown if uncleanShutdowns, discards, err := rawdb.PushUncleanShutdownMarker(chainDb); err != nil { log.Error("Could not update unclean-shutdown-marker list", "error", err) @@ -249,7 +220,7 @@ func New(stack *node.Node, config *ethconfig.Config, nodeCtx int) (*Quai, error) "age", common.PrettyAge(t)) } } - return eth, nil + return quai, nil } // APIs return the collection of RPC services the go-quai package offers. @@ -272,11 +243,6 @@ func (s *Quai) APIs() []rpc.API { Version: "1.0", Service: NewPublicMinerAPI(s), Public: true, - }, { - Namespace: "eth", - Version: "1.0", - Service: downloader.NewPublicDownloaderAPI(s.handler.downloader, s.eventMux), - Public: true, }, { Namespace: "miner", Version: "1.0", @@ -300,11 +266,6 @@ func (s *Quai) APIs() []rpc.API { Namespace: "debug", Version: "1.0", Service: NewPrivateDebugAPI(s), - }, { - Namespace: "net", - Version: "1.0", - Service: s.netRPCService, - Public: true, }, }...) } @@ -360,46 +321,29 @@ func (s *Quai) shouldPreserve(block *types.Block) bool { return s.isLocalBlock(block.Header()) } -func (s *Quai) Core() *core.Core { return s.core } -func (s *Quai) EventMux() *event.TypeMux { return s.eventMux } -func (s *Quai) Engine() consensus.Engine { return s.engine } -func (s *Quai) ChainDb() ethdb.Database { return s.chainDb } -func (s *Quai) IsListening() bool { return true } // Always listening -func (s *Quai) Downloader() *downloader.Downloader { return s.handler.downloader } -func (s *Quai) Synced() bool { return atomic.LoadUint32(&s.handler.acceptTxs) == 1 } -func (s *Quai) ArchiveMode() bool { return s.config.NoPruning } -func (s *Quai) BloomIndexer() *core.ChainIndexer { return s.bloomIndexer } - -// Protocols returns all the currently configured -// network protocols to start. -func (s *Quai) Protocols() []p2p.Protocol { - protos := eth.MakeProtocols((*ethHandler)(s.handler), s.networkID, s.ethDialCandidates) - return protos -} +func (s *Quai) Core() *core.Core { return s.core } +func (s *Quai) EventMux() *event.TypeMux { return s.eventMux } +func (s *Quai) Engine() consensus.Engine { return s.engine } +func (s *Quai) ChainDb() ethdb.Database { return s.chainDb } +func (s *Quai) IsListening() bool { return true } // Always listening +func (s *Quai) ArchiveMode() bool { return s.config.NoPruning } +func (s *Quai) BloomIndexer() *core.ChainIndexer { return s.bloomIndexer } // Start implements node.Lifecycle, starting all internal goroutines needed by the // Quai protocol implementation. func (s *Quai) Start() error { - eth.StartENRUpdater(s.core, s.p2pServer.LocalNode()) if s.core.ProcessingState() && s.core.NodeCtx() == common.ZONE_CTX { // Start the bloom bits servicing goroutines s.startBloomHandlers(params.BloomBitsBlocks) } - // Figure out a max peers count based on the server limits - maxPeers := s.p2pServer.MaxPeers - // Start the networking layer - s.handler.Start(maxPeers) return nil } // Stop implements node.Lifecycle, terminating all internal goroutines used by the // Quai protocol. func (s *Quai) Stop() error { - // Stop all the peer-related stuff first. - s.ethDialCandidates.Close() - s.handler.Stop() if s.core.ProcessingState() && s.core.NodeCtx() == common.ZONE_CTX { // Then stop everything else. diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 176bcd2899..fc7f95353d 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -26,7 +26,6 @@ import ( "github.com/dominant-strategies/go-quai/consensus/blake3pow" "github.com/dominant-strategies/go-quai/consensus/progpow" "github.com/dominant-strategies/go-quai/core" - "github.com/dominant-strategies/go-quai/eth/downloader" "github.com/dominant-strategies/go-quai/eth/gasprice" "github.com/dominant-strategies/go-quai/ethdb" "github.com/dominant-strategies/go-quai/log" @@ -34,6 +33,16 @@ import ( "github.com/dominant-strategies/go-quai/params" ) +type QuaistatsConfig struct { + URL string `toml:",omitempty"` +} + +type QuaiConfig struct { + Quai Config + Node node.Config + Ethstats QuaistatsConfig +} + // FullNodeGPO contains default gasprice oracle settings for full node. var FullNodeGPO = gasprice.Config{ Blocks: 20, @@ -56,7 +65,6 @@ var LightClientGPO = gasprice.Config{ // Defaults contains default settings for use on the Quai main net. var Defaults = Config{ - SyncMode: downloader.FullSync, Progpow: progpow.Config{}, NetworkId: 1, TxLookupLimit: 2350000, @@ -90,7 +98,6 @@ type Config struct { // Protocol options NetworkId uint64 // Network ID to use for selecting peers to connect to - SyncMode downloader.SyncMode // This can be set to list of enrtree:// URLs which will be queried for // for nodes to connect to. @@ -170,7 +177,7 @@ type Config struct { } // CreateProgpowConsensusEngine creates a progpow consensus engine for the given chain configuration. -func CreateProgpowConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, config *progpow.Config, notify []string, noverify bool, db ethdb.Database) consensus.Engine { +func CreateProgpowConsensusEngine(stack *node.Node, nodeLocation common.Location, config *progpow.Config, notify []string, noverify bool, db ethdb.Database) consensus.Engine { // Otherwise assume proof-of-work switch config.PowMode { case progpow.ModeFake: @@ -184,7 +191,7 @@ func CreateProgpowConsensusEngine(stack *node.Node, chainConfig *params.ChainCon PowMode: config.PowMode, NotifyFull: config.NotifyFull, DurationLimit: config.DurationLimit, - NodeLocation: chainConfig.Location, + NodeLocation: nodeLocation, GasCeil: config.GasCeil, MinDifficulty: config.MinDifficulty, }, notify, noverify) @@ -193,7 +200,7 @@ func CreateProgpowConsensusEngine(stack *node.Node, chainConfig *params.ChainCon } // CreateBlake3ConsensusEngine creates a progpow consensus engine for the given chain configuration. -func CreateBlake3ConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, config *blake3pow.Config, notify []string, noverify bool, db ethdb.Database) consensus.Engine { +func CreateBlake3ConsensusEngine(stack *node.Node, nodeLocation common.Location, config *blake3pow.Config, notify []string, noverify bool, db ethdb.Database) consensus.Engine { // Otherwise assume proof-of-work switch config.PowMode { case blake3pow.ModeFake: @@ -207,7 +214,7 @@ func CreateBlake3ConsensusEngine(stack *node.Node, chainConfig *params.ChainConf PowMode: config.PowMode, NotifyFull: config.NotifyFull, DurationLimit: config.DurationLimit, - NodeLocation: chainConfig.Location, + NodeLocation: nodeLocation, GasCeil: config.GasCeil, MinDifficulty: config.MinDifficulty, }, notify, noverify) diff --git a/eth/ethconfig/gen_config.go b/eth/ethconfig/gen_config.go index a1f2b62008..0f47affa63 100644 --- a/eth/ethconfig/gen_config.go +++ b/eth/ethconfig/gen_config.go @@ -8,7 +8,6 @@ import ( "github.com/dominant-strategies/go-quai/common" "github.com/dominant-strategies/go-quai/consensus/progpow" "github.com/dominant-strategies/go-quai/core" - "github.com/dominant-strategies/go-quai/eth/downloader" "github.com/dominant-strategies/go-quai/eth/gasprice" ) @@ -17,9 +16,6 @@ func (c Config) MarshalTOML() (interface{}, error) { type Config struct { Genesis *core.Genesis `toml:",omitempty"` NetworkId uint64 - SyncMode downloader.SyncMode - EthDiscoveryURLs []string - SnapDiscoveryURLs []string NoPruning bool NoPrefetch bool TxLookupLimit uint64 `toml:",omitempty"` @@ -47,9 +43,6 @@ func (c Config) MarshalTOML() (interface{}, error) { var enc Config enc.Genesis = c.Genesis enc.NetworkId = c.NetworkId - enc.SyncMode = c.SyncMode - enc.EthDiscoveryURLs = c.EthDiscoveryURLs - enc.SnapDiscoveryURLs = c.SnapDiscoveryURLs enc.NoPruning = c.NoPruning enc.NoPrefetch = c.NoPrefetch enc.TxLookupLimit = c.TxLookupLimit @@ -81,9 +74,6 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { type Config struct { Genesis *core.Genesis `toml:",omitempty"` NetworkId *uint64 - SyncMode *downloader.SyncMode - EthDiscoveryURLs []string - SnapDiscoveryURLs []string NoPruning *bool NoPrefetch *bool TxLookupLimit *uint64 `toml:",omitempty"` @@ -127,15 +117,6 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { if dec.NetworkId != nil { c.NetworkId = *dec.NetworkId } - if dec.SyncMode != nil { - c.SyncMode = *dec.SyncMode - } - if dec.EthDiscoveryURLs != nil { - c.EthDiscoveryURLs = dec.EthDiscoveryURLs - } - if dec.SnapDiscoveryURLs != nil { - c.SnapDiscoveryURLs = dec.SnapDiscoveryURLs - } if dec.NoPruning != nil { c.NoPruning = *dec.NoPruning } diff --git a/common/interface.go b/eth/interface.go similarity index 83% rename from common/interface.go rename to eth/interface.go index 10fc5587e5..b0d03ea084 100644 --- a/common/interface.go +++ b/eth/interface.go @@ -1,7 +1,8 @@ -package common +package eth import ( - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/common" + "github.com/dominant-strategies/go-quai/core/types" "github.com/libp2p/go-libp2p/core" ) @@ -23,7 +24,7 @@ type ConsensusAPI interface { // Asks the consensus backend to lookup a block by hash and sliceID. // If the block is found, it should be returned. Otherwise, nil should be returned. - LookupBlock(hash types.Hash, loc types.SliceID) *types.Block + LookupBlock(hash common.Hash, loc types.SliceID) *types.Block } // The networking backend will implement the following interface to enable consensus to communicate with other nodes. @@ -41,8 +42,8 @@ type NetworkingAPI interface { // Methods to lookup specific data from the network. Each request method // returns a result channel. If the result is found, it will be put into the // channel. If the result is not found, the channel will be closed. - RequestBlock(hash types.Hash, loc types.SliceID) chan *types.Block - RequestTransaction(hash types.Hash, loc types.SliceID) chan *types.Transaction + RequestBlock(hash common.Hash, loc types.SliceID) chan *types.Block + RequestTransaction(hash common.Hash, loc types.SliceID) chan *types.Transaction // Method to report a peer to the P2PClient as behaving maliciously ReportBadPeer(peer core.PeerID) diff --git a/consensus/quai/core.go b/eth/p2p_backend.go similarity index 85% rename from consensus/quai/core.go rename to eth/p2p_backend.go index dd6ff2a12c..a757ad58fc 100644 --- a/consensus/quai/core.go +++ b/eth/p2p_backend.go @@ -1,14 +1,14 @@ -package quai +package eth import ( "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/core/types" "github.com/dominant-strategies/go-quai/p2p" ) // QuaiBackend implements the quai consensus protocol type QuaiBackend struct { - p2p common.NetworkingAPI + p2p NetworkingAPI runningSlices map[types.SliceID]*types.Slice } @@ -19,7 +19,7 @@ func NewQuaiBackend() (*QuaiBackend, error) { } // Assign the p2p client interface to use for interacting with the p2p network -func (qbe *QuaiBackend) SetP2PNode(api common.NetworkingAPI) { +func (qbe *QuaiBackend) SetP2PNode(api NetworkingAPI) { qbe.p2p = api } @@ -59,6 +59,6 @@ func (qbe *QuaiBackend) SetRunningSlices(slices []types.Slice) { } } -func (qbe *QuaiBackend) LookupBlock(hash types.Hash, slice types.SliceID) *types.Block { +func (qbe *QuaiBackend) LookupBlock(hash common.Hash, slice types.SliceID) *types.Block { panic("todo") -} \ No newline at end of file +} diff --git a/ethdb/leveldb/leveldb.go b/ethdb/leveldb/leveldb.go index e96ee12a53..7cd14e33c2 100644 --- a/ethdb/leveldb/leveldb.go +++ b/ethdb/leveldb/leveldb.go @@ -95,7 +95,7 @@ func NewCustom(file string, namespace string, customize func(options *opt.Option if options.ReadOnly { logCtx = append(logCtx, "readonly", "true") } - log.Info("Allocated cache and file handles", logCtx...) + log.Info("Allocated cache and file handles") // Open the db and recover any potential corruptions db, err := leveldb.OpenFile(file, options) @@ -109,7 +109,6 @@ func NewCustom(file string, namespace string, customize func(options *opt.Option ldb := &Database{ fn: file, db: db, - log: log.Log, quitChan: make(chan chan error), } @@ -120,8 +119,7 @@ func NewCustom(file string, namespace string, customize func(options *opt.Option func configureOptions(customizeFn func(*opt.Options)) *opt.Options { // Set default options options := &opt.Options{ - Filter: filter.NewBloomFilter(10), - DisableSeeksCompaction: true, + Filter: filter.NewBloomFilter(10), } // Allow caller to make custom modifications to the options if customizeFn != nil { diff --git a/ethdb/pebble/pebble.go b/ethdb/pebble/pebble.go index 73ff5230ad..fe685c43ad 100644 --- a/ethdb/pebble/pebble.go +++ b/ethdb/pebble/pebble.go @@ -123,7 +123,6 @@ func New(file string, cache int, handles int, namespace string, readonly bool) ( } db := &Database{ fn: file, - log: log.Log, quitChan: make(chan chan error), } opt := &pebble.Options{ diff --git a/go.mod b/go.mod index 6865d933ca..57b4383128 100644 --- a/go.mod +++ b/go.mod @@ -3,24 +3,53 @@ module github.com/dominant-strategies/go-quai go 1.21.1 require ( + github.com/VictoriaMetrics/fastcache v1.12.2 github.com/adrg/xdg v0.4.0 + github.com/cockroachdb/pebble v1.0.0 + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc + github.com/deckarep/golang-set v1.8.0 + github.com/dgrijalva/jwt-go v3.2.0+incompatible + github.com/dominant-strategies/bn256 v0.0.0-20220930122411-fbf930a7493d + github.com/edsrzf/mmap-go v1.1.0 github.com/golang/mock v1.6.0 + github.com/golang/snappy v0.0.4 + github.com/gorilla/websocket v1.5.0 + github.com/hashicorp/golang-lru v0.5.4 + github.com/hnlq715/golang-lru v0.4.0 + github.com/holiman/bloomfilter/v2 v2.0.3 + github.com/holiman/uint256 v1.2.4 + github.com/ledgerwatch/secp256k1 v1.0.0 github.com/libp2p/go-libp2p-kad-dht v0.25.2 github.com/libp2p/go-libp2p-pubsub v0.10.0 github.com/multiformats/go-multiaddr v0.12.0 + github.com/olekukonko/tablewriter v0.0.5 + github.com/prometheus/tsdb v0.10.0 + github.com/rs/cors v1.10.1 + github.com/shirou/gopsutil v3.21.11+incompatible github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 + github.com/syndtr/goleveldb v1.0.0 + github.com/wk8/go-ordered-map/v2 v2.1.8 + golang.org/x/crypto v0.14.0 google.golang.org/protobuf v1.31.0 + lukechampine.com/blake3 v1.2.1 + modernc.org/mathutil v1.6.0 ) require ( + github.com/DataDog/zstd v1.4.5 // indirect github.com/Jorropo/jsync v1.0.1 // indirect + github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/buger/jsonparser v1.1.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cockroachdb/errors v1.8.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect + github.com/cockroachdb/redact v1.0.8 // indirect + github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -30,6 +59,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -37,10 +67,8 @@ require ( github.com/google/gopacket v1.1.19 // indirect github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect github.com/google/uuid v1.3.0 // indirect - github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/huin/goupnp v1.3.0 // indirect @@ -56,6 +84,8 @@ require ( github.com/klauspost/compress v1.17.2 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/koron/go-ssdp v0.0.4 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect @@ -69,8 +99,10 @@ require ( github.com/libp2p/go-reuseport v0.4.0 // indirect github.com/libp2p/go-yamux/v4 v4.0.1 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/miekg/dns v1.1.56 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect @@ -104,6 +136,7 @@ require ( github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -111,7 +144,10 @@ require ( github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect + github.com/tklauser/go-sysconf v0.3.13 // indirect + github.com/tklauser/numcpus v0.7.0 // indirect github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect @@ -121,7 +157,6 @@ require ( go.uber.org/mock v0.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect @@ -132,8 +167,6 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - lukechampine.com/blake3 v1.2.1 // indirect - modernc.org/mathutil v1.6.0 // indirect ) require ( @@ -144,5 +177,5 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.17.0 - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.15.0 ) diff --git a/go.sum b/go.sum index 1214072e5e..c0f7b9714e 100644 --- a/go.sum +++ b/go.sum @@ -43,24 +43,47 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= 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/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw= +github.com/CloudyKit/jet v2.1.3-0.20180809161101-62edd43e4f88+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= +github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= +github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/Joker/jade v1.0.1-0.20190614124447-d475f43051e7/go.mod h1:6E6s8o2AE4KhCrqr6GRJjdC/gNfTdxkIXvuGZZda2VM= github.com/Jorropo/jsync v1.0.1 h1:6HgRolFZnsdfzRUj+ImB9og1JYOxQoReSywkHOGSaUU= github.com/Jorropo/jsync v1.0.1/go.mod h1:jCOZj3vrBCri3bSU3ErUYvevKlnbssrXeCivybS5ABQ= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= +github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= +github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +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/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -71,30 +94,60 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4= +github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= +github.com/cockroachdb/errors v1.8.1 h1:A5+txlVZfOqFBDa4mGz2bUWSp0aHElvHX2bKkdbQu+Y= +github.com/cockroachdb/errors v1.8.1/go.mod h1:qGwQn6JmZ+oMjuLwjWzUNqblqk0xl4CVV3SQbGwK7Ac= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/cockroachdb/pebble v1.0.0 h1:WZWlV/s78glZbY2ylUITDOWSVBD3cLjcWPLRPFbHNYg= +github.com/cockroachdb/pebble v1.0.0/go.mod h1:bynZ3gvVyhlvjLI7PT6dmZ7g76xzJ7HpxfjgkzCGz6s= +github.com/cockroachdb/redact v1.0.8 h1:8QG/764wK+vmEYoOlfobpe12EQcS81ukx/a4hdVMxNw= +github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/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/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dominant-strategies/bn256 v0.0.0-20220930122411-fbf930a7493d h1:hkL13khTTS48QfWmjRFWpuzhOqu6S0cjpJOzPoBEDb4= +github.com/dominant-strategies/bn256 v0.0.0-20220930122411-fbf930a7493d/go.mod h1:nvtPJPChairu4o4iX2XGrstOFpLaAgNYhrUCl5bSng4= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/edsrzf/mmap-go v1.1.0 h1:6EUwBLQ/Mcr1EYLE4Tn1VdW1A4ckqCQWZBw8Hr0kjpQ= +github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= @@ -104,6 +157,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= @@ -112,30 +169,47 @@ github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiD github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= 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-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +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-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang/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= @@ -169,6 +243,11 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.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.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -215,6 +294,7 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -224,6 +304,7 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= @@ -232,10 +313,20 @@ github.com/hashicorp/golang-lru/v2 v2.0.5 h1:wW7h1TG88eUIJ2i69gaE3uNVtEPIagzhGvH github.com/hashicorp/golang-lru/v2 v2.0.5/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hnlq715/golang-lru v0.4.0 h1:gyo/wIvLE6Upf1wucAfwTjpR+BQ5Lli2766H2MnNPv0= +github.com/hnlq715/golang-lru v0.4.0/go.mod h1:RBkgDAtlu0SgTPvpb4VW2/RQnkCBMRD3Lr6B9RhsAS8= +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.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY= @@ -255,6 +346,10 @@ github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= github.com/ipld/go-ipld-prime v0.20.0 h1:Ud3VwE9ClxpO2LkCYP7vWPc0Fo+dYdYzgxUJZ3uRG4g= github.com/ipld/go-ipld-prime v0.20.0/go.mod h1:PzqZ/ZR981eKbgdr3y2DJYeD/8bgMawdGVlJDE8kK+M= +github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= +github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= +github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= +github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= @@ -263,21 +358,36 @@ github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPw github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= 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/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk= +github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U= +github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw= +github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0= 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/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -287,6 +397,10 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/ledgerwatch/secp256k1 v1.0.0 h1:Usvz87YoTG0uePIV8woOof5cQnLXGYa162rFf3YnwaQ= +github.com/ledgerwatch/secp256k1 v1.0.0/go.mod h1:SPmqJFciiF/Q0mPt2jVs2dTr/1TZBTIA+kPMmKgBAak= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= @@ -320,18 +434,31 @@ github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8S github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +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.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +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/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= +github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= @@ -345,10 +472,13 @@ github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8Rv github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 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/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= @@ -376,12 +506,27 @@ github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dy github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk= +github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= +github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= +github.com/nxadm/tail v1.4.4/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.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -392,8 +537,12 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -404,18 +553,26 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4= github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= +github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= @@ -429,16 +586,24 @@ github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtD github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= +github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= +github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= @@ -462,30 +627,41 @@ github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go. github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -501,20 +677,45 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= +github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= +github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= +github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= +github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= +github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -554,15 +755,19 @@ go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/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-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -612,10 +817,13 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -623,6 +831,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -633,6 +842,7 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -675,9 +885,13 @@ golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-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-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -685,9 +899,15 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-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-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/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-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -702,9 +922,11 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200806125547-5acd03effb82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/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= @@ -726,6 +948,10 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -745,11 +971,13 @@ golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/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-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -837,6 +1065,7 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -877,6 +1106,7 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -910,19 +1140,28 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 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.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/quaiapi/api.go b/internal/quaiapi/api.go index 80326138e6..c3a99e1300 100644 --- a/internal/quaiapi/api.go +++ b/internal/quaiapi/api.go @@ -37,7 +37,6 @@ import ( "github.com/dominant-strategies/go-quai/crypto" "github.com/dominant-strategies/go-quai/eth/abi" "github.com/dominant-strategies/go-quai/log" - "github.com/dominant-strategies/go-quai/p2p" "github.com/dominant-strategies/go-quai/params" "github.com/dominant-strategies/go-quai/rlp" "github.com/dominant-strategies/go-quai/rpc" @@ -109,30 +108,6 @@ func (s *PublicQuaiAPI_Deprecated) FeeHistory(ctx context.Context, blockCount rp return results, nil } -// Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not -// yet received the latest block headers from its pears. In case it is synchronizing: -// - startingBlock: block number this node started to synchronise from -// - currentBlock: block number this node is currently importing -// - highestBlock: block number of the highest block header this node has received from peers -// - pulledStates: number of state entries processed until now -// - knownStates: number of known state entries that still need to be pulled -func (s *PublicQuaiAPI_Deprecated) Syncing() (interface{}, error) { - progress := s.b.Downloader().Progress() - - // Return not syncing if the synchronisation already completed - if progress.CurrentBlock >= progress.HighestBlock { - return false, nil - } - // Otherwise gather the block sync stats - return map[string]interface{}{ - "startingBlock": hexutil.Uint64(progress.StartingBlock), - "currentBlock": hexutil.Uint64(progress.CurrentBlock), - "highestBlock": hexutil.Uint64(progress.HighestBlock), - "pulledStates": hexutil.Uint64(progress.PulledStates), - "knownStates": hexutil.Uint64(progress.KnownStates), - }, nil -} - // PublicTxPoolAPI offers and API for the transaction pool. It only operates on data that is non confidential. type PublicTxPoolAPI struct { b Backend @@ -1555,25 +1530,14 @@ func (api *PrivateDebugAPI) ChaindbCompact() error { // PublicNetAPI offers network related RPC methods type PublicNetAPI struct { - net *p2p.Server networkVersion uint64 } -// NewPublicNetAPI creates a new net API instance. -func NewPublicNetAPI(net *p2p.Server, networkVersion uint64) *PublicNetAPI { - return &PublicNetAPI{net, networkVersion} -} - // Listening returns an indication if the node is listening for network connections. func (s *PublicNetAPI) Listening() bool { return true // always listening } -// PeerCount returns the number of connected peers -func (s *PublicNetAPI) PeerCount() hexutil.Uint { - return hexutil.Uint(s.net.PeerCount()) -} - // Version returns the current Quai protocol version. func (s *PublicNetAPI) Version() string { return fmt.Sprintf("%d", s.networkVersion) diff --git a/internal/quaiapi/backend.go b/internal/quaiapi/backend.go index 07401ae19a..95f80db99c 100644 --- a/internal/quaiapi/backend.go +++ b/internal/quaiapi/backend.go @@ -21,7 +21,6 @@ import ( "context" "math/big" - quai "github.com/dominant-strategies/go-quai" "github.com/dominant-strategies/go-quai/common" "github.com/dominant-strategies/go-quai/consensus" "github.com/dominant-strategies/go-quai/core" @@ -29,7 +28,6 @@ import ( "github.com/dominant-strategies/go-quai/core/state" "github.com/dominant-strategies/go-quai/core/types" "github.com/dominant-strategies/go-quai/core/vm" - "github.com/dominant-strategies/go-quai/eth/downloader" "github.com/dominant-strategies/go-quai/ethdb" "github.com/dominant-strategies/go-quai/event" "github.com/dominant-strategies/go-quai/params" @@ -40,11 +38,9 @@ import ( // both full and light clients) with access to necessary functions. type Backend interface { // General Quai API - SyncProgress() quai.SyncProgress EventMux() *event.TypeMux // General Quai API - Downloader() *downloader.Downloader SuggestGasTipCap(ctx context.Context) (*big.Int, error) FeeHistory(ctx context.Context, blockCount int, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, error) ChainDb() ethdb.Database diff --git a/internal/quaiapi/quai_api.go b/internal/quaiapi/quai_api.go index e303dd96b1..cb8d82a6ad 100644 --- a/internal/quaiapi/quai_api.go +++ b/internal/quaiapi/quai_api.go @@ -92,30 +92,6 @@ func (s *PublicQuaiAPI) FeeHistory(ctx context.Context, blockCount rpc.DecimalOr return results, nil } -// Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not -// yet received the latest block headers from its pears. In case it is synchronizing: -// - startingBlock: block number this node started to synchronise from -// - currentBlock: block number this node is currently importing -// - highestBlock: block number of the highest block header this node has received from peers -// - pulledStates: number of state entries processed until now -// - knownStates: number of known state entries that still need to be pulled -func (s *PublicQuaiAPI) Syncing() (interface{}, error) { - progress := s.b.SyncProgress() - - // Return not syncing if the synchronisation already completed - if progress.CurrentBlock >= progress.HighestBlock { - return false, nil - } - // Otherwise gather the block sync stats - return map[string]interface{}{ - "startingBlock": hexutil.Uint64(progress.StartingBlock), - "currentBlock": hexutil.Uint64(progress.CurrentBlock), - "highestBlock": hexutil.Uint64(progress.HighestBlock), - "pulledStates": hexutil.Uint64(progress.PulledStates), - "knownStates": hexutil.Uint64(progress.KnownStates), - }, nil -} - // PublicBlockChainQuaiAPI provides an API to access the Quai blockchain. // It offers only methods that operate on public data that is freely available to anyone. type PublicBlockChainQuaiAPI struct { diff --git a/node/config.go b/node/config.go index db43f35c89..fa3bb1cf84 100644 --- a/node/config.go +++ b/node/config.go @@ -17,7 +17,6 @@ package node import ( - "crypto/ecdsa" "fmt" "os" "path/filepath" @@ -26,10 +25,7 @@ import ( "sync" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/crypto" - "github.com/dominant-strategies/go-quai/log" - "github.com/dominant-strategies/go-quai/p2p" - "github.com/dominant-strategies/go-quai/p2p/enode" + log "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/rpc" ) @@ -64,9 +60,6 @@ type Config struct { // in memory. DataDir string - // Configuration of peer-to-peer networking. - P2P p2p.Config - // KeyStoreDir is the file system folder that contains private keys. The directory can // be specified as a relative path, in which case it is resolved relative to the // current directory. @@ -274,88 +267,6 @@ func (c *Config) instanceDir() string { return filepath.Join(c.DataDir, c.name()) } -// NodeKey retrieves the currently configured private key of the node, checking -// first any manually set key, falling back to the one found in the configured -// data folder. If no key can be found, a new one is generated. -func (c *Config) NodeKey() *ecdsa.PrivateKey { - // Use any specifically configured key. - if c.P2P.PrivateKey != nil { - return c.P2P.PrivateKey - } - // Generate ephemeral key if no datadir is being used. - if c.DataDir == "" { - key, err := crypto.GenerateKey() - if err != nil { - log.Fatal(fmt.Sprintf("Failed to generate ephemeral node key: %v", err)) - } - return key - } - - keyfile := c.ResolvePath(datadirPrivateKey) - if key, err := crypto.LoadECDSA(keyfile); err == nil { - return key - } - // No persistent key found, generate and store a new one. - key, err := crypto.GenerateKey() - if err != nil { - log.Fatal(fmt.Sprintf("Failed to generate node key: %v", err)) - } - instanceDir := filepath.Join(c.DataDir, c.name()) - if err := os.MkdirAll(instanceDir, 0700); err != nil { - log.Error(fmt.Sprintf("Failed to persist node key: %v", err)) - return key - } - keyfile = filepath.Join(instanceDir, datadirPrivateKey) - if err := crypto.SaveECDSA(keyfile, key); err != nil { - log.Error(fmt.Sprintf("Failed to persist node key: %v", err)) - } - return key -} - -// StaticNodes returns a list of node enode URLs configured as static nodes. -func (c *Config) StaticNodes() []*enode.Node { - return c.parsePersistentNodes(&c.staticNodesWarning, c.ResolvePath(datadirStaticNodes)) -} - -// TrustedNodes returns a list of node enode URLs configured as trusted nodes. -func (c *Config) TrustedNodes() []*enode.Node { - return c.parsePersistentNodes(&c.trustedNodesWarning, c.ResolvePath(datadirTrustedNodes)) -} - -// parsePersistentNodes parses a list of discovery node URLs loaded from a .json -// file from within the data directory. -func (c *Config) parsePersistentNodes(w *bool, path string) []*enode.Node { - // Short circuit if no node config is present - if c.DataDir == "" { - return nil - } - if _, err := os.Stat(path); err != nil { - return nil - } - c.warnOnce(w, "Found deprecated node list file %s, please use the TOML config file instead.", path) - - // Load the nodes from the config file. - var nodelist []string - if err := common.LoadJSON(path, &nodelist); err != nil { - log.Error(fmt.Sprintf("Can't load node list file: %v", err)) - return nil - } - // Interpret the list as a discovery node array - var nodes []*enode.Node - for _, url := range nodelist { - if url == "" { - continue - } - node, err := enode.Parse(enode.ValidSchemes, url) - if err != nil { - log.Error(fmt.Sprintf("Node URL %s: %v\n", url, err)) - continue - } - nodes = append(nodes, node) - } - return nodes -} - var warnLock sync.Mutex func (c *Config) warnOnce(w *bool, format string, args ...interface{}) { @@ -365,10 +276,6 @@ func (c *Config) warnOnce(w *bool, format string, args ...interface{}) { if *w { return } - l := c.Logger - if l == nil { - l = &log.Log - } - l.Warn(fmt.Sprintf(format, args...)) + log.Warn(fmt.Sprintf(format, args...)) *w = true } diff --git a/node/defaults.go b/node/defaults.go index 17944cab0a..729e1c7542 100644 --- a/node/defaults.go +++ b/node/defaults.go @@ -22,7 +22,6 @@ import ( "path/filepath" "runtime" - "github.com/dominant-strategies/go-quai/p2p" "github.com/dominant-strategies/go-quai/rpc" ) @@ -42,11 +41,7 @@ var DefaultConfig = Config{ HTTPTimeouts: rpc.DefaultHTTPTimeouts, WSPort: DefaultWSPort, WSModules: []string{"net", "web3"}, - P2P: p2p.Config{ - ListenAddr: ":30303", - MaxPeers: 50, - }, - DBEngine: "", + DBEngine: "", } // DefaultDataDir is the default data directory to use for the databases and other diff --git a/node/node.go b/node/node.go index b82df9837e..5c51543426 100644 --- a/node/node.go +++ b/node/node.go @@ -30,7 +30,6 @@ import ( "github.com/dominant-strategies/go-quai/ethdb" "github.com/dominant-strategies/go-quai/event" "github.com/dominant-strategies/go-quai/log" - "github.com/dominant-strategies/go-quai/p2p" "github.com/dominant-strategies/go-quai/rpc" "github.com/prometheus/tsdb/fileutil" ) @@ -42,7 +41,6 @@ type Node struct { log log.Logger dirLock fileutil.Releaser // prevents concurrent use of instance directory stop chan struct{} // Channel to wait for termination notifications - server *p2p.Server // Currently running P2P networking layer startStopLock sync.Mutex // Start/Stop are protected by an additional lock state int // Tracks state of node lifecycle @@ -75,9 +73,6 @@ func New(conf *Config) (*Node, error) { } conf.DataDir = absdatadir } - if conf.Logger == nil { - conf.Logger = &log.Log - } // Ensure that the instance name doesn't cause weird conflicts with // other files in the data directory. @@ -92,34 +87,15 @@ func New(conf *Config) (*Node, error) { config: conf, inprocHandler: rpc.NewServer(), eventmux: new(event.TypeMux), - log: *conf.Logger, stop: make(chan struct{}), - server: &p2p.Server{Config: conf.P2P}, databases: make(map[*closeTrackingDB]struct{}), } - // Register built-in APIs. - node.rpcAPIs = append(node.rpcAPIs, node.apis()...) - // Acquire the instance directory lock. if err := node.openDataDir(); err != nil { return nil, err } - // Initialize the p2p server. This creates the node key and discovery databases. - node.server.Config.PrivateKey = node.config.NodeKey() - node.server.Config.Name = node.config.NodeName() - node.server.Config.Logger = &node.log - if node.server.Config.StaticNodes == nil { - node.server.Config.StaticNodes = node.config.StaticNodes() - } - if node.server.Config.TrustedNodes == nil { - node.server.Config.TrustedNodes = node.config.TrustedNodes() - } - if node.server.Config.NodeDatabase == "" { - node.server.Config.NodeDatabase = node.config.NodeDB() - } - // Check HTTP/WS prefixes are valid. if err := validatePrefix("HTTP", conf.HTTPPathPrefix); err != nil { return nil, err @@ -233,16 +209,10 @@ func (n *Node) doClose(errs []error) error { // openEndpoints starts all network and RPC endpoints. func (n *Node) openEndpoints() error { - // start networking endpoints - n.log.Info("Starting peer-to-peer node", "instance", n.server.Name) - if err := n.server.Start(); err != nil { - return convertFileLockError(err) - } // start RPC endpoints err := n.startRPC() if err != nil { n.stopRPC() - n.server.Stop() } return err } @@ -270,9 +240,6 @@ func (n *Node) stopServices(running []Lifecycle) error { } } - // Stop p2p networking. - n.server.Stop() - if len(failure.Services) > 0 { return failure } @@ -401,17 +368,6 @@ func (n *Node) RegisterLifecycle(lifecycle Lifecycle) { n.lifecycles = append(n.lifecycles, lifecycle) } -// RegisterProtocols adds backend's protocols to the node's p2p server. -func (n *Node) RegisterProtocols(protocols []p2p.Protocol) { - n.lock.Lock() - defer n.lock.Unlock() - - if n.state != initializingState { - panic("can't register protocols on running/stopped node") - } - n.server.Protocols = append(n.server.Protocols, protocols...) -} - // RegisterAPIs registers the APIs a service provides on the node. func (n *Node) RegisterAPIs(apis []rpc.API) { n.lock.Lock() @@ -460,16 +416,6 @@ func (n *Node) Config() *Config { return n.config } -// Server retrieves the currently running P2P network layer. This method is meant -// only to inspect fields of the currently running server. Callers should not -// start or stop the returned server. -func (n *Node) Server() *p2p.Server { - n.lock.Lock() - defer n.lock.Unlock() - - return n.server -} - // DataDir retrieves the current datadir used by the protocol stack. // Deprecated: No files should be stored in this directory, use InstanceDir instead. func (n *Node) DataDir() string { diff --git a/node/rpcstack.go b/node/rpcstack.go index a06d950e6d..a7cc958194 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -149,14 +149,14 @@ func (h *httpServer) start() error { if h.wsConfig.prefix != "" { url += h.wsConfig.prefix } - h.log.Info("WebSocket enabled", "url", url) + log.Info("WebSocket enabled", "url", url) } // if server is websocket only, return after logging if !h.rpcAllowed() { return nil } // Log http endpoint. - h.log.Info("HTTP server started", + log.Info("HTTP server started", "endpoint", listener.Addr(), "prefix", h.httpConfig.prefix, "cors", strings.Join(h.httpConfig.CorsAllowedOrigins, ","), diff --git a/p2p/node/api.go b/p2p/node/api.go index 2db54f48c0..3dd5157afe 100644 --- a/p2p/node/api.go +++ b/p2p/node/api.go @@ -8,12 +8,13 @@ import ( "github.com/spf13/viper" "github.com/dominant-strategies/go-quai/cmd/utils" - "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/core/types" + "github.com/dominant-strategies/go-quai/eth" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/p2p" quaiprotocol "github.com/dominant-strategies/go-quai/p2p/protocol" + "github.com/dominant-strategies/go-quai/common" pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" @@ -93,7 +94,7 @@ func (p *P2PNode) Stop() error { } } -func (p *P2PNode) SetConsensusBackend(be common.ConsensusAPI) { +func (p *P2PNode) SetConsensusBackend(be eth.ConsensusAPI) { p.consensus = be } @@ -106,7 +107,7 @@ func (p *P2PNode) BroadcastTransaction(tx types.Transaction) error { } // Request a block from the network for the specified slice -func (p *P2PNode) RequestBlock(hash types.Hash, slice types.SliceID) chan *types.Block { +func (p *P2PNode) RequestBlock(hash common.Hash, slice types.SliceID) chan *types.Block { resultChan := make(chan *types.Block, 1) go func() { defer close(resultChan) @@ -163,7 +164,7 @@ func (p *P2PNode) RequestBlock(hash types.Hash, slice types.SliceID) chan *types return resultChan } -func (p *P2PNode) RequestTransaction(hash types.Hash, loc types.SliceID) chan *types.Transaction { +func (p *P2PNode) RequestTransaction(hash common.Hash, loc types.SliceID) chan *types.Transaction { panic("todo") } @@ -212,7 +213,7 @@ func (p *P2PNode) StartGossipSub(ctx context.Context) error { // Search for a block in the node's cache, or query the consensus backend if it's not found in cache. // Returns nil if the block is not found. -func (p *P2PNode) GetBlock(hash types.Hash, slice types.SliceID) *types.Block { +func (p *P2PNode) GetBlock(hash common.Hash, slice types.SliceID) *types.Block { block, ok := p.blockCache.Get(hash) if ok { return block diff --git a/p2p/node/node.go b/p2p/node/node.go index e76c7a8cb7..e7aaac2338 100644 --- a/p2p/node/node.go +++ b/p2p/node/node.go @@ -21,7 +21,8 @@ import ( "github.com/dominant-strategies/go-quai/cmd/utils" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/core/types" + "github.com/dominant-strategies/go-quai/eth" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/p2p/protocol" "github.com/dominant-strategies/go-quai/p2p/pubsubManager" @@ -34,7 +35,7 @@ type P2PNode struct { host.Host // Backend for handling consensus data - consensus common.ConsensusAPI + consensus eth.ConsensusAPI // List of peers to introduce us to the network bootpeers []peer.AddrInfo @@ -53,9 +54,9 @@ type P2PNode struct { topics map[types.SliceID]map[string]*pubsub.Topic // cache of received blocks - blockCache *lru.Cache[types.Hash, *types.Block] + blockCache *lru.Cache[common.Hash, *types.Block] // cache of received transactions - txCache *lru.Cache[types.Hash, *types.Transaction] + txCache *lru.Cache[common.Hash, *types.Transaction] // runtime context ctx context.Context @@ -177,12 +178,12 @@ func NewNode(ctx context.Context) (*P2PNode, error) { // Create a new LRU cache for blocks and transactions const cacheSize = 10 - blockCache, err := lru.New[types.Hash, *types.Block](cacheSize) + blockCache, err := lru.New[common.Hash, *types.Block](cacheSize) if err != nil { return nil, err } - txCache, err := lru.New[types.Hash, *types.Transaction](cacheSize) + txCache, err := lru.New[common.Hash, *types.Transaction](cacheSize) if err != nil { return nil, err } diff --git a/p2p/node/p2p_services.go b/p2p/node/p2p_services.go index e1e7783084..02b8bd0e24 100644 --- a/p2p/node/p2p_services.go +++ b/p2p/node/p2p_services.go @@ -4,7 +4,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/core/types" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/p2p/pb" "github.com/dominant-strategies/go-quai/p2p/protocol" @@ -16,7 +16,7 @@ import ( // Opens a stream to the given peer and requests a block for the given hash and slice. // // If a block is not found, an error is returned -func (p *P2PNode) requestBlockFromPeer(hash types.Hash, slice types.SliceID, peerID peer.ID) (*types.Block, error) { +func (p *P2PNode) requestBlockFromPeer(hash common.Hash, slice types.SliceID, peerID peer.ID) (*types.Block, error) { // Open a stream to the peer using a specific protocol for block requests stream, err := p.NewStream(peerID, protocol.ProtocolVersion) if err != nil { diff --git a/p2p/node/pubsub_services.go b/p2p/node/pubsub_services.go index 6b123822ec..441d55a4d0 100644 --- a/p2p/node/pubsub_services.go +++ b/p2p/node/pubsub_services.go @@ -27,7 +27,7 @@ func (p *P2PNode) handleBlocksSubscription(sub *pubsub.Subscription) { } // store the block in the cache - evicted := p.blockCache.Add(block.Hash, block) + evicted := p.blockCache.Add(block.Hash(), block) if evicted { // TODO: handle eviction log.Warnf("block cache eviction occurred") diff --git a/p2p/pb/proto_services.go b/p2p/pb/proto_services.go index 8d9479e40b..0b0377beb7 100644 --- a/p2p/pb/proto_services.go +++ b/p2p/pb/proto_services.go @@ -3,7 +3,8 @@ package pb import ( "encoding/hex" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/common" + "github.com/dominant-strategies/go-quai/core/types" "github.com/gogo/protobuf/proto" ) @@ -27,7 +28,7 @@ func MarshalProtoMessage(pbMsg proto.Message) ([]byte, error) { // converts a custom go Block type (types.Block) to a protocol buffer Block type (pb.Block) func ConvertToProtoBlock(block types.Block) *Block { return &Block{ - Hash: hex.EncodeToString(block.Hash[:]), + Hash: hex.EncodeToString(block.Hash().Bytes()), // ... map other fields } @@ -35,11 +36,10 @@ func ConvertToProtoBlock(block types.Block) *Block { // converts a protocol buffer Block type (pb.Block) to a custom go Block type (types.Block) func ConvertFromProtoBlock(pbBlock *Block) types.Block { - var hash types.Hash + var hash common.Hash copy(hash[:], pbBlock.Hash) // ... map other fields return types.Block{ - Hash: hash, // ... map other fields } } @@ -70,21 +70,21 @@ func MarshalBlock(block *types.Block) ([]byte, error) { func convertToProtoSlice(slice types.SliceID) *SliceID { sliceContext := &Context{ Location: slice.Context.Location, - Level: slice.Context.Level, + Level: slice.Context.Level, } return &SliceID{ Context: sliceContext, Region: slice.Region, Zone: slice.Zone, } - + } // Converts a protocol buffer SliceID type (pb.SliceID) to a custom go SliceID type (types.SliceID) func ConvertFromProtoSlice(pbSlice *SliceID) types.SliceID { sliceContext := types.Context{ Location: pbSlice.Context.Location, - Level: pbSlice.Context.Level, + Level: pbSlice.Context.Level, } return types.SliceID{ Context: sliceContext, @@ -94,10 +94,10 @@ func ConvertFromProtoSlice(pbSlice *SliceID) types.SliceID { } // Creates a BlockRequest protocol buffer message -func CreateProtoBlockRequest(hash types.Hash, slice types.SliceID) *BlockRequest { +func CreateProtoBlockRequest(hash common.Hash, slice types.SliceID) *BlockRequest { pbSlice := convertToProtoSlice(slice) return &BlockRequest{ - Hash: hex.EncodeToString(hash[:]), + Hash: hex.EncodeToString(hash[:]), SliceId: pbSlice, } } diff --git a/p2p/protocol/handler.go b/p2p/protocol/handler.go index c2c5c1c5fc..bbcab98d79 100644 --- a/p2p/protocol/handler.go +++ b/p2p/protocol/handler.go @@ -2,7 +2,7 @@ package protocol import ( "github.com/dominant-strategies/go-quai/common" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/core/types" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/p2p/pb" "github.com/gogo/protobuf/proto" @@ -49,7 +49,7 @@ func QuaiProtocolHandler(stream network.Stream, node QuaiP2PNode) { // get the sliceID from the block request protoSlice := blockReq.SliceId slice := pb.ConvertFromProtoSlice(protoSlice) - + // check if we have the block in our cache block := node.GetBlock(hash, slice) if block == nil { diff --git a/p2p/protocol/interface.go b/p2p/protocol/interface.go index db84ad99fc..22cd75a896 100644 --- a/p2p/protocol/interface.go +++ b/p2p/protocol/interface.go @@ -3,7 +3,8 @@ package protocol import ( "github.com/libp2p/go-libp2p/core/peer" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/common" + "github.com/dominant-strategies/go-quai/core/types" "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/protocol" ) @@ -16,5 +17,5 @@ type QuaiP2PNode interface { Network() network.Network // Search for a block in the node's cache, or query the consensus backend if it's not found in cache. // Returns nil if the block is not found. - GetBlock(hash types.Hash, slice types.SliceID) *types.Block + GetBlock(hash common.Hash, slice types.SliceID) *types.Block } diff --git a/p2p/pubsubManager/gossipsub.go b/p2p/pubsubManager/gossipsub.go index 38b8e96734..8f5ada176c 100644 --- a/p2p/pubsubManager/gossipsub.go +++ b/p2p/pubsubManager/gossipsub.go @@ -3,7 +3,7 @@ package pubsubManager import ( "context" - "github.com/dominant-strategies/go-quai/consensus/types" + "github.com/dominant-strategies/go-quai/core/types" "github.com/dominant-strategies/go-quai/p2p/pb" pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/libp2p/go-libp2p/core/host" diff --git a/quaistats/quaistats.go b/quaistats/quaistats.go index b679e85103..308b18d2a7 100644 --- a/quaistats/quaistats.go +++ b/quaistats/quaistats.go @@ -48,12 +48,9 @@ import ( "github.com/dominant-strategies/go-quai/consensus" "github.com/dominant-strategies/go-quai/core" "github.com/dominant-strategies/go-quai/core/types" - "github.com/dominant-strategies/go-quai/eth/downloader" - ethproto "github.com/dominant-strategies/go-quai/eth/protocols/eth" "github.com/dominant-strategies/go-quai/event" "github.com/dominant-strategies/go-quai/log" "github.com/dominant-strategies/go-quai/node" - "github.com/dominant-strategies/go-quai/p2p" "github.com/dominant-strategies/go-quai/params" "github.com/dominant-strategies/go-quai/rpc" ) @@ -99,7 +96,6 @@ type backend interface { TotalLogS(header *types.Header) *big.Int HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) Stats() (pending int, queued int) - Downloader() *downloader.Downloader ChainConfig() *params.ChainConfig ProcessingState() bool NodeCtx() int @@ -118,7 +114,6 @@ type fullNodeBackend interface { // Service implements an Quai netstats reporting daemon that pushes local // chain statistics up to a monitoring server. type Service struct { - server *p2p.Server // Peer-to-peer server to retrieve networking infos backend backend engine consensus.Engine // Consensus engine to retrieve variadic block fields @@ -285,7 +280,6 @@ func New(node *node.Node, backend backend, engine consensus.Engine, url string, quaistats := &Service{ backend: backend, engine: engine, - server: node.Server(), node: parts[0], pass: parts[1], host: parts[2], @@ -876,17 +870,6 @@ type AuthResponse struct { func (s *Service) login2(url string) (string, error) { // Substitute with your actual service address and port - infos := s.server.NodeInfo() - - var protocols []string - for _, proto := range s.server.Protocols { - protocols = append(protocols, fmt.Sprintf("%s/%d", proto.Name, proto.Version)) - } - var network string - if info := infos.Protocols["eth"]; info != nil { - network = fmt.Sprintf("%d", info.(*ethproto.NodeInfo).Network) - } - var secretUser string if s.sendfullstats { secretUser = "admin" @@ -897,18 +880,14 @@ func (s *Service) login2(url string) (string, error) { auth := &authMsg{ ID: s.node, Info: nodeInfo{ - Name: s.node, - Node: infos.Name, - Port: infos.Ports.Listener, - Network: network, - Protocol: strings.Join(protocols, ", "), - API: "No", - Os: runtime.GOOS, - OsVer: runtime.GOARCH, - Client: "0.1.1", - History: true, - Chain: s.backend.NodeLocation().Name(), - ChainID: s.chainID.Uint64(), + Name: s.node, + API: "No", + Os: runtime.GOOS, + OsVer: runtime.GOARCH, + Client: "0.1.1", + History: true, + Chain: s.backend.NodeLocation().Name(), + ChainID: s.chainID.Uint64(), }, Secret: loginSecret{ Name: secretUser, diff --git a/rpc/handler.go b/rpc/handler.go index ab8508a60b..8e6bd0a27f 100644 --- a/rpc/handler.go +++ b/rpc/handler.go @@ -34,21 +34,20 @@ import ( // // The entry points for incoming messages are: // -// h.handleMsg(message) -// h.handleBatch(message) +// h.handleMsg(message) +// h.handleBatch(message) // // Outgoing calls use the requestOp struct. Register the request before sending it // on the connection: // -// op := &requestOp{ids: ...} -// h.addRequestOp(op) +// op := &requestOp{ids: ...} +// h.addRequestOp(op) // // Now send the request, then wait for the reply to be delivered through handleMsg: // -// if err := op.wait(...); err != nil { -// h.removeRequestOp(op) // timeout, etc. -// } -// +// if err := op.wait(...); err != nil { +// h.removeRequestOp(op) // timeout, etc. +// } type handler struct { reg *serviceRegistry unsubscribeCb *callback @@ -83,10 +82,6 @@ func newHandler(connCtx context.Context, conn jsonWriter, idgen func() ID, reg * cancelRoot: cancelRoot, allowSubscribe: true, serverSubs: make(map[ID]*Subscription), - log: log.Log, - } - if conn.remoteAddr() != "" { - h.log = log.New("conn: " + conn.remoteAddr()) } h.unsubscribeCb = newCallback(reflect.Value{}, reflect.ValueOf(h.unsubscribe)) return h @@ -303,9 +298,9 @@ func (h *handler) handleCallMsg(ctx *callProc, msg *jsonrpcMessage) *jsonrpcMess if resp.Error.Data != nil { ctx = append(ctx, "errdata", resp.Error.Data) } - log.Warn("Served "+msg.Method, ctx...) + log.Warn("Served " + msg.Method) } else { - log.Debug("Served "+msg.Method, ctx...) + log.Debug("Served " + msg.Method) } return resp case msg.hasValidID():