mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
internal/cli: added missing flags (#744)
* minor comment update * added support for rpc.evmtimeout flag * added support for vmdebug (EnablePreimageRecording) flag * added support for jsonrpc.auth.(jwtsecret, addr, port, vhosts) flags * added support for miner.recommit flag * added support for gpo.maxheaderhistory and gpo.maxblockhistory flag * Revert "added support for miner.recommit flag" This reverts commit fcb722e4bf5bdda23d4c91da40ab95c9023a80c3. * added pprof related flags (expect --pprof.cpuprofile - Write CPU profile to the given file) * added support for --dev.gaslimit flag * added support for --fdlimit flag * added support for --netrestrict flag * added support for --nodekey and --nodekeyhex flag * added support for --vmodule, --log.json, --log.backtrace, and --log.debug flags * fixed related lint errors * fix lints from develop (few lints decided to appear from code that was untouched, weird) * more weird lints from develop * small precautionary fix * small bug ;) fix in NetRestrict * weird lints * change vmdebug = true to vmdebug = false
This commit is contained in:
parent
71eadd09ca
commit
584856b52d
24 changed files with 768 additions and 35 deletions
|
|
@ -5,6 +5,7 @@ chain = "mainnet"
|
|||
# chain = "mumbai"
|
||||
# identity = "Annon-Identity"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "/var/lib/bor/keystore"
|
||||
|
|
@ -16,6 +17,12 @@ syncmode = "full"
|
|||
# devfakeauthor = false
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
# maxpeers = 1
|
||||
# nodiscover = true
|
||||
|
|
@ -23,6 +30,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# port = 30303
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
[p2p.discovery]
|
||||
# v5disc = false
|
||||
bootnodes = ["enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303", "enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303"]
|
||||
|
|
@ -65,6 +75,7 @@ syncmode = "full"
|
|||
# ipcdisable = false
|
||||
# ipcpath = ""
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
# [jsonrpc.http]
|
||||
|
|
@ -89,6 +100,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -97,6 +113,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -130,6 +148,7 @@ syncmode = "full"
|
|||
# txlookuplimit = 2350000
|
||||
# triesinmemory = 128
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
# allow-insecure-unlock = true
|
||||
|
|
@ -144,3 +163,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -892,6 +892,7 @@ func TestTransactionGapFilling(t *testing.T) {
|
|||
if queued != 1 {
|
||||
t.Fatalf("queued transactions mismatched: have %d, want %d", queued, 1)
|
||||
}
|
||||
|
||||
if err := validateEvents(events, 1); err != nil {
|
||||
t.Fatalf("original event firing failed: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
chain = "mainnet" # Name of the chain to sync ("mumbai", "mainnet") or path to a genesis file
|
||||
identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname)
|
||||
verbosity = 3 # Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (`log-level` was replaced by `verbosity`, and thus will be deprecated soon)
|
||||
vmdebug = false # Record information useful for VM and contract debugging
|
||||
datadir = "var/lib/bor" # Path of the data directory to store information
|
||||
ancient = "" # Data directory for ancient chain segments (default = inside chaindata)
|
||||
keystore = "" # Path of the directory where keystores are located
|
||||
|
|
@ -19,6 +20,12 @@ devfakeauthor = false # Run miner without validator set authorization [de
|
|||
"31000000" = "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e"
|
||||
"32000000" = "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68"
|
||||
|
||||
[log]
|
||||
vmodule = "" # Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
|
||||
json = false # Format logs with JSON
|
||||
backtrace = "" # Request a stack trace at a specific logging statement (e.g. "block.go:271")
|
||||
debug = true # Prepends log messages with call-site location (file and line number) - {requires some effort}
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50 # Maximum number of network peers (network disabled if set to 0)
|
||||
maxpendpeers = 50 # Maximum number of pending connection attempts
|
||||
|
|
@ -26,6 +33,9 @@ devfakeauthor = false # Run miner without validator set authorization [de
|
|||
port = 30303 # Network listening port
|
||||
nodiscover = false # Disables the peer discovery mechanism (manual peer addition)
|
||||
nat = "any" # NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)
|
||||
netrestrict = "" # Restricts network communication to the given IP networks (CIDR masks)
|
||||
nodekey = "" # P2P node key file
|
||||
nodekeyhex = "" # P2P node key as hex
|
||||
[p2p.discovery]
|
||||
v5disc = false # Enables the experimental RLPx V5 (Topic Discovery) mechanism
|
||||
bootnodes = [] # Comma separated enode URLs for P2P discovery bootstrap
|
||||
|
|
@ -65,6 +75,7 @@ devfakeauthor = false # Run miner without validator set authorization [de
|
|||
ipcdisable = false # Disable the IPC-RPC server
|
||||
ipcpath = "" # Filename for IPC socket/pipe within the datadir (explicit paths escape it)
|
||||
gascap = 50000000 # Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)
|
||||
evmtimeout = "5s" # Sets a timeout used for eth_call (0=infinite)
|
||||
txfeecap = 5.0 # Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)
|
||||
allow-unprotected-txs = false # Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC (default: false)
|
||||
[jsonrpc.http]
|
||||
|
|
@ -89,6 +100,11 @@ devfakeauthor = false # Run miner without validator set authorization [de
|
|||
host = "" #
|
||||
vhosts = ["localhost"] # Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.
|
||||
corsdomain = ["localhost"] # Comma separated list of domains from which to accept cross origin requests (browser enforced)
|
||||
[jsonrpc.auth]
|
||||
jwtsecret = "" # Path to a JWT secret to use for authenticated RPC endpoints
|
||||
addr = "localhost" # Listening address for authenticated APIs
|
||||
port = 8551 # Listening port for authenticated APIs
|
||||
vhosts = ["localhost"] # Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.
|
||||
[jsonrpc.timeouts]
|
||||
read = "30s"
|
||||
write = "30s"
|
||||
|
|
@ -97,6 +113,8 @@ devfakeauthor = false # Run miner without validator set authorization [de
|
|||
[gpo]
|
||||
blocks = 20 # Number of recent blocks to check for gas prices
|
||||
percentile = 60 # Suggested gas price is the given percentile of a set of recent transaction gas prices
|
||||
maxheaderhistory = 1024 # Maximum header history of gasprice oracle
|
||||
maxblockhistory = 1024 # Maximum block history of gasprice oracle
|
||||
maxprice = "5000000000000" # Maximum gas price will be recommended by gpo
|
||||
ignoreprice = "2" # Gas price below which gpo will ignore transactions (recommended for mainnet = 30000000000, default suitable for mumbai/devnet)
|
||||
|
||||
|
|
@ -134,6 +152,7 @@ devfakeauthor = false # Run miner without validator set authorization [de
|
|||
txlookuplimit = 2350000 # Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain)
|
||||
triesinmemory = 128 # Number of block states (tries) to keep in memory
|
||||
timeout = "1h0m0s" # Time after which the Merkle Patricia Trie is stored to disc from memory
|
||||
fdlimit = 0 # Raise the open file descriptor resource limit (default = system fd limit)
|
||||
|
||||
[accounts]
|
||||
unlock = [] # Comma separated list of accounts to unlock
|
||||
|
|
@ -148,3 +167,11 @@ devfakeauthor = false # Run miner without validator set authorization [de
|
|||
[developer]
|
||||
dev = false # Enable developer mode with ephemeral proof-of-authority network and a pre-funded developer account, mining enabled
|
||||
period = 0 # Block period to use in developer mode (0 = mine only if transaction pending)
|
||||
gaslimit = 11500000 # Initial block gas limit
|
||||
|
||||
[pprof]
|
||||
pprof = false # Enable the pprof HTTP server
|
||||
port = 6060 # pprof HTTP server listening port
|
||||
addr = "127.0.0.1" # pprof HTTP server listening interface
|
||||
memprofilerate = 524288 # Turn on memory profiling with the given rate
|
||||
blockprofilerate = 0 # Turn on block profiling with the given rate
|
||||
|
|
|
|||
|
|
@ -14,11 +14,13 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```datadir```: Path of the data directory to store information
|
||||
|
||||
- ```vmdebug```: Record information useful for VM and contract debugging (default: false)
|
||||
|
||||
- ```datadir.ancient```: Data directory for ancient chain segments (default = inside chaindata)
|
||||
|
||||
- ```keystore```: Path of the directory where keystores are located
|
||||
|
||||
- ```config```: File for the config file
|
||||
- ```config```: Path to the TOML configuration file
|
||||
|
||||
- ```syncmode```: Blockchain sync mode (only "full" sync supported) (default: full)
|
||||
|
||||
|
|
@ -48,6 +50,10 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```gpo.percentile```: Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60)
|
||||
|
||||
- ```gpo.maxheaderhistory```: Maximum header history of gasprice oracle (default: 1024)
|
||||
|
||||
- ```gpo.maxblockhistory```: Maximum block history of gasprice oracle (default: 1024)
|
||||
|
||||
- ```gpo.maxprice```: Maximum gas price will be recommended by gpo (default: 5000000000000)
|
||||
|
||||
- ```gpo.ignoreprice```: Gas price below which gpo will ignore transactions (default: 2)
|
||||
|
|
@ -60,6 +66,18 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```dev.period```: Block period to use in developer mode (0 = mine only if transaction pending) (default: 0)
|
||||
|
||||
- ```dev.gaslimit```: Initial block gas limit (default: 11500000)
|
||||
|
||||
- ```pprof```: Enable the pprof HTTP server (default: false)
|
||||
|
||||
- ```pprof.port```: pprof HTTP server listening port (default: 6060)
|
||||
|
||||
- ```pprof.addr```: pprof HTTP server listening interface (default: 127.0.0.1)
|
||||
|
||||
- ```pprof.memprofilerate```: Turn on memory profiling with the given rate (default: 524288)
|
||||
|
||||
- ```pprof.blockprofilerate```: Turn on block profiling with the given rate (default: 0)
|
||||
|
||||
### Account Management Options
|
||||
|
||||
- ```unlock```: Comma separated list of accounts to unlock
|
||||
|
|
@ -94,10 +112,14 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```txlookuplimit```: Number of recent blocks to maintain transactions index for (default: 2350000)
|
||||
|
||||
- ```fdlimit```: Raise the open file descriptor resource limit (default = system fd limit) (default: 0)
|
||||
|
||||
### JsonRPC Options
|
||||
|
||||
- ```rpc.gascap```: Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 50000000)
|
||||
|
||||
- ```rpc.evmtimeout```: Sets a timeout used for eth_call (0=infinite) (default: 5s)
|
||||
|
||||
- ```rpc.txfeecap```: Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 5)
|
||||
|
||||
- ```rpc.allow-unprotected-txs```: Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC (default: false)
|
||||
|
|
@ -106,6 +128,14 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```ipcpath```: Filename for IPC socket/pipe within the datadir (explicit paths escape it)
|
||||
|
||||
- ```authrpc.jwtsecret```: Path to a JWT secret to use for authenticated RPC endpoints
|
||||
|
||||
- ```authrpc.addr```: Listening address for authenticated APIs (default: localhost)
|
||||
|
||||
- ```authrpc.port```: Listening port for authenticated APIs (default: 8551)
|
||||
|
||||
- ```authrpc.vhosts```: Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: localhost)
|
||||
|
||||
- ```http.corsdomain```: Comma separated list of domains from which to accept cross origin requests (browser enforced) (default: localhost)
|
||||
|
||||
- ```http.vhosts```: Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: localhost)
|
||||
|
|
@ -138,6 +168,16 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```graphql```: Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. (default: false)
|
||||
|
||||
### Logging Options
|
||||
|
||||
- ```vmodule```: Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
|
||||
|
||||
- ```log.json```: Format logs with JSON (default: false)
|
||||
|
||||
- ```log.backtrace```: Request a stack trace at a specific logging statement (e.g. 'block.go:271')
|
||||
|
||||
- ```log.debug```: Prepends log messages with call-site location (file and line number) (default: false)
|
||||
|
||||
### P2P Options
|
||||
|
||||
- ```bind```: Network binding address (default: 0.0.0.0)
|
||||
|
|
@ -152,6 +192,12 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```nat```: NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: any)
|
||||
|
||||
- ```netrestrict```: Restricts network communication to the given IP networks (CIDR masks)
|
||||
|
||||
- ```nodekey```: P2P node key file
|
||||
|
||||
- ```nodekeyhex```: P2P node key as hex
|
||||
|
||||
- ```nodiscover```: Disables the peer discovery mechanism (manual peer addition) (default: false)
|
||||
|
||||
- ```v5disc```: Enables the experimental RLPx V5 (Topic Discovery) mechanism (default: false)
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ func (api *PublicFilterAPI) NewDeposits(ctx context.Context, crit ethereum.State
|
|||
stateSyncData := make(chan *types.StateSyncData, 10)
|
||||
stateSyncSub := api.events.SubscribeNewDeposits(stateSyncData)
|
||||
|
||||
// nolint: gosimple
|
||||
for {
|
||||
select {
|
||||
case h := <-stateSyncData:
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ func TestCommand_DebugBlock(t *testing.T) {
|
|||
// enable developer mode
|
||||
config.Developer.Enabled = true
|
||||
config.Developer.Period = 2 // block time
|
||||
config.Developer.GasLimit = 11500000 // initial block gaslimit
|
||||
|
||||
// enable archive mode for getting traces of ancient blocks
|
||||
config.GcMode = "archive"
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ func (c *DumpconfigCommand) Run(args []string) int {
|
|||
userConfig := command.GetConfig()
|
||||
|
||||
// convert the big.Int and time.Duration fields to their corresponding Raw fields
|
||||
userConfig.JsonRPC.RPCEVMTimeoutRaw = userConfig.JsonRPC.RPCEVMTimeout.String()
|
||||
userConfig.JsonRPC.HttpTimeout.ReadTimeoutRaw = userConfig.JsonRPC.HttpTimeout.ReadTimeout.String()
|
||||
userConfig.JsonRPC.HttpTimeout.WriteTimeoutRaw = userConfig.JsonRPC.HttpTimeout.WriteTimeout.String()
|
||||
userConfig.JsonRPC.HttpTimeout.IdleTimeoutRaw = userConfig.JsonRPC.HttpTimeout.IdleTimeout.String()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
// GetDeveloperChain returns the developer mode configs.
|
||||
func GetDeveloperChain(period uint64, faucet common.Address) *Chain {
|
||||
func GetDeveloperChain(period uint64, gasLimitt uint64, faucet common.Address) *Chain {
|
||||
// Override the default period to the user requested one
|
||||
config := *params.AllCliqueProtocolChanges
|
||||
config.Clique = ¶ms.CliqueConfig{
|
||||
|
|
@ -26,7 +26,7 @@ func GetDeveloperChain(period uint64, faucet common.Address) *Chain {
|
|||
Genesis: &core.Genesis{
|
||||
Config: &config,
|
||||
ExtraData: append(append(make([]byte, 32), faucet[:]...), make([]byte, crypto.SignatureLength)...),
|
||||
GasLimit: 11500000,
|
||||
GasLimit: gasLimitt,
|
||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||
Difficulty: big.NewInt(1),
|
||||
Alloc: map[common.Address]core.GenesisAccount{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
|
|
@ -24,6 +25,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/fdlimit"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/eth/downloader"
|
||||
"github.com/ethereum/go-ethereum/eth/ethconfig"
|
||||
"github.com/ethereum/go-ethereum/eth/gasprice"
|
||||
|
|
@ -33,6 +35,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/p2p"
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
|
@ -55,6 +58,9 @@ type Config struct {
|
|||
// LogLevel is the level of the logs to put out
|
||||
LogLevel string `hcl:"log-level,optional" toml:"log-level,optional"`
|
||||
|
||||
// Record information useful for VM and contract debugging
|
||||
EnablePreimageRecording bool `hcl:"vmdebug,optional" toml:"vmdebug,optional"`
|
||||
|
||||
// DataDir is the directory to store the state in
|
||||
DataDir string `hcl:"datadir,optional" toml:"datadir,optional"`
|
||||
|
||||
|
|
@ -79,6 +85,9 @@ type Config struct {
|
|||
// Ethstats is the address of the ethstats server to send telemetry
|
||||
Ethstats string `hcl:"ethstats,optional" toml:"ethstats,optional"`
|
||||
|
||||
// Logging has the logging related settings
|
||||
Logging *LoggingConfig `hcl:"log,block" toml:"log,block"`
|
||||
|
||||
// P2P has the p2p network related settings
|
||||
P2P *P2PConfig `hcl:"p2p,block" toml:"p2p,block"`
|
||||
|
||||
|
|
@ -114,6 +123,47 @@ type Config struct {
|
|||
|
||||
// Develop Fake Author mode to produce blocks without authorisation
|
||||
DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"`
|
||||
|
||||
// Pprof has the pprof related settings
|
||||
Pprof *PprofConfig `hcl:"pprof,block" toml:"pprof,block"`
|
||||
}
|
||||
|
||||
type LoggingConfig struct {
|
||||
// Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
|
||||
Vmodule string `hcl:"vmodule,optional" toml:"vmodule,optional"`
|
||||
|
||||
// Format logs with JSON
|
||||
Json bool `hcl:"json,optional" toml:"json,optional"`
|
||||
|
||||
// Request a stack trace at a specific logging statement (e.g. "block.go:271")
|
||||
Backtrace string `hcl:"backtrace,optional" toml:"backtrace,optional"`
|
||||
|
||||
// Prepends log messages with call-site location (file and line number)
|
||||
Debug bool `hcl:"debug,optional" toml:"debug,optional"`
|
||||
|
||||
// TODO - implement this
|
||||
// // Write execution trace to the given file
|
||||
// Trace string `hcl:"trace,optional" toml:"trace,optional"`
|
||||
}
|
||||
|
||||
type PprofConfig struct {
|
||||
// Enableed enable the pprof HTTP server
|
||||
Enabled bool `hcl:"pprof,optional" toml:"pprof,optional"`
|
||||
|
||||
// pprof HTTP server listening port
|
||||
Port int `hcl:"port,optional" toml:"port,optional"`
|
||||
|
||||
// pprof HTTP server listening interface
|
||||
Addr string `hcl:"addr,optional" toml:"addr,optional"`
|
||||
|
||||
// Turn on memory profiling with the given rate
|
||||
MemProfileRate int `hcl:"memprofilerate,optional" toml:"memprofilerate,optional"`
|
||||
|
||||
// Turn on block profiling with the given rate
|
||||
BlockProfileRate int `hcl:"blockprofilerate,optional" toml:"blockprofilerate,optional"`
|
||||
|
||||
// // Write CPU profile to the given file
|
||||
// CPUProfile string `hcl:"cpuprofile,optional" toml:"cpuprofile,optional"`
|
||||
}
|
||||
|
||||
type P2PConfig struct {
|
||||
|
|
@ -135,6 +185,17 @@ type P2PConfig struct {
|
|||
// NAT it used to set NAT options
|
||||
NAT string `hcl:"nat,optional" toml:"nat,optional"`
|
||||
|
||||
// Connectivity can be restricted to certain IP networks.
|
||||
// If this option is set to a non-nil value, only hosts which match one of the
|
||||
// IP networks contained in the list are considered.
|
||||
NetRestrict string `hcl:"netrestrict,optional" toml:"netrestrict,optional"`
|
||||
|
||||
// P2P node key file
|
||||
NodeKey string `hcl:"nodekey,optional" toml:"nodekey,optional"`
|
||||
|
||||
// P2P node key as hex
|
||||
NodeKeyHex string `hcl:"nodekeyhex,optional" toml:"nodekeyhex,optional"`
|
||||
|
||||
// Discovery has the p2p discovery related settings
|
||||
Discovery *P2PDiscovery `hcl:"discovery,block" toml:"discovery,block"`
|
||||
}
|
||||
|
|
@ -251,6 +312,10 @@ type JsonRPCConfig struct {
|
|||
// GasCap is the global gas cap for eth-call variants.
|
||||
GasCap uint64 `hcl:"gascap,optional" toml:"gascap,optional"`
|
||||
|
||||
// Sets a timeout used for eth_call (0=infinite)
|
||||
RPCEVMTimeout time.Duration `hcl:"-,optional" toml:"-"`
|
||||
RPCEVMTimeoutRaw string `hcl:"evmtimeout,optional" toml:"evmtimeout,optional"`
|
||||
|
||||
// TxFeeCap is the global transaction fee cap for send-transaction variants
|
||||
TxFeeCap float64 `hcl:"txfeecap,optional" toml:"txfeecap,optional"`
|
||||
|
||||
|
|
@ -263,11 +328,29 @@ type JsonRPCConfig struct {
|
|||
// Graphql has the json-rpc graphql related settings
|
||||
Graphql *APIConfig `hcl:"graphql,block" toml:"graphql,block"`
|
||||
|
||||
// AUTH RPC related settings
|
||||
Auth *AUTHConfig `hcl:"auth,block" toml:"auth,block"`
|
||||
|
||||
HttpTimeout *HttpTimeouts `hcl:"timeouts,block" toml:"timeouts,block"`
|
||||
|
||||
AllowUnprotectedTxs bool `hcl:"allow-unprotected-txs,optional" toml:"allow-unprotected-txs,optional"`
|
||||
}
|
||||
|
||||
type AUTHConfig struct {
|
||||
// JWTSecret is the hex-encoded jwt secret.
|
||||
JWTSecret string `hcl:"jwtsecret,optional" toml:"jwtsecret,optional"`
|
||||
|
||||
// Addr is the listening address on which authenticated APIs are provided.
|
||||
Addr string `hcl:"addr,optional" toml:"addr,optional"`
|
||||
|
||||
// Port is the port number on which authenticated APIs are provided.
|
||||
Port uint64 `hcl:"port,optional" toml:"port,optional"`
|
||||
|
||||
// VHosts is the list of virtual hostnames which are allowed on incoming requests
|
||||
// for the authenticated api. This is by default {'localhost'}.
|
||||
VHosts []string `hcl:"vhosts,optional" toml:"vhosts,optional"`
|
||||
}
|
||||
|
||||
type GRPCConfig struct {
|
||||
// Addr is the bind address for the grpc rpc server
|
||||
Addr string `hcl:"addr,optional" toml:"addr,optional"`
|
||||
|
|
@ -333,6 +416,12 @@ type GpoConfig struct {
|
|||
// Percentile sets the weights to new blocks
|
||||
Percentile uint64 `hcl:"percentile,optional" toml:"percentile,optional"`
|
||||
|
||||
// Maximum header history of gasprice oracle
|
||||
MaxHeaderHistory int `hcl:"maxheaderhistory,optional" toml:"maxheaderhistory,optional"`
|
||||
|
||||
// Maximum block history of gasprice oracle
|
||||
MaxBlockHistory int `hcl:"maxblockhistory,optional" toml:"maxblockhistory,optional"`
|
||||
|
||||
// MaxPrice is an upper bound gas price
|
||||
MaxPrice *big.Int `hcl:"-,optional" toml:"-"`
|
||||
MaxPriceRaw string `hcl:"maxprice,optional" toml:"maxprice,optional"`
|
||||
|
|
@ -428,6 +517,9 @@ type CacheConfig struct {
|
|||
// Time after which the Merkle Patricia Trie is stored to disc from memory
|
||||
TrieTimeout time.Duration `hcl:"-,optional" toml:"-"`
|
||||
TrieTimeoutRaw string `hcl:"timeout,optional" toml:"timeout,optional"`
|
||||
|
||||
// Raise the open file descriptor resource limit (default = system fd limit)
|
||||
FDLimit int `hcl:"fdlimit,optional" toml:"fdlimit,optional"`
|
||||
}
|
||||
|
||||
type AccountsConfig struct {
|
||||
|
|
@ -453,6 +545,9 @@ type DeveloperConfig struct {
|
|||
|
||||
// Period is the block period to use in developer mode
|
||||
Period uint64 `hcl:"period,optional" toml:"period,optional"`
|
||||
|
||||
// Initial block gas limit
|
||||
GasLimit uint64 `hcl:"gaslimit,optional" toml:"gaslimit,optional"`
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
|
|
@ -462,8 +557,15 @@ func DefaultConfig() *Config {
|
|||
RequiredBlocks: map[string]string{},
|
||||
Verbosity: 3,
|
||||
LogLevel: "",
|
||||
EnablePreimageRecording: false,
|
||||
DataDir: DefaultDataDir(),
|
||||
Ancient: "",
|
||||
Logging: &LoggingConfig{
|
||||
Vmodule: "",
|
||||
Json: false,
|
||||
Backtrace: "",
|
||||
Debug: false,
|
||||
},
|
||||
P2P: &P2PConfig{
|
||||
MaxPeers: 50,
|
||||
MaxPendPeers: 50,
|
||||
|
|
@ -471,6 +573,7 @@ func DefaultConfig() *Config {
|
|||
Port: 30303,
|
||||
NoDiscover: false,
|
||||
NAT: "any",
|
||||
NetRestrict: "",
|
||||
Discovery: &P2PDiscovery{
|
||||
V5Enabled: false,
|
||||
Bootnodes: []string{},
|
||||
|
|
@ -514,6 +617,8 @@ func DefaultConfig() *Config {
|
|||
Gpo: &GpoConfig{
|
||||
Blocks: 20,
|
||||
Percentile: 60,
|
||||
MaxHeaderHistory: 1024,
|
||||
MaxBlockHistory: 1024,
|
||||
MaxPrice: gasprice.DefaultMaxPrice,
|
||||
IgnorePrice: gasprice.DefaultIgnorePrice,
|
||||
},
|
||||
|
|
@ -522,6 +627,7 @@ func DefaultConfig() *Config {
|
|||
IPCPath: "",
|
||||
GasCap: ethconfig.Defaults.RPCGasCap,
|
||||
TxFeeCap: ethconfig.Defaults.RPCTxFeeCap,
|
||||
RPCEVMTimeout: ethconfig.Defaults.RPCEVMTimeout,
|
||||
AllowUnprotectedTxs: false,
|
||||
Http: &APIConfig{
|
||||
Enabled: false,
|
||||
|
|
@ -550,6 +656,12 @@ func DefaultConfig() *Config {
|
|||
WriteTimeout: 30 * time.Second,
|
||||
IdleTimeout: 120 * time.Second,
|
||||
},
|
||||
Auth: &AUTHConfig{
|
||||
JWTSecret: "",
|
||||
Port: node.DefaultAuthPort,
|
||||
Addr: node.DefaultAuthHost,
|
||||
VHosts: node.DefaultAuthVhosts,
|
||||
},
|
||||
},
|
||||
Ethstats: "",
|
||||
Telemetry: &TelemetryConfig{
|
||||
|
|
@ -583,6 +695,7 @@ func DefaultConfig() *Config {
|
|||
TxLookupLimit: 2350000,
|
||||
TriesInMemory: 128,
|
||||
TrieTimeout: 60 * time.Minute,
|
||||
FDLimit: 0,
|
||||
},
|
||||
Accounts: &AccountsConfig{
|
||||
Unlock: []string{},
|
||||
|
|
@ -597,8 +710,17 @@ func DefaultConfig() *Config {
|
|||
Developer: &DeveloperConfig{
|
||||
Enabled: false,
|
||||
Period: 0,
|
||||
GasLimit: 11500000,
|
||||
},
|
||||
DevFakeAuthor: false,
|
||||
Pprof: &PprofConfig{
|
||||
Enabled: false,
|
||||
Port: 6060,
|
||||
Addr: "127.0.0.1",
|
||||
MemProfileRate: 512 * 1024,
|
||||
BlockProfileRate: 0,
|
||||
// CPUProfile: "",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -643,6 +765,7 @@ func (c *Config) fillTimeDurations() error {
|
|||
td *time.Duration
|
||||
str *string
|
||||
}{
|
||||
{"jsonrpc.evmtimeout", &c.JsonRPC.RPCEVMTimeout, &c.JsonRPC.RPCEVMTimeoutRaw},
|
||||
{"miner.recommit", &c.Sealer.Recommit, &c.Sealer.RecommitRaw},
|
||||
{"jsonrpc.timeouts.read", &c.JsonRPC.HttpTimeout.ReadTimeout, &c.JsonRPC.HttpTimeout.ReadTimeoutRaw},
|
||||
{"jsonrpc.timeouts.write", &c.JsonRPC.HttpTimeout.WriteTimeout, &c.JsonRPC.HttpTimeout.WriteTimeoutRaw},
|
||||
|
|
@ -713,7 +836,7 @@ func (c *Config) loadChain() error {
|
|||
|
||||
//nolint:gocognit
|
||||
func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*ethconfig.Config, error) {
|
||||
dbHandles, err := MakeDatabaseHandles()
|
||||
dbHandles, err := MakeDatabaseHandles(c.Cache.FDLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -744,10 +867,14 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
{
|
||||
n.GPO.Blocks = int(c.Gpo.Blocks)
|
||||
n.GPO.Percentile = int(c.Gpo.Percentile)
|
||||
n.GPO.MaxHeaderHistory = c.Gpo.MaxHeaderHistory
|
||||
n.GPO.MaxBlockHistory = c.Gpo.MaxBlockHistory
|
||||
n.GPO.MaxPrice = c.Gpo.MaxPrice
|
||||
n.GPO.IgnorePrice = c.Gpo.IgnorePrice
|
||||
}
|
||||
|
||||
n.EnablePreimageRecording = c.EnablePreimageRecording
|
||||
|
||||
// txpool options
|
||||
{
|
||||
n.TxPool.NoLocals = c.TxPool.NoLocals
|
||||
|
|
@ -838,7 +965,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
n.Miner.Etherbase = developer.Address
|
||||
|
||||
// get developer mode chain config
|
||||
c.chain = chains.GetDeveloperChain(c.Developer.Period, developer.Address)
|
||||
c.chain = chains.GetDeveloperChain(c.Developer.Period, c.Developer.GasLimit, developer.Address)
|
||||
|
||||
// update the parameters
|
||||
n.NetworkId = c.chain.NetworkId
|
||||
|
|
@ -927,6 +1054,8 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
log.Info("Global gas cap disabled")
|
||||
}
|
||||
|
||||
n.RPCEVMTimeout = c.JsonRPC.RPCEVMTimeout
|
||||
|
||||
n.RPCTxFeeCap = c.JsonRPC.TxFeeCap
|
||||
|
||||
// sync mode. It can either be "fast", "full" or "snap". We disable
|
||||
|
|
@ -1053,6 +1182,35 @@ func ambiguousAddrRecovery(ks *keystore.KeyStore, err *keystore.AmbiguousAddrErr
|
|||
return *match
|
||||
}
|
||||
|
||||
// setNodeKey creates a node key from set command line flags, either loading it
|
||||
// from a file or as a specified hex value. If neither flags were provided, this
|
||||
// method returns nil and an emphemeral key is to be generated.
|
||||
func getNodeKey(hex string, file string) *ecdsa.PrivateKey {
|
||||
var (
|
||||
key *ecdsa.PrivateKey
|
||||
err error
|
||||
)
|
||||
|
||||
switch {
|
||||
case file != "" && hex != "":
|
||||
utils.Fatalf("Options %q and %q are mutually exclusive", file, hex)
|
||||
case file != "":
|
||||
if key, err = crypto.LoadECDSA(file); err != nil {
|
||||
utils.Fatalf("Option %q: %v", file, err)
|
||||
}
|
||||
|
||||
return key
|
||||
case hex != "":
|
||||
if key, err = crypto.HexToECDSA(hex); err != nil {
|
||||
utils.Fatalf("Option %q: %v", hex, err)
|
||||
}
|
||||
|
||||
return key
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Config) buildNode() (*node.Config, error) {
|
||||
ipcPath := ""
|
||||
if !c.JsonRPC.IPCDisable {
|
||||
|
|
@ -1091,6 +1249,24 @@ func (c *Config) buildNode() (*node.Config, error) {
|
|||
WriteTimeout: c.JsonRPC.HttpTimeout.WriteTimeout,
|
||||
IdleTimeout: c.JsonRPC.HttpTimeout.IdleTimeout,
|
||||
},
|
||||
JWTSecret: c.JsonRPC.Auth.JWTSecret,
|
||||
AuthPort: int(c.JsonRPC.Auth.Port),
|
||||
AuthAddr: c.JsonRPC.Auth.Addr,
|
||||
AuthVirtualHosts: c.JsonRPC.Auth.VHosts,
|
||||
}
|
||||
|
||||
if c.P2P.NetRestrict != "" {
|
||||
list, err := netutil.ParseNetlist(c.P2P.NetRestrict)
|
||||
if err != nil {
|
||||
utils.Fatalf("Option %q: %v", c.P2P.NetRestrict, err)
|
||||
}
|
||||
|
||||
cfg.P2P.NetRestrict = list
|
||||
}
|
||||
|
||||
key := getNodeKey(c.P2P.NodeKeyHex, c.P2P.NodeKey)
|
||||
if key != nil {
|
||||
cfg.P2P.PrivateKey = key
|
||||
}
|
||||
|
||||
// dev mode
|
||||
|
|
@ -1180,18 +1356,32 @@ func (c *Config) Merge(cc ...*Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func MakeDatabaseHandles() (int, error) {
|
||||
func MakeDatabaseHandles(max int) (int, error) {
|
||||
limit, err := fdlimit.Maximum()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
switch {
|
||||
case max == 0:
|
||||
// User didn't specify a meaningful value, use system limits
|
||||
case max < 128:
|
||||
// User specified something unhealthy, just use system defaults
|
||||
log.Error("File descriptor limit invalid (<128)", "had", max, "updated", limit)
|
||||
case max > limit:
|
||||
// User requested more than the OS allows, notify that we can't allocate it
|
||||
log.Warn("Requested file descriptors denied by OS", "req", max, "limit", limit)
|
||||
default:
|
||||
// User limit is meaningful and within allowed range, use that
|
||||
limit = max
|
||||
}
|
||||
|
||||
raised, err := fdlimit.Raise(uint64(limit))
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return int(raised / 2), nil
|
||||
return int(raised / 2), nil // Leave half for networking and other stuff
|
||||
}
|
||||
|
||||
func parseBootnodes(urls []string) ([]*enode.Node, error) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,12 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.DataDir,
|
||||
HideDefaultFromDoc: true,
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "vmdebug",
|
||||
Usage: "Record information useful for VM and contract debugging",
|
||||
Value: &c.cliConfig.EnablePreimageRecording,
|
||||
Default: c.cliConfig.EnablePreimageRecording,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "datadir.ancient",
|
||||
Usage: "Data directory for ancient chain segments (default = inside chaindata)",
|
||||
|
|
@ -54,7 +60,7 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "config",
|
||||
Usage: "File for the config file",
|
||||
Usage: "Path to the TOML configuration file",
|
||||
Value: &c.configFile,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
|
|
@ -88,6 +94,36 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.BorLogs,
|
||||
})
|
||||
|
||||
// logging related flags (log-level and verbosity is present above, it will be removed soon)
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "vmodule",
|
||||
Usage: "Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)",
|
||||
Value: &c.cliConfig.Logging.Vmodule,
|
||||
Default: c.cliConfig.Logging.Vmodule,
|
||||
Group: "Logging",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "log.json",
|
||||
Usage: "Format logs with JSON",
|
||||
Value: &c.cliConfig.Logging.Json,
|
||||
Default: c.cliConfig.Logging.Json,
|
||||
Group: "Logging",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "log.backtrace",
|
||||
Usage: "Request a stack trace at a specific logging statement (e.g. 'block.go:271')",
|
||||
Value: &c.cliConfig.Logging.Backtrace,
|
||||
Default: c.cliConfig.Logging.Backtrace,
|
||||
Group: "Logging",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "log.debug",
|
||||
Usage: "Prepends log messages with call-site location (file and line number)",
|
||||
Value: &c.cliConfig.Logging.Debug,
|
||||
Default: c.cliConfig.Logging.Debug,
|
||||
Group: "Logging",
|
||||
})
|
||||
|
||||
// heimdall
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "bor.heimdall",
|
||||
|
|
@ -276,6 +312,18 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.Gpo.Percentile,
|
||||
Default: c.cliConfig.Gpo.Percentile,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "gpo.maxheaderhistory",
|
||||
Usage: "Maximum header history of gasprice oracle",
|
||||
Value: &c.cliConfig.Gpo.MaxHeaderHistory,
|
||||
Default: c.cliConfig.Gpo.MaxHeaderHistory,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "gpo.maxblockhistory",
|
||||
Usage: "Maximum block history of gasprice oracle",
|
||||
Value: &c.cliConfig.Gpo.MaxBlockHistory,
|
||||
Default: c.cliConfig.Gpo.MaxBlockHistory,
|
||||
})
|
||||
f.BigIntFlag(&flagset.BigIntFlag{
|
||||
Name: "gpo.maxprice",
|
||||
Usage: "Maximum gas price will be recommended by gpo",
|
||||
|
|
@ -367,6 +415,13 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.Cache.TxLookupLimit,
|
||||
Group: "Cache",
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "fdlimit",
|
||||
Usage: "Raise the open file descriptor resource limit (default = system fd limit)",
|
||||
Value: &c.cliConfig.Cache.FDLimit,
|
||||
Default: c.cliConfig.Cache.FDLimit,
|
||||
Group: "Cache",
|
||||
})
|
||||
|
||||
// rpc options
|
||||
f.Uint64Flag(&flagset.Uint64Flag{
|
||||
|
|
@ -376,6 +431,13 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.JsonRPC.GasCap,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.DurationFlag(&flagset.DurationFlag{
|
||||
Name: "rpc.evmtimeout",
|
||||
Usage: "Sets a timeout used for eth_call (0=infinite)",
|
||||
Value: &c.cliConfig.JsonRPC.RPCEVMTimeout,
|
||||
Default: c.cliConfig.JsonRPC.RPCEVMTimeout,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.Float64Flag(&flagset.Float64Flag{
|
||||
Name: "rpc.txfeecap",
|
||||
Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
|
||||
|
|
@ -404,6 +466,34 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.JsonRPC.IPCPath,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "authrpc.jwtsecret",
|
||||
Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.JWTSecret,
|
||||
Default: c.cliConfig.JsonRPC.Auth.JWTSecret,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "authrpc.addr",
|
||||
Usage: "Listening address for authenticated APIs",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.Addr,
|
||||
Default: c.cliConfig.JsonRPC.Auth.Addr,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.Uint64Flag(&flagset.Uint64Flag{
|
||||
Name: "authrpc.port",
|
||||
Usage: "Listening port for authenticated APIs",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.Port,
|
||||
Default: c.cliConfig.JsonRPC.Auth.Port,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||
Name: "authrpc.vhosts",
|
||||
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
|
||||
Value: &c.cliConfig.JsonRPC.Auth.VHosts,
|
||||
Default: c.cliConfig.JsonRPC.Auth.VHosts,
|
||||
Group: "JsonRPC",
|
||||
})
|
||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||
Name: "http.corsdomain",
|
||||
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
|
||||
|
|
@ -566,6 +656,27 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Default: c.cliConfig.P2P.NAT,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "netrestrict",
|
||||
Usage: "Restricts network communication to the given IP networks (CIDR masks)",
|
||||
Value: &c.cliConfig.P2P.NetRestrict,
|
||||
Default: c.cliConfig.P2P.NetRestrict,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "nodekey",
|
||||
Usage: " P2P node key file",
|
||||
Value: &c.cliConfig.P2P.NodeKey,
|
||||
Default: c.cliConfig.P2P.NodeKey,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "nodekeyhex",
|
||||
Usage: "P2P node key as hex",
|
||||
Value: &c.cliConfig.P2P.NodeKeyHex,
|
||||
Default: c.cliConfig.P2P.NodeKeyHex,
|
||||
Group: "P2P",
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "nodiscover",
|
||||
Usage: "Disables the peer discovery mechanism (manual peer addition)",
|
||||
|
|
@ -739,5 +850,50 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.Developer.Period,
|
||||
Default: c.cliConfig.Developer.Period,
|
||||
})
|
||||
f.Uint64Flag(&flagset.Uint64Flag{
|
||||
Name: "dev.gaslimit",
|
||||
Usage: "Initial block gas limit",
|
||||
Value: &c.cliConfig.Developer.GasLimit,
|
||||
Default: c.cliConfig.Developer.GasLimit,
|
||||
})
|
||||
|
||||
// pprof
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "pprof",
|
||||
Usage: "Enable the pprof HTTP server",
|
||||
Value: &c.cliConfig.Pprof.Enabled,
|
||||
Default: c.cliConfig.Pprof.Enabled,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "pprof.port",
|
||||
Usage: "pprof HTTP server listening port",
|
||||
Value: &c.cliConfig.Pprof.Port,
|
||||
Default: c.cliConfig.Pprof.Port,
|
||||
})
|
||||
f.StringFlag(&flagset.StringFlag{
|
||||
Name: "pprof.addr",
|
||||
Usage: "pprof HTTP server listening interface",
|
||||
Value: &c.cliConfig.Pprof.Addr,
|
||||
Default: c.cliConfig.Pprof.Addr,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "pprof.memprofilerate",
|
||||
Usage: "Turn on memory profiling with the given rate",
|
||||
Value: &c.cliConfig.Pprof.MemProfileRate,
|
||||
Default: c.cliConfig.Pprof.MemProfileRate,
|
||||
})
|
||||
f.IntFlag(&flagset.IntFlag{
|
||||
Name: "pprof.blockprofilerate",
|
||||
Usage: "Turn on block profiling with the given rate",
|
||||
Value: &c.cliConfig.Pprof.BlockProfileRate,
|
||||
Default: c.cliConfig.Pprof.BlockProfileRate,
|
||||
})
|
||||
// f.StringFlag(&flagset.StringFlag{
|
||||
// Name: "pprof.cpuprofile",
|
||||
// Usage: "Write CPU profile to the given file",
|
||||
// Value: &c.cliConfig.Pprof.CPUProfile,
|
||||
// Default: c.cliConfig.Pprof.CPUProfile,
|
||||
// })
|
||||
|
||||
return f
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,13 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"runtime/trace"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
// Profile generates a pprof.Profile report for the given profile name.
|
||||
|
|
@ -113,3 +116,22 @@ func sleep(ctx context.Context, d time.Duration) {
|
|||
case <-ctx.Done():
|
||||
}
|
||||
}
|
||||
|
||||
func SetMemProfileRate(rate int) {
|
||||
runtime.MemProfileRate = rate
|
||||
}
|
||||
|
||||
func SetSetBlockProfileRate(rate int) {
|
||||
runtime.SetBlockProfileRate(rate)
|
||||
}
|
||||
|
||||
func StartPProf(address string) {
|
||||
log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address))
|
||||
|
||||
go func() {
|
||||
// nolint: gosec
|
||||
if err := http.ListenAndServe(address, nil); err != nil {
|
||||
log.Error("Failure in running pprof server", "err", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/eth/tracers"
|
||||
"github.com/ethereum/go-ethereum/ethstats"
|
||||
"github.com/ethereum/go-ethereum/graphql"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server/pprof"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server/proto"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/metrics"
|
||||
|
|
@ -57,6 +58,14 @@ type Server struct {
|
|||
|
||||
type serverOption func(srv *Server, config *Config) error
|
||||
|
||||
var glogger *log.GlogHandler
|
||||
|
||||
func init() {
|
||||
glogger = log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false)))
|
||||
glogger.Verbosity(log.LvlInfo)
|
||||
log.Root().SetHandler(glogger)
|
||||
}
|
||||
|
||||
func WithGRPCAddress() serverOption {
|
||||
return func(srv *Server, config *Config) error {
|
||||
return srv.gRPCServerByAddress(config.GRPC.Addr)
|
||||
|
|
@ -97,6 +106,13 @@ func VerbosityStringToInt(loglevel string) int {
|
|||
|
||||
//nolint:gocognit
|
||||
func NewServer(config *Config, opts ...serverOption) (*Server, error) {
|
||||
// start pprof
|
||||
if config.Pprof.Enabled {
|
||||
pprof.SetMemProfileRate(config.Pprof.MemProfileRate)
|
||||
pprof.SetSetBlockProfileRate(config.Pprof.BlockProfileRate)
|
||||
pprof.StartPProf(fmt.Sprintf("%s:%d", config.Pprof.Addr, config.Pprof.Port))
|
||||
}
|
||||
|
||||
runtime.SetMutexProfileFraction(5)
|
||||
|
||||
srv := &Server{
|
||||
|
|
@ -104,7 +120,7 @@ func NewServer(config *Config, opts ...serverOption) (*Server, error) {
|
|||
}
|
||||
|
||||
// start the logger
|
||||
setupLogger(VerbosityIntToString(config.Verbosity))
|
||||
setupLogger(VerbosityIntToString(config.Verbosity), *config.Logging)
|
||||
|
||||
var err error
|
||||
|
||||
|
|
@ -441,16 +457,22 @@ func (s *Server) loggingServerInterceptor(ctx context.Context, req interface{},
|
|||
return h, err
|
||||
}
|
||||
|
||||
func setupLogger(logLevel string) {
|
||||
func setupLogger(logLevel string, loggingInfo LoggingConfig) {
|
||||
var ostream log.Handler
|
||||
|
||||
output := io.Writer(os.Stderr)
|
||||
|
||||
if loggingInfo.Json {
|
||||
ostream = log.StreamHandler(output, log.JSONFormat())
|
||||
} else {
|
||||
usecolor := (isatty.IsTerminal(os.Stderr.Fd()) || isatty.IsCygwinTerminal(os.Stderr.Fd())) && os.Getenv("TERM") != "dumb"
|
||||
if usecolor {
|
||||
output = colorable.NewColorableStderr()
|
||||
}
|
||||
ostream = log.StreamHandler(output, log.TerminalFormat(usecolor))
|
||||
}
|
||||
|
||||
ostream := log.StreamHandler(output, log.TerminalFormat(usecolor))
|
||||
glogger := log.NewGlogHandler(ostream)
|
||||
glogger.SetHandler(ostream)
|
||||
|
||||
// logging
|
||||
lvl, err := log.LvlFromString(strings.ToLower(logLevel))
|
||||
|
|
@ -460,6 +482,20 @@ func setupLogger(logLevel string) {
|
|||
glogger.Verbosity(log.LvlInfo)
|
||||
}
|
||||
|
||||
if loggingInfo.Vmodule != "" {
|
||||
if err := glogger.Vmodule(loggingInfo.Vmodule); err != nil {
|
||||
log.Error("failed to set Vmodule", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
log.PrintOrigins(loggingInfo.Debug)
|
||||
|
||||
if loggingInfo.Backtrace != "" {
|
||||
if err := glogger.BacktraceAt(loggingInfo.Backtrace); err != nil {
|
||||
log.Error("failed to set BacktraceAt", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
log.Root().SetHandler(glogger)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ func (c *PruneStateCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
dbHandles, err := server.MakeDatabaseHandles()
|
||||
dbHandles, err := server.MakeDatabaseHandles(0)
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -57,15 +57,19 @@ func TestClientSyncTree(t *testing.T) {
|
|||
|
||||
c := NewClient(Config{Resolver: r, Logger: testlog.Logger(t, log.LvlTrace)})
|
||||
stree, err := c.SyncTree("enrtree://AKPYQIUQIL7PSIACI32J7FGZW56E5FKHEFCCOFHILBIMW3M6LWXS2@n")
|
||||
|
||||
if err != nil {
|
||||
t.Fatal("sync error:", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(sortByID(stree.Nodes()), sortByID(wantNodes)) {
|
||||
t.Errorf("wrong nodes in synced tree:\nhave %v\nwant %v", spew.Sdump(stree.Nodes()), spew.Sdump(wantNodes))
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(stree.Links(), wantLinks) {
|
||||
t.Errorf("wrong links in synced tree: %v", stree.Links())
|
||||
}
|
||||
|
||||
if stree.Seq() != wantSeq {
|
||||
t.Errorf("synced tree has wrong seq: %d", stree.Seq())
|
||||
}
|
||||
|
|
@ -295,7 +299,7 @@ func TestIteratorEmptyTree(t *testing.T) {
|
|||
|
||||
// updateSomeNodes applies ENR updates to some of the given nodes.
|
||||
func updateSomeNodes(keySeed int64, nodes []*enode.Node) {
|
||||
keys := testKeys(nodesSeed1, len(nodes))
|
||||
keys := testKeys(keySeed, len(nodes))
|
||||
for i, n := range nodes[:len(nodes)/2] {
|
||||
r := n.Record()
|
||||
r.Set(enr.IP{127, 0, 0, 1})
|
||||
|
|
@ -384,10 +388,12 @@ func makeTestTree(domain string, nodes []*enode.Node, links []string) (*Tree, st
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
url, err := tree.Sign(testKey(signingKeySeed), domain)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return tree, url
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -12,6 +13,12 @@ gcmode = "archive"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -19,6 +26,9 @@ gcmode = "archive"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -58,6 +68,7 @@ gcmode = "archive"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -82,6 +93,11 @@ gcmode = "archive"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +106,8 @@ gcmode = "archive"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -122,6 +140,7 @@ gcmode = "archive"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -136,3 +155,11 @@ gcmode = "archive"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -12,6 +13,12 @@ syncmode = "full"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -19,6 +26,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -58,6 +68,7 @@ syncmode = "full"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -82,6 +93,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +106,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -122,6 +140,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -136,3 +155,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -14,6 +15,12 @@ syncmode = "full"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 1
|
||||
port = 30303
|
||||
|
|
@ -21,6 +28,9 @@ syncmode = "full"
|
|||
# maxpendpeers = 50
|
||||
# bind = "0.0.0.0"
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -60,6 +70,7 @@ syncmode = "full"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -84,6 +95,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -92,6 +108,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -124,6 +142,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -138,3 +157,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
chain = "mainnet"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -14,6 +15,12 @@ syncmode = "full"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -21,6 +28,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -60,6 +70,7 @@ syncmode = "full"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -84,6 +95,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -92,6 +108,8 @@ syncmode = "full"
|
|||
[gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
ignoreprice = "30000000000"
|
||||
|
||||
|
|
@ -124,6 +142,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -138,3 +157,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -12,6 +13,12 @@ gcmode = "archive"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -19,6 +26,9 @@ gcmode = "archive"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -58,6 +68,7 @@ gcmode = "archive"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -82,6 +93,11 @@ gcmode = "archive"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +106,8 @@ gcmode = "archive"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -122,6 +140,7 @@ gcmode = "archive"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -136,3 +155,11 @@ gcmode = "archive"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = ""
|
||||
|
|
@ -12,6 +13,12 @@ syncmode = "full"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -19,6 +26,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -58,6 +68,7 @@ syncmode = "full"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -82,6 +93,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -90,6 +106,8 @@ syncmode = "full"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -122,6 +140,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
# [accounts]
|
||||
# unlock = []
|
||||
|
|
@ -136,3 +155,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -14,6 +15,12 @@ syncmode = "full"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 1
|
||||
port = 30303
|
||||
|
|
@ -21,6 +28,9 @@ syncmode = "full"
|
|||
# maxpendpeers = 50
|
||||
# bind = "0.0.0.0"
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -60,6 +70,7 @@ syncmode = "full"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -84,6 +95,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -92,6 +108,8 @@ syncmode = "full"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -124,6 +142,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -138,3 +157,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
chain = "mumbai"
|
||||
# identity = "node_name"
|
||||
# verbosity = 3
|
||||
# vmdebug = false
|
||||
datadir = "/var/lib/bor/data"
|
||||
# ancient = ""
|
||||
# keystore = "$BOR_DIR/keystore"
|
||||
|
|
@ -14,6 +15,12 @@ syncmode = "full"
|
|||
|
||||
# ["eth.requiredblocks"]
|
||||
|
||||
# [log]
|
||||
# vmodule = ""
|
||||
# json = false
|
||||
# backtrace = ""
|
||||
# debug = true
|
||||
|
||||
[p2p]
|
||||
maxpeers = 50
|
||||
port = 30303
|
||||
|
|
@ -21,6 +28,9 @@ syncmode = "full"
|
|||
# bind = "0.0.0.0"
|
||||
# nodiscover = false
|
||||
# nat = "any"
|
||||
# netrestrict = ""
|
||||
# nodekey = ""
|
||||
# nodekeyhex = ""
|
||||
# [p2p.discovery]
|
||||
# v5disc = false
|
||||
# bootnodes = []
|
||||
|
|
@ -60,6 +70,7 @@ syncmode = "full"
|
|||
ipcpath = "/var/lib/bor/bor.ipc"
|
||||
# ipcdisable = false
|
||||
# gascap = 50000000
|
||||
# evmtimeout = "5s"
|
||||
# txfeecap = 5.0
|
||||
# allow-unprotected-txs = false
|
||||
[jsonrpc.http]
|
||||
|
|
@ -84,6 +95,11 @@ syncmode = "full"
|
|||
# host = ""
|
||||
# vhosts = ["*"]
|
||||
# corsdomain = ["*"]
|
||||
# [jsonrpc.auth]
|
||||
# jwtsecret = ""
|
||||
# addr = "localhost"
|
||||
# port = 8551
|
||||
# vhosts = ["localhost"]
|
||||
# [jsonrpc.timeouts]
|
||||
# read = "30s"
|
||||
# write = "30s"
|
||||
|
|
@ -92,6 +108,8 @@ syncmode = "full"
|
|||
# [gpo]
|
||||
# blocks = 20
|
||||
# percentile = 60
|
||||
# maxheaderhistory = 1024
|
||||
# maxblockhistory = 1024
|
||||
# maxprice = "5000000000000"
|
||||
# ignoreprice = "2"
|
||||
|
||||
|
|
@ -124,6 +142,7 @@ syncmode = "full"
|
|||
# preimages = false
|
||||
# txlookuplimit = 2350000
|
||||
# timeout = "1h0m0s"
|
||||
# fdlimit = 0
|
||||
|
||||
[accounts]
|
||||
allow-insecure-unlock = true
|
||||
|
|
@ -138,3 +157,11 @@ syncmode = "full"
|
|||
# [developer]
|
||||
# dev = false
|
||||
# period = 0
|
||||
# gaslimit = 11500000
|
||||
|
||||
# [pprof]
|
||||
# pprof = false
|
||||
# port = 6060
|
||||
# addr = "127.0.0.1"
|
||||
# memprofilerate = 524288
|
||||
# blockprofilerate = 0
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ func DialInProc(handler *Server) *Client {
|
|||
initctx := context.Background()
|
||||
c, _ := newClient(initctx, func(context.Context) (ServerCodec, error) {
|
||||
p1, p2 := net.Pipe()
|
||||
|
||||
// nolint: contextcheck
|
||||
go handler.ServeCodec(NewCodec(p1), 0)
|
||||
return NewCodec(p2), nil
|
||||
|
|
|
|||
|
|
@ -105,11 +105,13 @@ func (s *Server) serveSingleRequest(ctx context.Context, codec ServerCodec) {
|
|||
reqs, batch, err := codec.readBatch()
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
// nolint:errcheck
|
||||
// nolint: errcheck
|
||||
codec.writeJSON(ctx, errorMessage(&invalidMessageError{"parse error"}))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// nolint: contextcheck
|
||||
if batch {
|
||||
// nolint: contextcheck
|
||||
h.handleBatch(reqs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue