2015-07-07 00:54:22 +00:00
|
|
|
// Copyright 2015 The go-ethereum Authors
|
|
|
|
// This file is part of go-ethereum.
|
|
|
|
//
|
|
|
|
// go-ethereum is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// go-ethereum is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-07-22 16:48:40 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-07-07 00:54:22 +00:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2015-07-22 16:48:40 +00:00
|
|
|
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
2015-07-07 00:54:22 +00:00
|
|
|
|
2016-11-25 15:55:06 +00:00
|
|
|
// Package utils contains internal helper functions for go-ethereum commands.
|
2015-03-06 02:00:41 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/ecdsa"
|
2015-04-20 15:45:37 +00:00
|
|
|
"fmt"
|
2019-08-22 11:32:26 +00:00
|
|
|
"io"
|
2015-05-09 10:00:51 +00:00
|
|
|
"math/big"
|
2021-06-14 06:35:22 +00:00
|
|
|
"os"
|
2021-03-01 04:02:22 +00:00
|
|
|
"path"
|
2015-05-12 12:24:11 +00:00
|
|
|
"path/filepath"
|
2015-07-07 08:32:05 +00:00
|
|
|
"strconv"
|
2015-11-17 16:33:25 +00:00
|
|
|
"strings"
|
2019-08-22 11:32:26 +00:00
|
|
|
"text/tabwriter"
|
|
|
|
"text/template"
|
2015-05-12 12:24:11 +00:00
|
|
|
|
2021-06-11 08:34:37 +00:00
|
|
|
"github.com/ledgerwatch/erigon/eth/protocols/eth"
|
2021-04-19 21:58:05 +00:00
|
|
|
"github.com/spf13/cobra"
|
2021-03-23 09:00:07 +00:00
|
|
|
"github.com/spf13/pflag"
|
2021-04-19 21:58:05 +00:00
|
|
|
"github.com/urfave/cli"
|
2021-02-25 19:40:45 +00:00
|
|
|
|
2021-05-20 18:25:53 +00:00
|
|
|
"github.com/ledgerwatch/erigon/common"
|
|
|
|
"github.com/ledgerwatch/erigon/common/paths"
|
|
|
|
"github.com/ledgerwatch/erigon/consensus/ethash"
|
|
|
|
"github.com/ledgerwatch/erigon/core"
|
|
|
|
"github.com/ledgerwatch/erigon/crypto"
|
|
|
|
"github.com/ledgerwatch/erigon/eth/ethconfig"
|
|
|
|
"github.com/ledgerwatch/erigon/eth/gasprice"
|
|
|
|
"github.com/ledgerwatch/erigon/ethdb"
|
|
|
|
"github.com/ledgerwatch/erigon/internal/flags"
|
|
|
|
"github.com/ledgerwatch/erigon/log"
|
|
|
|
"github.com/ledgerwatch/erigon/metrics"
|
|
|
|
"github.com/ledgerwatch/erigon/node"
|
|
|
|
"github.com/ledgerwatch/erigon/p2p"
|
|
|
|
"github.com/ledgerwatch/erigon/p2p/enode"
|
|
|
|
"github.com/ledgerwatch/erigon/p2p/nat"
|
|
|
|
"github.com/ledgerwatch/erigon/p2p/netutil"
|
|
|
|
"github.com/ledgerwatch/erigon/params"
|
2015-03-06 02:00:41 +00:00
|
|
|
)
|
|
|
|
|
2015-03-10 15:44:48 +00:00
|
|
|
func init() {
|
|
|
|
cli.AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...]
|
|
|
|
|
|
|
|
VERSION:
|
|
|
|
{{.Version}}
|
|
|
|
|
|
|
|
COMMANDS:
|
|
|
|
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
|
|
|
|
{{end}}{{if .Flags}}
|
|
|
|
GLOBAL OPTIONS:
|
|
|
|
{{range .Flags}}{{.}}
|
|
|
|
{{end}}{{end}}
|
|
|
|
`
|
2020-07-14 08:35:32 +00:00
|
|
|
cli.CommandHelpTemplate = flags.CommandHelpTemplate
|
2019-08-22 11:32:26 +00:00
|
|
|
cli.HelpPrinter = printHelp
|
2015-03-10 15:44:48 +00:00
|
|
|
}
|
|
|
|
|
2019-08-22 11:32:26 +00:00
|
|
|
func printHelp(out io.Writer, templ string, data interface{}) {
|
|
|
|
funcMap := template.FuncMap{"join": strings.Join}
|
|
|
|
t := template.Must(template.New("help").Funcs(funcMap).Parse(templ))
|
|
|
|
w := tabwriter.NewWriter(out, 38, 8, 2, ' ', 0)
|
|
|
|
err := t.Execute(w, data)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
w.Flush()
|
|
|
|
}
|
|
|
|
|
2015-03-06 02:00:41 +00:00
|
|
|
// These are all the command line flags we support.
|
|
|
|
// If you add to this list, please remember to include the
|
|
|
|
// flag in the appropriate command definition.
|
|
|
|
//
|
|
|
|
// The flags are defined here so their names and help texts
|
|
|
|
// are the same for all commands.
|
|
|
|
|
|
|
|
var (
|
|
|
|
// General settings
|
2015-04-08 13:43:55 +00:00
|
|
|
DataDirFlag = DirectoryFlag{
|
2015-03-06 02:00:41 +00:00
|
|
|
Name: "datadir",
|
2021-03-26 18:05:42 +00:00
|
|
|
Usage: "Data directory for the databases",
|
2021-04-19 21:58:05 +00:00
|
|
|
Value: DirectoryString(paths.DefaultDataDir()),
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2019-03-08 13:56:20 +00:00
|
|
|
AncientFlag = DirectoryFlag{
|
|
|
|
Name: "datadir.ancient",
|
|
|
|
Usage: "Data directory for ancient chain segments (default = inside chaindata)",
|
|
|
|
}
|
2021-01-19 08:26:42 +00:00
|
|
|
MinFreeDiskSpaceFlag = DirectoryFlag{
|
|
|
|
Name: "datadir.minfreedisk",
|
|
|
|
Usage: "Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)",
|
|
|
|
}
|
2017-04-25 11:31:15 +00:00
|
|
|
NetworkIdFlag = cli.Uint64Flag{
|
2015-03-18 07:44:58 +00:00
|
|
|
Name: "networkid",
|
2021-04-08 07:39:40 +00:00
|
|
|
Usage: "Explicitly set network id (integer)(For testnets: use --chain <testnet_name> instead)",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.NetworkID,
|
2015-03-18 07:44:58 +00:00
|
|
|
}
|
2017-10-24 10:40:42 +00:00
|
|
|
DeveloperPeriodFlag = cli.IntFlag{
|
|
|
|
Name: "dev.period",
|
|
|
|
Usage: "Block period to use in developer mode (0 = mine only if transaction pending)",
|
2015-09-06 13:46:54 +00:00
|
|
|
}
|
2021-04-08 07:39:40 +00:00
|
|
|
ChainFlag = cli.StringFlag{
|
|
|
|
Name: "chain",
|
|
|
|
Usage: "Name of the testnet to join",
|
|
|
|
Value: params.MainnetChainName,
|
|
|
|
}
|
2015-04-18 21:53:30 +00:00
|
|
|
IdentityFlag = cli.StringFlag{
|
|
|
|
Name: "identity",
|
2015-04-21 23:41:34 +00:00
|
|
|
Usage: "Custom node name",
|
2015-04-18 21:53:30 +00:00
|
|
|
}
|
2019-07-10 02:08:59 +00:00
|
|
|
WhitelistFlag = cli.StringFlag{
|
|
|
|
Name: "whitelist",
|
|
|
|
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
|
|
|
|
}
|
2017-05-26 10:40:47 +00:00
|
|
|
// Ethash settings
|
|
|
|
EthashCachesInMemoryFlag = cli.IntFlag{
|
|
|
|
Name: "ethash.cachesinmem",
|
|
|
|
Usage: "Number of recent ethash caches to keep in memory (16MB each)",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.Ethash.CachesInMem,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
geth 1.9.13 (#469)
* core: initial version of state snapshots
* core/state: lazy sorting, snapshot invalidation
* core/state/snapshot: extract and split cap method, cover corners
* snapshot: iteration and buffering optimizations
* core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
* 123
* core/rawdb, core/state/snapshot: runtime snapshot generation
* core/state/snapshot: fix difflayer origin-initalization after flatten
* add "to merge"
* core/state/snapshot: implement snapshot layer iteration
* core/state/snapshot: node behavioural difference on bloom content
* core: journal the snapshot inside leveldb, not a flat file
* core/state/snapshot: bloom, metrics and prefetcher fixes
* core/state/snapshot: move iterator out into its own files
* core/state/snapshot: implement iterator priority for fast direct data lookup
* core/state/snapshot: full featured account iteration
* core/state/snapshot: faster account iteration, CLI integration
* core: fix broken tests due to API changes + linter
* core/state: fix an account resurrection issue
* core/tests: test for destroy+recreate contract with storage
* squashme
* core/state/snapshot, tests: sync snap gen + snaps in consensus tests
* core/state: extend snapshotter to handle account resurrections
* core/state: fix account root hash update point
* core/state: fix resurrection state clearing and access
* core/state/snapshot: handle deleted accounts in fast iterator
* core: more blockchain tests
* core/state/snapshot: fix various iteration issues due to destruct set
* core: fix two snapshot iterator flaws, decollide snap storage prefix
* core/state/snapshot/iterator: fix two disk iterator flaws
* core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix
* params: begin v1.9.13 release cycle
* cmd/checkpoint-admin: add some documentation (#20697)
* go.mod: update duktape to fix sprintf warnings (#20777)
This revision of go-duktype fixes the following warning
```
duk_logging.c: In function ‘duk__logger_prototype_log_shared’:
duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=]
184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
| ^
In file included from /usr/include/stdio.h:867,
from duk_logging.c:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* core/rawdb: fix freezer table test error check
Fixes: Condition is always 'false' because 'err' is always 'nil'
* core/rawdb: improve table database (#20703)
This PR fixes issues in TableDatabase.
TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix.
The prefix is applied to all entries it maintains. However when we try to retrieve entries
from it we don't handle the key properly. In theory the prefix should be truncated and
only user key is returned. But we don't do it in some cases, e.g. the iterator and batch
replayer created from it. So this PR is the fix to these issues.
* eth: when triggering a sync, check the head header TD, not block
* internal/web3ext: fix clique console apis to work on missing arguments
* rpc: dont log an error if user configures --rpcapi=rpc... (#20776)
This just prevents a false negative ERROR warning when, for some unknown
reason, a user attempts to turn on the module rpc even though it's already going
to be on.
* node, cmd/clef: report actual port used for http rpc (#20789)
* internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783)
Prior to this change, eth_call changed the balance of the sender account in the
EVM environment to 2^256 wei to cover the gas cost of the call execution.
We've had this behavior for a long time even though it's super confusing.
This commit sets the default call gasprice to zero instead of updating the balance,
which is better because it makes eth_call semantics less surprising. Removing
the built-in balance assignment also makes balance overrides work as expected.
* metrics: disable CPU stats (gosigar) on iOS
* cmd/devp2p: tweak DNS TTLs (#20801)
* cmd/devp2p: tweak DNS TTLs
* cmd/devp2p: bump treeNodeTTL to four weeks
* cmd/devp2p: lower route53 change limit again (#20819)
* cmd/devp2p: be very correct about route53 change splitting (#20820)
Turns out the way RDATA limits work is documented after all,
I just didn't search right. The trick to make it work is to
count UPSERTs twice.
This also adds an additional check to ensure TTL changes are
applied on existing records.
* graphql, node, rpc: fix typos in comments (#20824)
* eth: improve shutdown synchronization (#20695)
* eth: improve shutdown synchronization
Most goroutines started by eth.Ethereum didn't have any shutdown sync at
all, which lead to weird error messages when quitting the client.
This change improves the clean shutdown path by stopping all internal
components in dependency order and waiting for them to actually be
stopped before shutdown is considered done. In particular, we now stop
everything related to peers before stopping 'resident' parts such as
core.BlockChain.
* eth: rewrite sync controller
* eth: remove sync start debug message
* eth: notify chainSyncer about new peers after handshake
* eth: move downloader.Cancel call into chainSyncer
* eth: make post-sync block broadcast synchronous
* eth: add comments
* core: change blockchain stop message
* eth: change closeBloomHandler channel type
* eth/filters: fix typo on unindexedLogs function's comment (#20827)
* core: bump txpool tx max size to 128KB
* snapshotter/tests: verify snapdb post-state against trie (#20812)
* core/state/snapshot: basic trie-to-hash implementation
* tests: validate snapshot after test
* core/state/snapshot: fix review concerns
* cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484)
* cmd, consensus: add option to disable mmap for DAG caches/datasets
* consensus: add benchmarks for mmap with/with lock
* cmd/clef: add newaccount command (#20782)
* cmd/clef: add newaccount command
* cmd/clef: document clef_New, update API versioning
* Update cmd/clef/intapi_changelog.md
Co-Authored-By: ligi <ligi@ligi.de>
* Update signer/core/uiapi.go
Co-Authored-By: ligi <ligi@ligi.de>
Co-authored-by: ligi <ligi@ligi.de>
* eth: add debug_accountRange API (#19645)
This new API allows reading accounts and their content by address range.
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
* travis: allow cocoapods deploy to fail (#20833)
* metrics: improve TestTimerFunc (#20818)
The test failed due to what appears to be fluctuations in time.Sleep, which is
not the actual method under test. This change modifies it so we compare the
metered Max to the actual time instead of the desired time.
* README: update private network genesis spec with istanbul (#20841)
* add istanbul and muirGlacier to genesis states in README
* remove muirGlacier, relocate istanbul
* cmd/evm: Rework execution stats (#20792)
- Dump stats also for --bench flag.
- From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested.
- Now the mem stats are for single execution in case of --bench.
* cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843)
* p2p/server: add UDP port mapping goroutine to wait group (#20846)
* accounts/abi faster unpacking of int256 (#20850)
* p2p/discv5: add missing Timer.Stop calls (#20853)
* miner/worker: add missing timer.Stop call (#20857)
* cmd/geth: fix bad genesis test (#20860)
* eth/filters: add missing Ticker.Stop call (#20862)
* eth/fetcher: add missing timer.Stop calls (#20861)
* event: add missing timer.Stop call in TestFeed (#20868)
* metrics: add missing calls to Ticker.Stop in tests (#20866)
* ethstats: add missing Ticker.Stop call (#20867)
* p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869)
* core: add missing Timer.Stop call in TestLogReorgs (#20870)
* rpc: add missing timer.Stop calls in websocket tests (#20863)
* crypto/ecies: improve concatKDF (#20836)
This removes a bunch of weird code around the counter overflow check in
concatKDF and makes it actually work for different hash output sizes.
The overflow check worked as follows: concatKDF applies the hash function N
times, where N is roundup(kdLen, hashsize) / hashsize. N should not
overflow 32 bits because that would lead to a repetition in the KDF output.
A couple issues with the overflow check:
- It used the hash.BlockSize, which is wrong because the
block size is about the input of the hash function. Luckily, all standard
hash functions have a block size that's greater than the output size, so
concatKDF didn't crash, it just generated too much key material.
- The check used big.Int to compare against 2^32-1.
- The calculation could still overflow before reaching the check.
The new code in concatKDF doesn't check for overflow. Instead, there is a
new check on ECIESParams which ensures that params.KeyLen is < 512. This
removes any possibility of overflow.
There are a couple of miscellaneous improvements bundled in with this
change:
- The key buffer is pre-allocated instead of appending the hash output
to an initially empty slice.
- The code that uses concatKDF to derive keys is now shared between Encrypt
and Decrypt.
- There was a redundant invocation of IsOnCurve in Decrypt. This is now removed
because elliptic.Unmarshal already checks whether the input is a valid curve
point since Go 1.5.
Co-authored-by: Felix Lange <fjl@twurst.com>
* rpc: metrics for JSON-RPC method calls (#20847)
This adds a couple of metrics for tracking the timing
and frequency of method calls:
- rpc/requests gauge counts all requests
- rpc/success gauge counts requests which return err == nil
- rpc/failure gauge counts requests which return err != nil
- rpc/duration/all timer tracks timing of all requests
- rpc/duration/<method>/<success/failure> tracks per-method timing
* mobile: use bind.NewKeyedTransactor instead of duplicating (#20888)
It's better to reuse the existing code to create a keyed transactor
than to rewrite the logic again.
* internal/ethapi: add CallArgs.ToMessage method (#20854)
ToMessage is used to convert between ethapi.CallArgs and types.Message.
It reduces the length of the DoCall method by about half by abstracting out
the conversion between the CallArgs and the Message. This should improve the
code's maintainability and reusability.
* eth, les: fix flaky tests (#20897)
* les: fix flaky test
* eth: fix flaky test
* cmd/geth: enable metrics for geth import command (#20738)
* cmd/geth: enable metrics for geth import command
* cmd/geth: enable metrics-flags for import command
* core/vm: use a callcontext struct (#20761)
* core/vm: use a callcontext struct
* core/vm: fix tests
* core/vm/runtime: benchmark
* core/vm: make intpool push inlineable, unexpose callcontext
* docs/audits: add discv5 protocol audits from LA and C53 (#20898)
* .github: change gitter reference to discord link in issue template (#20896)
* couple of fixes to docs in clef (#20900)
* p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen.
* build: upgrade to golangci-lint 1.24.0 (#20901)
* accounts/scwallet: remove unnecessary uses of fmt.Sprintf
* cmd/puppeth: remove unnecessary uses of fmt.Sprintf
* p2p/discv5: remove unnecessary use of fmt.Sprintf
* whisper/mailserver: remove unnecessary uses of fmt.Sprintf
* core: goimports -w tx_pool_test.go
* eth/downloader: goimports -w downloader_test.go
* build: upgrade to golangci-lint 1.24.0
* accounts/abi/bind: Refactored topics (#20851)
* accounts/abi/bind: refactored topics
* accounts/abi/bind: use store function to remove code duplication
* accounts/abi/bind: removed unused type defs
* accounts/abi/bind: error on tuples in topics
* Cosmetic changes to restart travis build
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
* node: allow websocket and HTTP on the same port (#20810)
This change makes it possible to run geth with JSON-RPC over HTTP and
WebSocket on the same TCP port. The default port for WebSocket
is still 8546.
geth --rpc --rpcport 8545 --ws --wsport 8545
This also removes a lot of deprecated API surface from package rpc.
The rpc package is now purely about serving JSON-RPC and no longer
provides a way to start an HTTP server.
* crypto: improve error messages in LoadECDSA (#20718)
This improves error messages when the file is too short or too long.
Also rewrite the test for SaveECDSA because LoadECDSA has its own
test now.
Co-authored-by: Felix Lange <fjl@twurst.com>
* changed date of rpcstack.go since new file (#20904)
* accounts/abi/bind: fixed erroneous filtering of negative ints (#20865)
* accounts/abi/bind: fixed erroneous packing of negative ints
* accounts/abi/bind: added test cases for negative ints in topics
* accounts/abi/bind: fixed genIntType for go 1.12
* accounts/abi: minor nitpick
* cmd: deprecate --testnet, use named networks instead (#20852)
* cmd/utils: make goerli the default testnet
* cmd/geth: explicitly rename testnet to ropsten
* core: explicitly rename testnet to ropsten
* params: explicitly rename testnet to ropsten
* cmd: explicitly rename testnet to ropsten
* miner: explicitly rename testnet to ropsten
* mobile: allow for returning the goerli spec
* tests: explicitly rename testnet to ropsten
* docs: update readme to reflect changes to the default testnet
* mobile: allow for configuring goerli and rinkeby nodes
* cmd/geth: revert --testnet back to ropsten and mark as legacy
* cmd/util: mark --testnet flag as deprecated
* docs: update readme to properly reflect the 3 testnets
* cmd/utils: add an explicit deprecation warning on startup
* cmd/utils: swap goerli and ropsten in usage
* cmd/geth: swap goerli and ropsten in usage
* cmd/geth: if running a known preset, log it for convenience
* docs: improve readme on usage of ropsten's testnet datadir
* cmd/utils: check if legacy `testnet` datadir exists for ropsten
* cmd/geth: check for legacy testnet path in console command
* cmd/geth: use switch statement for complex conditions in main
* cmd/geth: move known preset log statement to the very top
* cmd/utils: create new ropsten configurations in the ropsten datadir
* cmd/utils: makedatadir should check for existing testnet dir
* cmd/geth: add legacy testnet flag to the copy db command
* cmd/geth: add legacy testnet flag to the inspect command
* les, les/lespay/client: add service value statistics and API (#20837)
This PR adds service value measurement statistics to the light client. It
also adds a private API that makes these statistics accessible. A follow-up
PR will add the new server pool which uses these statistics to select
servers with good performance.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
* README: update min go version to 1.13 (#20911)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2
* travis, appveyor: force GO111MODULE=on for every build
* core/rawdb: fix data race between Retrieve and Close (#20919)
* core/rawdb: fixed data race between retrieve and close
closes https://github.com/ethereum/go-ethereum/issues/20420
* core/rawdb: use non-atomic load while holding mutex
* all: simplify and fix database iteration with prefix/start (#20808)
* core/state/snapshot: start fixing disk iterator seek
* ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start
* les, core/state/snapshot: iterator fixes
* all: remove two iterator methods
* all: rename Iteratee.NewIteratorWith -> NewIterator
* ethdb: fix review concerns
* params: update CHTs for the 1.9.13 release
* params: release Geth v1.9.13
* added some missing files
* post-rebase fixups
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Co-authored-by: Ha ĐANG <dvietha@gmail.com>
Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Wenbiao Zheng <delweng@gmail.com>
Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com>
Co-authored-by: Jeff Wentworth <jeff@curvegrid.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Luke Champine <luke.champine@gmail.com>
Co-authored-by: Boqin Qin <Bobbqqin@gmail.com>
Co-authored-by: William Morriss <wjmelements@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
|
|
|
EthashCachesLockMmapFlag = cli.BoolFlag{
|
|
|
|
Name: "ethash.cacheslockmmap",
|
|
|
|
Usage: "Lock memory maps of recent ethash caches",
|
|
|
|
}
|
2017-05-26 10:40:47 +00:00
|
|
|
EthashDatasetDirFlag = DirectoryFlag{
|
|
|
|
Name: "ethash.dagdir",
|
2019-08-22 11:32:26 +00:00
|
|
|
Usage: "Directory to store the ethash mining DAGs",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: DirectoryString(ethconfig.Defaults.Ethash.DatasetDir),
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
geth 1.9.13 (#469)
* core: initial version of state snapshots
* core/state: lazy sorting, snapshot invalidation
* core/state/snapshot: extract and split cap method, cover corners
* snapshot: iteration and buffering optimizations
* core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
* 123
* core/rawdb, core/state/snapshot: runtime snapshot generation
* core/state/snapshot: fix difflayer origin-initalization after flatten
* add "to merge"
* core/state/snapshot: implement snapshot layer iteration
* core/state/snapshot: node behavioural difference on bloom content
* core: journal the snapshot inside leveldb, not a flat file
* core/state/snapshot: bloom, metrics and prefetcher fixes
* core/state/snapshot: move iterator out into its own files
* core/state/snapshot: implement iterator priority for fast direct data lookup
* core/state/snapshot: full featured account iteration
* core/state/snapshot: faster account iteration, CLI integration
* core: fix broken tests due to API changes + linter
* core/state: fix an account resurrection issue
* core/tests: test for destroy+recreate contract with storage
* squashme
* core/state/snapshot, tests: sync snap gen + snaps in consensus tests
* core/state: extend snapshotter to handle account resurrections
* core/state: fix account root hash update point
* core/state: fix resurrection state clearing and access
* core/state/snapshot: handle deleted accounts in fast iterator
* core: more blockchain tests
* core/state/snapshot: fix various iteration issues due to destruct set
* core: fix two snapshot iterator flaws, decollide snap storage prefix
* core/state/snapshot/iterator: fix two disk iterator flaws
* core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix
* params: begin v1.9.13 release cycle
* cmd/checkpoint-admin: add some documentation (#20697)
* go.mod: update duktape to fix sprintf warnings (#20777)
This revision of go-duktype fixes the following warning
```
duk_logging.c: In function ‘duk__logger_prototype_log_shared’:
duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=]
184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
| ^
In file included from /usr/include/stdio.h:867,
from duk_logging.c:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* core/rawdb: fix freezer table test error check
Fixes: Condition is always 'false' because 'err' is always 'nil'
* core/rawdb: improve table database (#20703)
This PR fixes issues in TableDatabase.
TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix.
The prefix is applied to all entries it maintains. However when we try to retrieve entries
from it we don't handle the key properly. In theory the prefix should be truncated and
only user key is returned. But we don't do it in some cases, e.g. the iterator and batch
replayer created from it. So this PR is the fix to these issues.
* eth: when triggering a sync, check the head header TD, not block
* internal/web3ext: fix clique console apis to work on missing arguments
* rpc: dont log an error if user configures --rpcapi=rpc... (#20776)
This just prevents a false negative ERROR warning when, for some unknown
reason, a user attempts to turn on the module rpc even though it's already going
to be on.
* node, cmd/clef: report actual port used for http rpc (#20789)
* internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783)
Prior to this change, eth_call changed the balance of the sender account in the
EVM environment to 2^256 wei to cover the gas cost of the call execution.
We've had this behavior for a long time even though it's super confusing.
This commit sets the default call gasprice to zero instead of updating the balance,
which is better because it makes eth_call semantics less surprising. Removing
the built-in balance assignment also makes balance overrides work as expected.
* metrics: disable CPU stats (gosigar) on iOS
* cmd/devp2p: tweak DNS TTLs (#20801)
* cmd/devp2p: tweak DNS TTLs
* cmd/devp2p: bump treeNodeTTL to four weeks
* cmd/devp2p: lower route53 change limit again (#20819)
* cmd/devp2p: be very correct about route53 change splitting (#20820)
Turns out the way RDATA limits work is documented after all,
I just didn't search right. The trick to make it work is to
count UPSERTs twice.
This also adds an additional check to ensure TTL changes are
applied on existing records.
* graphql, node, rpc: fix typos in comments (#20824)
* eth: improve shutdown synchronization (#20695)
* eth: improve shutdown synchronization
Most goroutines started by eth.Ethereum didn't have any shutdown sync at
all, which lead to weird error messages when quitting the client.
This change improves the clean shutdown path by stopping all internal
components in dependency order and waiting for them to actually be
stopped before shutdown is considered done. In particular, we now stop
everything related to peers before stopping 'resident' parts such as
core.BlockChain.
* eth: rewrite sync controller
* eth: remove sync start debug message
* eth: notify chainSyncer about new peers after handshake
* eth: move downloader.Cancel call into chainSyncer
* eth: make post-sync block broadcast synchronous
* eth: add comments
* core: change blockchain stop message
* eth: change closeBloomHandler channel type
* eth/filters: fix typo on unindexedLogs function's comment (#20827)
* core: bump txpool tx max size to 128KB
* snapshotter/tests: verify snapdb post-state against trie (#20812)
* core/state/snapshot: basic trie-to-hash implementation
* tests: validate snapshot after test
* core/state/snapshot: fix review concerns
* cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484)
* cmd, consensus: add option to disable mmap for DAG caches/datasets
* consensus: add benchmarks for mmap with/with lock
* cmd/clef: add newaccount command (#20782)
* cmd/clef: add newaccount command
* cmd/clef: document clef_New, update API versioning
* Update cmd/clef/intapi_changelog.md
Co-Authored-By: ligi <ligi@ligi.de>
* Update signer/core/uiapi.go
Co-Authored-By: ligi <ligi@ligi.de>
Co-authored-by: ligi <ligi@ligi.de>
* eth: add debug_accountRange API (#19645)
This new API allows reading accounts and their content by address range.
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
* travis: allow cocoapods deploy to fail (#20833)
* metrics: improve TestTimerFunc (#20818)
The test failed due to what appears to be fluctuations in time.Sleep, which is
not the actual method under test. This change modifies it so we compare the
metered Max to the actual time instead of the desired time.
* README: update private network genesis spec with istanbul (#20841)
* add istanbul and muirGlacier to genesis states in README
* remove muirGlacier, relocate istanbul
* cmd/evm: Rework execution stats (#20792)
- Dump stats also for --bench flag.
- From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested.
- Now the mem stats are for single execution in case of --bench.
* cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843)
* p2p/server: add UDP port mapping goroutine to wait group (#20846)
* accounts/abi faster unpacking of int256 (#20850)
* p2p/discv5: add missing Timer.Stop calls (#20853)
* miner/worker: add missing timer.Stop call (#20857)
* cmd/geth: fix bad genesis test (#20860)
* eth/filters: add missing Ticker.Stop call (#20862)
* eth/fetcher: add missing timer.Stop calls (#20861)
* event: add missing timer.Stop call in TestFeed (#20868)
* metrics: add missing calls to Ticker.Stop in tests (#20866)
* ethstats: add missing Ticker.Stop call (#20867)
* p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869)
* core: add missing Timer.Stop call in TestLogReorgs (#20870)
* rpc: add missing timer.Stop calls in websocket tests (#20863)
* crypto/ecies: improve concatKDF (#20836)
This removes a bunch of weird code around the counter overflow check in
concatKDF and makes it actually work for different hash output sizes.
The overflow check worked as follows: concatKDF applies the hash function N
times, where N is roundup(kdLen, hashsize) / hashsize. N should not
overflow 32 bits because that would lead to a repetition in the KDF output.
A couple issues with the overflow check:
- It used the hash.BlockSize, which is wrong because the
block size is about the input of the hash function. Luckily, all standard
hash functions have a block size that's greater than the output size, so
concatKDF didn't crash, it just generated too much key material.
- The check used big.Int to compare against 2^32-1.
- The calculation could still overflow before reaching the check.
The new code in concatKDF doesn't check for overflow. Instead, there is a
new check on ECIESParams which ensures that params.KeyLen is < 512. This
removes any possibility of overflow.
There are a couple of miscellaneous improvements bundled in with this
change:
- The key buffer is pre-allocated instead of appending the hash output
to an initially empty slice.
- The code that uses concatKDF to derive keys is now shared between Encrypt
and Decrypt.
- There was a redundant invocation of IsOnCurve in Decrypt. This is now removed
because elliptic.Unmarshal already checks whether the input is a valid curve
point since Go 1.5.
Co-authored-by: Felix Lange <fjl@twurst.com>
* rpc: metrics for JSON-RPC method calls (#20847)
This adds a couple of metrics for tracking the timing
and frequency of method calls:
- rpc/requests gauge counts all requests
- rpc/success gauge counts requests which return err == nil
- rpc/failure gauge counts requests which return err != nil
- rpc/duration/all timer tracks timing of all requests
- rpc/duration/<method>/<success/failure> tracks per-method timing
* mobile: use bind.NewKeyedTransactor instead of duplicating (#20888)
It's better to reuse the existing code to create a keyed transactor
than to rewrite the logic again.
* internal/ethapi: add CallArgs.ToMessage method (#20854)
ToMessage is used to convert between ethapi.CallArgs and types.Message.
It reduces the length of the DoCall method by about half by abstracting out
the conversion between the CallArgs and the Message. This should improve the
code's maintainability and reusability.
* eth, les: fix flaky tests (#20897)
* les: fix flaky test
* eth: fix flaky test
* cmd/geth: enable metrics for geth import command (#20738)
* cmd/geth: enable metrics for geth import command
* cmd/geth: enable metrics-flags for import command
* core/vm: use a callcontext struct (#20761)
* core/vm: use a callcontext struct
* core/vm: fix tests
* core/vm/runtime: benchmark
* core/vm: make intpool push inlineable, unexpose callcontext
* docs/audits: add discv5 protocol audits from LA and C53 (#20898)
* .github: change gitter reference to discord link in issue template (#20896)
* couple of fixes to docs in clef (#20900)
* p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen.
* build: upgrade to golangci-lint 1.24.0 (#20901)
* accounts/scwallet: remove unnecessary uses of fmt.Sprintf
* cmd/puppeth: remove unnecessary uses of fmt.Sprintf
* p2p/discv5: remove unnecessary use of fmt.Sprintf
* whisper/mailserver: remove unnecessary uses of fmt.Sprintf
* core: goimports -w tx_pool_test.go
* eth/downloader: goimports -w downloader_test.go
* build: upgrade to golangci-lint 1.24.0
* accounts/abi/bind: Refactored topics (#20851)
* accounts/abi/bind: refactored topics
* accounts/abi/bind: use store function to remove code duplication
* accounts/abi/bind: removed unused type defs
* accounts/abi/bind: error on tuples in topics
* Cosmetic changes to restart travis build
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
* node: allow websocket and HTTP on the same port (#20810)
This change makes it possible to run geth with JSON-RPC over HTTP and
WebSocket on the same TCP port. The default port for WebSocket
is still 8546.
geth --rpc --rpcport 8545 --ws --wsport 8545
This also removes a lot of deprecated API surface from package rpc.
The rpc package is now purely about serving JSON-RPC and no longer
provides a way to start an HTTP server.
* crypto: improve error messages in LoadECDSA (#20718)
This improves error messages when the file is too short or too long.
Also rewrite the test for SaveECDSA because LoadECDSA has its own
test now.
Co-authored-by: Felix Lange <fjl@twurst.com>
* changed date of rpcstack.go since new file (#20904)
* accounts/abi/bind: fixed erroneous filtering of negative ints (#20865)
* accounts/abi/bind: fixed erroneous packing of negative ints
* accounts/abi/bind: added test cases for negative ints in topics
* accounts/abi/bind: fixed genIntType for go 1.12
* accounts/abi: minor nitpick
* cmd: deprecate --testnet, use named networks instead (#20852)
* cmd/utils: make goerli the default testnet
* cmd/geth: explicitly rename testnet to ropsten
* core: explicitly rename testnet to ropsten
* params: explicitly rename testnet to ropsten
* cmd: explicitly rename testnet to ropsten
* miner: explicitly rename testnet to ropsten
* mobile: allow for returning the goerli spec
* tests: explicitly rename testnet to ropsten
* docs: update readme to reflect changes to the default testnet
* mobile: allow for configuring goerli and rinkeby nodes
* cmd/geth: revert --testnet back to ropsten and mark as legacy
* cmd/util: mark --testnet flag as deprecated
* docs: update readme to properly reflect the 3 testnets
* cmd/utils: add an explicit deprecation warning on startup
* cmd/utils: swap goerli and ropsten in usage
* cmd/geth: swap goerli and ropsten in usage
* cmd/geth: if running a known preset, log it for convenience
* docs: improve readme on usage of ropsten's testnet datadir
* cmd/utils: check if legacy `testnet` datadir exists for ropsten
* cmd/geth: check for legacy testnet path in console command
* cmd/geth: use switch statement for complex conditions in main
* cmd/geth: move known preset log statement to the very top
* cmd/utils: create new ropsten configurations in the ropsten datadir
* cmd/utils: makedatadir should check for existing testnet dir
* cmd/geth: add legacy testnet flag to the copy db command
* cmd/geth: add legacy testnet flag to the inspect command
* les, les/lespay/client: add service value statistics and API (#20837)
This PR adds service value measurement statistics to the light client. It
also adds a private API that makes these statistics accessible. A follow-up
PR will add the new server pool which uses these statistics to select
servers with good performance.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
* README: update min go version to 1.13 (#20911)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2
* travis, appveyor: force GO111MODULE=on for every build
* core/rawdb: fix data race between Retrieve and Close (#20919)
* core/rawdb: fixed data race between retrieve and close
closes https://github.com/ethereum/go-ethereum/issues/20420
* core/rawdb: use non-atomic load while holding mutex
* all: simplify and fix database iteration with prefix/start (#20808)
* core/state/snapshot: start fixing disk iterator seek
* ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start
* les, core/state/snapshot: iterator fixes
* all: remove two iterator methods
* all: rename Iteratee.NewIteratorWith -> NewIterator
* ethdb: fix review concerns
* params: update CHTs for the 1.9.13 release
* params: release Geth v1.9.13
* added some missing files
* post-rebase fixups
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Co-authored-by: Ha ĐANG <dvietha@gmail.com>
Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Wenbiao Zheng <delweng@gmail.com>
Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com>
Co-authored-by: Jeff Wentworth <jeff@curvegrid.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Luke Champine <luke.champine@gmail.com>
Co-authored-by: Boqin Qin <Bobbqqin@gmail.com>
Co-authored-by: William Morriss <wjmelements@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
|
|
|
EthashDatasetsLockMmapFlag = cli.BoolFlag{
|
|
|
|
Name: "ethash.dagslockmmap",
|
|
|
|
Usage: "Lock memory maps for recent ethash mining DAGs",
|
|
|
|
}
|
2017-05-26 10:40:47 +00:00
|
|
|
// Transaction pool settings
|
2018-08-21 17:30:06 +00:00
|
|
|
TxPoolLocalsFlag = cli.StringFlag{
|
|
|
|
Name: "txpool.locals",
|
|
|
|
Usage: "Comma separated accounts to treat as locals (no flush, priority inclusion)",
|
|
|
|
}
|
2017-07-05 14:06:05 +00:00
|
|
|
TxPoolNoLocalsFlag = cli.BoolFlag{
|
|
|
|
Name: "txpool.nolocals",
|
|
|
|
Usage: "Disables price exemptions for locally submitted transactions",
|
|
|
|
}
|
2017-07-28 13:09:39 +00:00
|
|
|
TxPoolJournalFlag = cli.StringFlag{
|
|
|
|
Name: "txpool.journal",
|
|
|
|
Usage: "Disk journal for local transaction to survive node restarts",
|
|
|
|
Value: core.DefaultTxPoolConfig.Journal,
|
|
|
|
}
|
|
|
|
TxPoolRejournalFlag = cli.DurationFlag{
|
|
|
|
Name: "txpool.rejournal",
|
|
|
|
Usage: "Time interval to regenerate the local transaction journal",
|
|
|
|
Value: core.DefaultTxPoolConfig.Rejournal,
|
|
|
|
}
|
2017-05-26 10:40:47 +00:00
|
|
|
TxPoolPriceLimitFlag = cli.Uint64Flag{
|
|
|
|
Name: "txpool.pricelimit",
|
|
|
|
Usage: "Minimum gas price limit to enforce for acceptance into the pool",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.TxPool.PriceLimit,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
|
|
|
TxPoolPriceBumpFlag = cli.Uint64Flag{
|
|
|
|
Name: "txpool.pricebump",
|
|
|
|
Usage: "Price bump percentage to replace an already existing transaction",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.TxPool.PriceBump,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
|
|
|
TxPoolAccountSlotsFlag = cli.Uint64Flag{
|
|
|
|
Name: "txpool.accountslots",
|
|
|
|
Usage: "Minimum number of executable transaction slots guaranteed per account",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.TxPool.AccountSlots,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
|
|
|
TxPoolGlobalSlotsFlag = cli.Uint64Flag{
|
|
|
|
Name: "txpool.globalslots",
|
|
|
|
Usage: "Maximum number of executable transaction slots for all accounts",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.TxPool.GlobalSlots,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
|
|
|
TxPoolAccountQueueFlag = cli.Uint64Flag{
|
|
|
|
Name: "txpool.accountqueue",
|
|
|
|
Usage: "Maximum number of non-executable transaction slots permitted per account",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.TxPool.AccountQueue,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
|
|
|
TxPoolGlobalQueueFlag = cli.Uint64Flag{
|
|
|
|
Name: "txpool.globalqueue",
|
|
|
|
Usage: "Maximum number of non-executable transaction slots for all accounts",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.TxPool.GlobalQueue,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
|
|
|
TxPoolLifetimeFlag = cli.DurationFlag{
|
|
|
|
Name: "txpool.lifetime",
|
|
|
|
Usage: "Maximum amount of time non-executable transaction are queued",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.TxPool.Lifetime,
|
2017-05-26 10:40:47 +00:00
|
|
|
}
|
2015-10-29 17:53:24 +00:00
|
|
|
// Miner settings
|
|
|
|
MiningEnabledFlag = cli.BoolFlag{
|
|
|
|
Name: "mine",
|
|
|
|
Usage: "Enable mining",
|
2015-06-12 05:45:23 +00:00
|
|
|
}
|
2018-08-08 09:15:08 +00:00
|
|
|
MinerNotifyFlag = cli.StringFlag{
|
|
|
|
Name: "miner.notify",
|
|
|
|
Usage: "Comma separated HTTP URL list to notify of new work packages",
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2018-08-15 08:01:49 +00:00
|
|
|
MinerGasTargetFlag = cli.Uint64Flag{
|
|
|
|
Name: "miner.gastarget",
|
|
|
|
Usage: "Target gas floor for mined blocks",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.Miner.GasFloor,
|
2018-08-15 08:01:49 +00:00
|
|
|
}
|
2018-08-29 09:21:12 +00:00
|
|
|
MinerGasLimitFlag = cli.Uint64Flag{
|
|
|
|
Name: "miner.gaslimit",
|
|
|
|
Usage: "Target gas ceiling for mined blocks",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.Miner.GasCeil,
|
2016-03-01 22:32:43 +00:00
|
|
|
}
|
2018-08-15 08:01:49 +00:00
|
|
|
MinerGasPriceFlag = BigFlag{
|
|
|
|
Name: "miner.gasprice",
|
2018-09-10 12:22:34 +00:00
|
|
|
Usage: "Minimum gas price for mining a transaction",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.Miner.GasPrice,
|
2015-03-26 21:49:22 +00:00
|
|
|
}
|
2018-08-15 08:01:49 +00:00
|
|
|
MinerEtherbaseFlag = cli.StringFlag{
|
|
|
|
Name: "miner.etherbase",
|
2021-03-26 18:05:42 +00:00
|
|
|
Usage: "Public address for block mining rewards",
|
2018-08-15 08:01:49 +00:00
|
|
|
Value: "0",
|
|
|
|
}
|
2021-03-26 18:05:42 +00:00
|
|
|
MinerSigningKeyFlag = cli.StringFlag{
|
|
|
|
Name: "miner.sigkey",
|
|
|
|
Usage: "Private key to sign blocks with",
|
|
|
|
Value: "",
|
|
|
|
}
|
2018-08-15 08:01:49 +00:00
|
|
|
MinerExtraDataFlag = cli.StringFlag{
|
|
|
|
Name: "miner.extradata",
|
2015-10-29 17:53:24 +00:00
|
|
|
Usage: "Block extra data set by the miner (default = client version)",
|
2015-09-22 08:34:58 +00:00
|
|
|
}
|
2018-08-21 19:56:54 +00:00
|
|
|
MinerRecommitIntervalFlag = cli.DurationFlag{
|
|
|
|
Name: "miner.recommit",
|
2018-08-28 13:59:05 +00:00
|
|
|
Usage: "Time interval to recreate the block being mined",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.Miner.Recommit,
|
2018-08-21 19:56:54 +00:00
|
|
|
}
|
2018-08-28 13:59:05 +00:00
|
|
|
MinerNoVerfiyFlag = cli.BoolFlag{
|
|
|
|
Name: "miner.noverify",
|
|
|
|
Usage: "Disable remote sealing verification",
|
|
|
|
}
|
2017-01-17 11:19:50 +00:00
|
|
|
VMEnableDebugFlag = cli.BoolFlag{
|
|
|
|
Name: "vmdebug",
|
|
|
|
Usage: "Record information useful for VM and contract debugging",
|
|
|
|
}
|
2019-04-04 11:03:10 +00:00
|
|
|
InsecureUnlockAllowedFlag = cli.BoolFlag{
|
|
|
|
Name: "allow-insecure-unlock",
|
|
|
|
Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http",
|
|
|
|
}
|
2020-10-13 11:33:10 +00:00
|
|
|
RPCGlobalGasCapFlag = cli.Uint64Flag{
|
2019-04-08 11:49:52 +00:00
|
|
|
Name: "rpc.gascap",
|
2020-07-01 17:54:21 +00:00
|
|
|
Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.RPCGasCap,
|
2019-04-08 11:49:52 +00:00
|
|
|
}
|
2020-10-13 11:33:10 +00:00
|
|
|
RPCGlobalTxFeeCapFlag = cli.Float64Flag{
|
2020-06-17 07:46:31 +00:00
|
|
|
Name: "rpc.txfeecap",
|
|
|
|
Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.RPCTxFeeCap,
|
2020-06-17 07:46:31 +00:00
|
|
|
}
|
2016-11-25 15:55:06 +00:00
|
|
|
// Logging and debug settings
|
|
|
|
EthStatsURLFlag = cli.StringFlag{
|
|
|
|
Name: "ethstats",
|
|
|
|
Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)",
|
|
|
|
}
|
2016-04-21 09:14:57 +00:00
|
|
|
FakePoWFlag = cli.BoolFlag{
|
|
|
|
Name: "fakepow",
|
|
|
|
Usage: "Disables proof-of-work verification",
|
|
|
|
}
|
2015-03-06 02:00:41 +00:00
|
|
|
// RPC settings
|
2019-06-12 08:24:24 +00:00
|
|
|
IPCDisabledFlag = cli.BoolFlag{
|
|
|
|
Name: "ipcdisable",
|
|
|
|
Usage: "Disable the IPC-RPC server",
|
|
|
|
}
|
|
|
|
IPCPathFlag = DirectoryFlag{
|
|
|
|
Name: "ipcpath",
|
|
|
|
Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
|
|
|
|
}
|
2020-05-05 08:19:17 +00:00
|
|
|
HTTPEnabledFlag = cli.BoolFlag{
|
|
|
|
Name: "http",
|
2015-10-29 17:53:24 +00:00
|
|
|
Usage: "Enable the HTTP-RPC server",
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2020-05-05 08:19:17 +00:00
|
|
|
HTTPListenAddrFlag = cli.StringFlag{
|
|
|
|
Name: "http.addr",
|
2015-10-29 17:53:24 +00:00
|
|
|
Usage: "HTTP-RPC server listening interface",
|
2016-09-16 09:53:50 +00:00
|
|
|
Value: node.DefaultHTTPHost,
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2020-05-05 08:19:17 +00:00
|
|
|
HTTPPortFlag = cli.IntFlag{
|
|
|
|
Name: "http.port",
|
2015-10-29 17:53:24 +00:00
|
|
|
Usage: "HTTP-RPC server listening port",
|
2016-09-16 09:53:50 +00:00
|
|
|
Value: node.DefaultHTTPPort,
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2020-05-05 08:19:17 +00:00
|
|
|
HTTPCORSDomainFlag = cli.StringFlag{
|
|
|
|
Name: "http.corsdomain",
|
2016-02-24 10:19:00 +00:00
|
|
|
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
|
2015-03-29 19:21:14 +00:00
|
|
|
Value: "",
|
|
|
|
}
|
2020-05-05 08:19:17 +00:00
|
|
|
HTTPVirtualHostsFlag = cli.StringFlag{
|
|
|
|
Name: "http.vhosts",
|
2018-02-12 12:52:07 +00:00
|
|
|
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
|
2018-03-05 11:02:32 +00:00
|
|
|
Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
|
2018-02-12 12:52:07 +00:00
|
|
|
}
|
2020-05-05 08:19:17 +00:00
|
|
|
HTTPApiFlag = cli.StringFlag{
|
|
|
|
Name: "http.api",
|
2015-10-29 17:53:24 +00:00
|
|
|
Usage: "API's offered over the HTTP-RPC interface",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: "",
|
|
|
|
}
|
2021-02-02 09:05:46 +00:00
|
|
|
HTTPPathPrefixFlag = cli.StringFlag{
|
2021-03-12 17:26:06 +00:00
|
|
|
Name: "http.rpcprefix",
|
|
|
|
Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
|
2017-04-12 14:27:23 +00:00
|
|
|
Value: "",
|
2015-06-16 11:30:53 +00:00
|
|
|
}
|
2020-09-19 14:16:04 +00:00
|
|
|
TLSFlag = cli.BoolFlag{
|
|
|
|
Name: "tls",
|
|
|
|
Usage: "Enable TLS handshake",
|
2020-09-11 20:17:37 +00:00
|
|
|
}
|
|
|
|
TLSCertFlag = cli.StringFlag{
|
|
|
|
Name: "tls.cert",
|
2020-09-19 14:16:04 +00:00
|
|
|
Usage: "Specify certificate",
|
2020-09-11 20:17:37 +00:00
|
|
|
Value: "",
|
|
|
|
}
|
|
|
|
TLSKeyFlag = cli.StringFlag{
|
|
|
|
Name: "tls.key",
|
|
|
|
Usage: "Specify key file",
|
|
|
|
Value: "",
|
|
|
|
}
|
2020-09-19 14:16:04 +00:00
|
|
|
TLSCACertFlag = cli.StringFlag{
|
|
|
|
Name: "tls.cacert",
|
|
|
|
Usage: "Specify certificate authority",
|
|
|
|
Value: "",
|
|
|
|
}
|
2015-12-16 09:58:01 +00:00
|
|
|
WSEnabledFlag = cli.BoolFlag{
|
2016-01-26 13:39:21 +00:00
|
|
|
Name: "ws",
|
2015-12-16 09:58:01 +00:00
|
|
|
Usage: "Enable the WS-RPC server",
|
|
|
|
}
|
|
|
|
WSListenAddrFlag = cli.StringFlag{
|
2020-05-05 08:19:17 +00:00
|
|
|
Name: "ws.addr",
|
2015-12-16 09:58:01 +00:00
|
|
|
Usage: "WS-RPC server listening interface",
|
2016-09-16 09:53:50 +00:00
|
|
|
Value: node.DefaultWSHost,
|
2015-12-16 09:58:01 +00:00
|
|
|
}
|
|
|
|
WSPortFlag = cli.IntFlag{
|
2020-05-05 08:19:17 +00:00
|
|
|
Name: "ws.port",
|
2015-12-16 09:58:01 +00:00
|
|
|
Usage: "WS-RPC server listening port",
|
2016-09-16 09:53:50 +00:00
|
|
|
Value: node.DefaultWSPort,
|
2015-12-16 09:58:01 +00:00
|
|
|
}
|
|
|
|
WSApiFlag = cli.StringFlag{
|
2020-05-05 08:19:17 +00:00
|
|
|
Name: "ws.api",
|
2015-12-16 09:58:01 +00:00
|
|
|
Usage: "API's offered over the WS-RPC interface",
|
2017-04-12 14:27:23 +00:00
|
|
|
Value: "",
|
2015-12-16 09:58:01 +00:00
|
|
|
}
|
2016-03-14 08:38:54 +00:00
|
|
|
WSAllowedOriginsFlag = cli.StringFlag{
|
2020-05-05 08:19:17 +00:00
|
|
|
Name: "ws.origins",
|
2016-03-14 08:38:54 +00:00
|
|
|
Usage: "Origins from which to accept websockets requests",
|
2015-12-16 09:58:01 +00:00
|
|
|
Value: "",
|
2021-03-12 17:26:06 +00:00
|
|
|
}
|
2021-02-02 09:05:46 +00:00
|
|
|
WSPathPrefixFlag = cli.StringFlag{
|
2021-03-12 17:26:06 +00:00
|
|
|
Name: "ws.rpcprefix",
|
|
|
|
Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
|
|
|
|
Value: "",
|
2015-10-15 14:07:19 +00:00
|
|
|
}
|
2015-06-19 12:04:18 +00:00
|
|
|
ExecFlag = cli.StringFlag{
|
|
|
|
Name: "exec",
|
2017-05-03 10:26:09 +00:00
|
|
|
Usage: "Execute JavaScript statement",
|
2015-06-19 12:04:18 +00:00
|
|
|
}
|
2016-05-06 09:40:23 +00:00
|
|
|
PreloadJSFlag = cli.StringFlag{
|
2016-04-07 11:48:24 +00:00
|
|
|
Name: "preload",
|
|
|
|
Usage: "Comma separated list of JavaScript files to preload into the console",
|
|
|
|
}
|
2021-02-23 12:09:19 +00:00
|
|
|
AllowUnprotectedTxs = cli.BoolFlag{
|
|
|
|
Name: "rpc.allow-unprotected-txs",
|
|
|
|
Usage: "Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC",
|
|
|
|
}
|
2016-01-26 13:39:21 +00:00
|
|
|
|
2015-03-06 02:00:41 +00:00
|
|
|
// Network Settings
|
|
|
|
MaxPeersFlag = cli.IntFlag{
|
|
|
|
Name: "maxpeers",
|
2015-04-21 23:41:34 +00:00
|
|
|
Usage: "Maximum number of network peers (network disabled if set to 0)",
|
2019-04-25 09:54:33 +00:00
|
|
|
Value: node.DefaultConfig.P2P.MaxPeers,
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2015-05-04 14:35:49 +00:00
|
|
|
MaxPendingPeersFlag = cli.IntFlag{
|
|
|
|
Name: "maxpendpeers",
|
|
|
|
Usage: "Maximum number of pending connection attempts (defaults used if set to 0)",
|
2019-04-25 09:54:33 +00:00
|
|
|
Value: node.DefaultConfig.P2P.MaxPendingPeers,
|
2015-05-04 14:35:49 +00:00
|
|
|
}
|
2015-03-06 02:00:41 +00:00
|
|
|
ListenPortFlag = cli.IntFlag{
|
|
|
|
Name: "port",
|
|
|
|
Usage: "Network listening port",
|
|
|
|
Value: 30303,
|
|
|
|
}
|
2021-06-02 07:43:24 +00:00
|
|
|
ListenPort65Flag = cli.IntFlag{
|
2021-06-07 11:01:54 +00:00
|
|
|
Name: "p2p.eth65.port",
|
2021-06-02 07:43:24 +00:00
|
|
|
Usage: "ETH65 Network listening port",
|
|
|
|
Value: 30304,
|
|
|
|
}
|
2021-05-29 07:12:36 +00:00
|
|
|
SentryAddrFlag = cli.StringFlag{
|
2021-04-30 15:09:03 +00:00
|
|
|
Name: "sentry.api.addr",
|
|
|
|
Usage: "comma separated sentry addresses '<host>:<port>,<host>:<port>'",
|
|
|
|
}
|
2017-01-10 20:11:34 +00:00
|
|
|
BootnodesFlag = cli.StringFlag{
|
2015-03-06 02:00:41 +00:00
|
|
|
Name: "bootnodes",
|
2020-05-11 08:16:32 +00:00
|
|
|
Usage: "Comma separated enode URLs for P2P discovery bootstrap",
|
2017-01-10 20:11:34 +00:00
|
|
|
Value: "",
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2021-04-20 11:32:06 +00:00
|
|
|
StaticPeersFlag = cli.StringFlag{
|
|
|
|
Name: "staticpeers",
|
|
|
|
Usage: "Comma separated enode URLs to connect to",
|
|
|
|
Value: "",
|
|
|
|
}
|
2015-03-06 02:00:41 +00:00
|
|
|
NodeKeyFileFlag = cli.StringFlag{
|
|
|
|
Name: "nodekey",
|
|
|
|
Usage: "P2P node key file",
|
|
|
|
}
|
|
|
|
NodeKeyHexFlag = cli.StringFlag{
|
|
|
|
Name: "nodekeyhex",
|
|
|
|
Usage: "P2P node key as hex (for testing)",
|
|
|
|
}
|
|
|
|
NATFlag = cli.StringFlag{
|
2021-05-29 07:12:28 +00:00
|
|
|
Name: "nat",
|
|
|
|
Usage: `NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)
|
|
|
|
"" or "none" default - do not nat
|
|
|
|
"extip:77.12.33.4" will assume the local machine is reachable on the given IP
|
|
|
|
"any" uses the first auto-detected mechanism
|
|
|
|
"upnp" uses the Universal Plug and Play protocol
|
|
|
|
"pmp" uses NAT-PMP with an auto-detected gateway address
|
|
|
|
"pmp:192.168.0.1" uses NAT-PMP with the given gateway address
|
|
|
|
`,
|
|
|
|
Value: "",
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2015-05-26 16:07:24 +00:00
|
|
|
NoDiscoverFlag = cli.BoolFlag{
|
|
|
|
Name: "nodiscover",
|
|
|
|
Usage: "Disables the peer discovery mechanism (manual peer addition)",
|
|
|
|
}
|
2016-10-19 11:04:55 +00:00
|
|
|
DiscoveryV5Flag = cli.BoolFlag{
|
|
|
|
Name: "v5disc",
|
|
|
|
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
|
|
|
|
}
|
2016-11-22 19:52:31 +00:00
|
|
|
NetrestrictFlag = cli.StringFlag{
|
|
|
|
Name: "netrestrict",
|
|
|
|
Usage: "Restricts network communication to the given IP networks (CIDR masks)",
|
|
|
|
}
|
2020-02-13 13:38:30 +00:00
|
|
|
DNSDiscoveryFlag = cli.StringFlag{
|
|
|
|
Name: "discovery.dns",
|
|
|
|
Usage: "Sets DNS discovery entry points (use \"\" to disable DNS)",
|
|
|
|
}
|
2016-11-22 19:52:31 +00:00
|
|
|
|
2015-04-22 22:11:11 +00:00
|
|
|
// ATM the url is left to the user and deployment to
|
2015-03-15 06:31:40 +00:00
|
|
|
JSpathFlag = cli.StringFlag{
|
|
|
|
Name: "jspath",
|
2016-11-25 11:31:06 +00:00
|
|
|
Usage: "JavaScript root path for `loadScript`",
|
2015-03-15 06:31:40 +00:00
|
|
|
Value: ".",
|
|
|
|
}
|
2015-10-29 17:53:24 +00:00
|
|
|
|
|
|
|
// Gas price oracle settings
|
2017-04-06 14:20:42 +00:00
|
|
|
GpoBlocksFlag = cli.IntFlag{
|
2020-05-05 08:19:17 +00:00
|
|
|
Name: "gpo.blocks",
|
2017-04-06 14:20:42 +00:00
|
|
|
Usage: "Number of recent blocks to check for gas prices",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.GPO.Blocks,
|
2015-05-26 12:17:43 +00:00
|
|
|
}
|
2017-04-06 14:20:42 +00:00
|
|
|
GpoPercentileFlag = cli.IntFlag{
|
2020-05-05 08:19:17 +00:00
|
|
|
Name: "gpo.percentile",
|
2017-04-06 14:20:42 +00:00
|
|
|
Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.GPO.Percentile,
|
2015-05-26 12:17:43 +00:00
|
|
|
}
|
2020-10-06 09:29:59 +00:00
|
|
|
GpoMaxGasPriceFlag = cli.Int64Flag{
|
|
|
|
Name: "gpo.maxprice",
|
|
|
|
Usage: "Maximum gas price will be recommended by gpo",
|
2021-03-12 17:26:06 +00:00
|
|
|
Value: ethconfig.Defaults.GPO.MaxPrice.Int64(),
|
2020-10-06 09:29:59 +00:00
|
|
|
}
|
2018-07-02 12:51:02 +00:00
|
|
|
|
|
|
|
// Metrics flags
|
|
|
|
MetricsEnabledFlag = cli.BoolFlag{
|
2019-03-25 08:01:18 +00:00
|
|
|
Name: "metrics",
|
2018-07-02 12:51:02 +00:00
|
|
|
Usage: "Enable metrics collection and reporting",
|
|
|
|
}
|
2019-03-25 08:01:18 +00:00
|
|
|
MetricsEnabledExpensiveFlag = cli.BoolFlag{
|
|
|
|
Name: "metrics.expensive",
|
|
|
|
Usage: "Enable expensive metrics collection and reporting",
|
|
|
|
}
|
2020-07-03 17:12:22 +00:00
|
|
|
|
|
|
|
// MetricsHTTPFlag defines the endpoint for a stand-alone metrics HTTP endpoint.
|
|
|
|
// Since the pprof service enables sensitive/vulnerable behavior, this allows a user
|
|
|
|
// to enable a public-OK metrics endpoint without having to worry about ALSO exposing
|
|
|
|
// other profiling behavior or information.
|
|
|
|
MetricsHTTPFlag = cli.StringFlag{
|
|
|
|
Name: "metrics.addr",
|
|
|
|
Usage: "Enable stand-alone metrics HTTP server listening interface",
|
2021-01-18 13:36:05 +00:00
|
|
|
Value: metrics.DefaultConfig.HTTP,
|
2020-07-03 17:12:22 +00:00
|
|
|
}
|
|
|
|
MetricsPortFlag = cli.IntFlag{
|
|
|
|
Name: "metrics.port",
|
|
|
|
Usage: "Metrics HTTP server listening port",
|
2021-01-18 13:36:05 +00:00
|
|
|
Value: metrics.DefaultConfig.Port,
|
2020-07-03 17:12:22 +00:00
|
|
|
}
|
2021-04-19 21:58:05 +00:00
|
|
|
|
|
|
|
CliqueSnapshotCheckpointIntervalFlag = cli.UintFlag{
|
|
|
|
Name: "clique.checkpoint",
|
|
|
|
Usage: "number of blocks after which to save the vote snapshot to the database",
|
|
|
|
Value: 10,
|
|
|
|
}
|
|
|
|
CliqueSnapshotInmemorySnapshotsFlag = cli.IntFlag{
|
|
|
|
Name: "clique.snapshots",
|
|
|
|
Usage: "number of recent vote snapshots to keep in memory",
|
|
|
|
Value: 1024,
|
|
|
|
}
|
|
|
|
CliqueSnapshotInmemorySignaturesFlag = cli.IntFlag{
|
|
|
|
Name: "clique.signatures",
|
|
|
|
Usage: "number of recent block signatures to keep in memory",
|
|
|
|
Value: 16384,
|
|
|
|
}
|
|
|
|
CliqueDataDirFlag = DirectoryFlag{
|
|
|
|
Name: "clique.datadir",
|
|
|
|
Usage: "a path to clique db folder",
|
|
|
|
Value: "",
|
|
|
|
}
|
2015-03-06 02:00:41 +00:00
|
|
|
)
|
|
|
|
|
2020-08-19 11:46:20 +00:00
|
|
|
var MetricFlags = []cli.Flag{MetricsEnabledFlag, MetricsEnabledExpensiveFlag, MetricsHTTPFlag, MetricsPortFlag}
|
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
// setNodeKey creates a node key from set command line flags, either loading it
|
2015-11-17 16:33:25 +00:00
|
|
|
// 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.
|
2021-06-11 08:34:37 +00:00
|
|
|
func setNodeKey(ctx *cli.Context, cfg *p2p.Config, nodeName, dataDir string) {
|
|
|
|
cfg.Name = nodeName
|
2015-11-17 16:33:25 +00:00
|
|
|
var (
|
|
|
|
hex = ctx.GlobalString(NodeKeyHexFlag.Name)
|
|
|
|
file = ctx.GlobalString(NodeKeyFileFlag.Name)
|
2017-04-12 14:27:23 +00:00
|
|
|
key *ecdsa.PrivateKey
|
|
|
|
err error
|
2015-11-17 16:33:25 +00:00
|
|
|
)
|
2015-03-06 02:00:41 +00:00
|
|
|
switch {
|
|
|
|
case file != "" && hex != "":
|
2017-02-22 15:22:50 +00:00
|
|
|
Fatalf("Options %q and %q are mutually exclusive", NodeKeyFileFlag.Name, NodeKeyHexFlag.Name)
|
2015-03-06 02:00:41 +00:00
|
|
|
case file != "":
|
2021-06-14 06:35:22 +00:00
|
|
|
if err := os.MkdirAll(path.Dir(file), 0755); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2015-03-06 02:00:41 +00:00
|
|
|
if key, err = crypto.LoadECDSA(file); err != nil {
|
2017-02-22 15:22:50 +00:00
|
|
|
Fatalf("Option %q: %v", NodeKeyFileFlag.Name, err)
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
cfg.PrivateKey = key
|
2015-03-06 02:00:41 +00:00
|
|
|
case hex != "":
|
|
|
|
if key, err = crypto.HexToECDSA(hex); err != nil {
|
2017-02-22 15:22:50 +00:00
|
|
|
Fatalf("Option %q: %v", NodeKeyHexFlag.Name, err)
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
cfg.PrivateKey = key
|
2021-06-11 08:34:37 +00:00
|
|
|
default:
|
|
|
|
cfg.PrivateKey = nodeKey(path.Join(dataDir, "erigon", "nodekey"))
|
2015-03-06 02:00:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
// setNodeUserIdent creates the user identifier from CLI flags.
|
|
|
|
func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) {
|
2015-11-17 16:33:25 +00:00
|
|
|
if identity := ctx.GlobalString(IdentityFlag.Name); len(identity) > 0 {
|
2017-04-12 14:27:23 +00:00
|
|
|
cfg.UserIdent = identity
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-23 09:00:07 +00:00
|
|
|
func setNodeUserIdentCobra(f *pflag.FlagSet, cfg *node.Config) {
|
|
|
|
if identity := f.String(IdentityFlag.Name, IdentityFlag.Value, IdentityFlag.Usage); identity != nil && len(*identity) > 0 {
|
|
|
|
cfg.UserIdent = *identity
|
|
|
|
}
|
|
|
|
}
|
2015-11-17 16:33:25 +00:00
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
// setBootstrapNodes creates a list of bootstrap nodes from the command line
|
2015-11-17 16:33:25 +00:00
|
|
|
// flags, reverting to pre-configured ones if none have been specified.
|
2017-04-12 14:27:23 +00:00
|
|
|
func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
2017-01-05 12:56:06 +00:00
|
|
|
urls := params.MainnetBootnodes
|
2021-04-08 07:39:40 +00:00
|
|
|
if ctx.GlobalIsSet(BootnodesFlag.Name) {
|
2021-03-26 02:08:01 +00:00
|
|
|
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
2021-04-08 07:39:40 +00:00
|
|
|
} else {
|
|
|
|
chain := ctx.GlobalString(ChainFlag.Name)
|
|
|
|
switch chain {
|
|
|
|
case params.RopstenChainName:
|
|
|
|
urls = params.RopstenBootnodes
|
|
|
|
case params.RinkebyChainName:
|
|
|
|
urls = params.RinkebyBootnodes
|
|
|
|
case params.GoerliChainName:
|
|
|
|
urls = params.GoerliBootnodes
|
2021-05-26 10:35:39 +00:00
|
|
|
case params.ErigonMineName:
|
|
|
|
urls = params.ErigonBootnodes
|
2021-06-02 07:42:52 +00:00
|
|
|
case params.CalaverasChainName:
|
|
|
|
urls = params.CalaverasBootnodes
|
2021-06-07 11:01:54 +00:00
|
|
|
case params.SokolChainName:
|
|
|
|
urls = params.SokolBootnodes
|
2021-04-08 07:39:40 +00:00
|
|
|
default:
|
|
|
|
if cfg.BootstrapNodes != nil {
|
|
|
|
return // already set, don't apply defaults.
|
|
|
|
}
|
|
|
|
}
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
|
|
|
|
all: new p2p node representation (#17643)
Package p2p/enode provides a generalized representation of p2p nodes
which can contain arbitrary information in key/value pairs. It is also
the new home for the node database. The "v4" identity scheme is also
moved here from p2p/enr to remove the dependency on Ethereum crypto from
that package.
Record signature handling is changed significantly. The identity scheme
registry is removed and acceptable schemes must be passed to any method
that needs identity. This means records must now be validated explicitly
after decoding.
The enode API is designed to make signature handling easy and safe: most
APIs around the codebase work with enode.Node, which is a wrapper around
a valid record. Going from enr.Record to enode.Node requires a valid
signature.
* p2p/discover: port to p2p/enode
This ports the discovery code to the new node representation in
p2p/enode. The wire protocol is unchanged, this can be considered a
refactoring change. The Kademlia table can now deal with nodes using an
arbitrary identity scheme. This requires a few incompatible API changes:
- Table.Lookup is not available anymore. It used to take a public key
as argument because v4 protocol requires one. Its replacement is
LookupRandom.
- Table.Resolve takes *enode.Node instead of NodeID. This is also for
v4 protocol compatibility because nodes cannot be looked up by ID
alone.
- Types Node and NodeID are gone. Further commits in the series will be
fixes all over the the codebase to deal with those removals.
* p2p: port to p2p/enode and discovery changes
This adapts package p2p to the changes in p2p/discover. All uses of
discover.Node and discover.NodeID are replaced by their equivalents from
p2p/enode.
New API is added to retrieve the enode.Node instance of a peer. The
behavior of Server.Self with discovery disabled is improved. It now
tries much harder to report a working IP address, falling back to
127.0.0.1 if no suitable address can be determined through other means.
These changes were needed for tests of other packages later in the
series.
* p2p/simulations, p2p/testing: port to p2p/enode
No surprises here, mostly replacements of discover.Node, discover.NodeID
with their new equivalents. The 'interesting' API changes are:
- testing.ProtocolSession tracks complete nodes, not just their IDs.
- adapters.NodeConfig has a new method to create a complete node.
These changes were needed to make swarm tests work.
Note that the NodeID change makes the code incompatible with old
simulation snapshots.
* whisper/whisperv5, whisper/whisperv6: port to p2p/enode
This port was easy because whisper uses []byte for node IDs and
URL strings in the API.
* eth: port to p2p/enode
Again, easy to port because eth uses strings for node IDs and doesn't
care about node information in any way.
* les: port to p2p/enode
Apart from replacing discover.NodeID with enode.ID, most changes are in
the server pool code. It now deals with complete nodes instead
of (Pubkey, IP, Port) triples. The database format is unchanged for now,
but we should probably change it to use the node database later.
* node: port to p2p/enode
This change simply replaces discover.Node and discover.NodeID with their
new equivalents.
* swarm/network: port to p2p/enode
Swarm has its own node address representation, BzzAddr, containing both
an overlay address (the hash of a secp256k1 public key) and an underlay
address (enode:// URL).
There are no changes to the BzzAddr format in this commit, but certain
operations such as creating a BzzAddr from a node ID are now impossible
because node IDs aren't public keys anymore.
Most swarm-related changes in the series remove uses of
NewAddrFromNodeID, replacing it with NewAddr which takes a complete node
as argument. ToOverlayAddr is removed because we can just use the node
ID directly.
2018-09-24 22:59:00 +00:00
|
|
|
cfg.BootstrapNodes = make([]*enode.Node, 0, len(urls))
|
2017-01-05 12:56:06 +00:00
|
|
|
for _, url := range urls {
|
2019-01-24 12:02:30 +00:00
|
|
|
if url != "" {
|
2019-06-07 13:31:00 +00:00
|
|
|
node, err := enode.Parse(enode.ValidSchemes, url)
|
2019-01-24 12:02:30 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Crit("Bootstrap URL invalid", "enode", url, "err", err)
|
2019-03-15 05:20:21 +00:00
|
|
|
continue
|
2019-01-24 12:02:30 +00:00
|
|
|
}
|
|
|
|
cfg.BootstrapNodes = append(cfg.BootstrapNodes, node)
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
// setBootstrapNodesV5 creates a list of bootstrap nodes from the command line
|
2016-11-09 14:35:04 +00:00
|
|
|
// flags, reverting to pre-configured ones if none have been specified.
|
2017-04-12 14:27:23 +00:00
|
|
|
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
2020-05-11 08:16:32 +00:00
|
|
|
urls := params.MainnetBootnodes
|
2021-04-08 07:39:40 +00:00
|
|
|
if ctx.GlobalIsSet(BootnodesFlag.Name) {
|
2021-03-26 02:08:01 +00:00
|
|
|
urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
|
2021-04-08 07:39:40 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
chain := ctx.GlobalString(ChainFlag.Name)
|
|
|
|
switch chain {
|
|
|
|
case params.RopstenChainName:
|
|
|
|
urls = params.RopstenBootnodes
|
|
|
|
case params.RinkebyChainName:
|
|
|
|
urls = params.RinkebyBootnodes
|
|
|
|
case params.GoerliChainName:
|
|
|
|
urls = params.GoerliBootnodes
|
2021-05-26 10:35:39 +00:00
|
|
|
case params.ErigonMineName:
|
|
|
|
urls = params.ErigonBootnodes
|
2021-06-02 07:42:52 +00:00
|
|
|
case params.CalaverasChainName:
|
|
|
|
urls = params.CalaverasBootnodes
|
2021-06-07 11:01:54 +00:00
|
|
|
case params.SokolChainName:
|
|
|
|
urls = params.SokolBootnodes
|
2021-04-08 07:39:40 +00:00
|
|
|
default:
|
|
|
|
if cfg.BootstrapNodesV5 != nil {
|
|
|
|
return // already set, don't apply defaults.
|
|
|
|
}
|
|
|
|
}
|
2016-11-09 14:35:04 +00:00
|
|
|
}
|
|
|
|
|
2021-03-12 17:26:06 +00:00
|
|
|
cfg.BootstrapNodesV5 = make([]*enode.Node, 0, len(urls))
|
2017-01-05 12:56:06 +00:00
|
|
|
for _, url := range urls {
|
2019-03-15 05:20:21 +00:00
|
|
|
if url != "" {
|
2021-03-12 17:26:06 +00:00
|
|
|
node, err := enode.Parse(enode.ValidSchemes, url)
|
2019-03-15 05:20:21 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Error("Bootstrap URL invalid", "enode", url, "err", err)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
cfg.BootstrapNodesV5 = append(cfg.BootstrapNodesV5, node)
|
2016-11-09 14:35:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-20 11:32:06 +00:00
|
|
|
func setStaticPeers(ctx *cli.Context, cfg *p2p.Config) {
|
|
|
|
if !ctx.GlobalIsSet(StaticPeersFlag.Name) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
urls := SplitAndTrim(ctx.GlobalString(StaticPeersFlag.Name))
|
2021-06-11 08:34:37 +00:00
|
|
|
err := SetStaticPeers(cfg, urls)
|
|
|
|
if err != nil {
|
|
|
|
log.Error("setStaticPeers", "err", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetStaticPeers(cfg *p2p.Config, urls []string) error {
|
2021-04-20 11:32:06 +00:00
|
|
|
for _, url := range urls {
|
2021-06-11 08:34:37 +00:00
|
|
|
if url == "" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
node, err := enode.Parse(enode.ValidSchemes, url)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("static peer URL invalid: %s, %w", url, err)
|
2021-04-20 11:32:06 +00:00
|
|
|
}
|
2021-06-11 08:34:37 +00:00
|
|
|
cfg.StaticNodes = append(cfg.StaticNodes, node)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewP2PConfig
|
|
|
|
// - doesn't setup bootnodes - they will set when genesisHash will know
|
|
|
|
func NewP2PConfig(nodiscover bool, datadir, netRestrict, natSetting, nodeName string, staticPeers []string, port, protocol uint) (*p2p.Config, error) {
|
|
|
|
var enodeDBPath string
|
|
|
|
switch protocol {
|
|
|
|
case eth.ETH65:
|
|
|
|
enodeDBPath = path.Join(datadir, "nodes", "eth65")
|
|
|
|
case eth.ETH66:
|
|
|
|
enodeDBPath = path.Join(datadir, "nodes", "eth66")
|
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("unknown protocol: %v", protocol)
|
|
|
|
}
|
|
|
|
serverKey := nodeKey(path.Join(datadir, "erigon", "nodekey"))
|
|
|
|
|
|
|
|
cfg := &p2p.Config{
|
|
|
|
ListenAddr: fmt.Sprintf(":%d", port),
|
|
|
|
MaxPeers: 100,
|
|
|
|
NAT: nat.Any(),
|
|
|
|
NoDiscovery: nodiscover,
|
|
|
|
PrivateKey: serverKey,
|
|
|
|
Name: nodeName,
|
|
|
|
Logger: log.New(),
|
|
|
|
NodeDatabase: enodeDBPath,
|
|
|
|
}
|
|
|
|
if netRestrict != "" {
|
|
|
|
cfg.NetRestrict = new(netutil.Netlist)
|
|
|
|
cfg.NetRestrict.Add(netRestrict)
|
|
|
|
}
|
|
|
|
if staticPeers != nil {
|
|
|
|
if err := SetStaticPeers(cfg, staticPeers); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
natif, err := nat.Parse(natSetting)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("invalid nat option %s: %v", natSetting, err)
|
|
|
|
}
|
|
|
|
cfg.NAT = natif
|
|
|
|
return cfg, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func nodeKey(keyfile string) *ecdsa.PrivateKey {
|
2021-06-14 06:35:22 +00:00
|
|
|
if err := os.MkdirAll(path.Dir(keyfile), 0755); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-11 08:34:37 +00:00
|
|
|
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.Crit(fmt.Sprintf("Failed to generate node key: %v", err))
|
|
|
|
}
|
|
|
|
if err := crypto.SaveECDSA(keyfile, key); err != nil {
|
|
|
|
log.Error(fmt.Sprintf("Failed to persist node key: %v", err))
|
2021-04-20 11:32:06 +00:00
|
|
|
}
|
2021-06-11 08:34:37 +00:00
|
|
|
return key
|
2021-04-20 11:32:06 +00:00
|
|
|
}
|
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
// setListenAddress creates a TCP listening address string from set command
|
2015-11-17 16:33:25 +00:00
|
|
|
// line flags.
|
2017-04-12 14:27:23 +00:00
|
|
|
func setListenAddress(ctx *cli.Context, cfg *p2p.Config) {
|
|
|
|
if ctx.GlobalIsSet(ListenPortFlag.Name) {
|
|
|
|
cfg.ListenAddr = fmt.Sprintf(":%d", ctx.GlobalInt(ListenPortFlag.Name))
|
|
|
|
}
|
2021-06-02 07:43:24 +00:00
|
|
|
if ctx.GlobalIsSet(ListenPort65Flag.Name) {
|
|
|
|
cfg.ListenAddr65 = fmt.Sprintf(":%d", ctx.GlobalInt(ListenPort65Flag.Name))
|
|
|
|
}
|
2021-04-30 15:09:03 +00:00
|
|
|
if ctx.GlobalIsSet(SentryAddrFlag.Name) {
|
2021-05-29 07:12:36 +00:00
|
|
|
cfg.SentryAddr = SplitAndTrim(ctx.GlobalString(SentryAddrFlag.Name))
|
2021-04-30 15:09:03 +00:00
|
|
|
}
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
// setNAT creates a port mapper from command line flags.
|
|
|
|
func setNAT(ctx *cli.Context, cfg *p2p.Config) {
|
|
|
|
if ctx.GlobalIsSet(NATFlag.Name) {
|
|
|
|
natif, err := nat.Parse(ctx.GlobalString(NATFlag.Name))
|
|
|
|
if err != nil {
|
|
|
|
Fatalf("Option %s: %v", NATFlag.Name, err)
|
|
|
|
}
|
|
|
|
cfg.NAT = natif
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-22 21:22:54 +00:00
|
|
|
// SplitAndTrim splits input separated by a comma
|
2017-04-12 21:04:14 +00:00
|
|
|
// and trims excessive white space from the substrings.
|
2020-09-22 21:22:54 +00:00
|
|
|
func SplitAndTrim(input string) (ret []string) {
|
2020-07-06 20:09:30 +00:00
|
|
|
l := strings.Split(input, ",")
|
|
|
|
for _, r := range l {
|
2020-09-22 21:22:54 +00:00
|
|
|
if r = strings.TrimSpace(r); r != "" {
|
2020-07-06 20:09:30 +00:00
|
|
|
ret = append(ret, r)
|
|
|
|
}
|
2016-04-14 14:18:35 +00:00
|
|
|
}
|
2020-07-06 20:09:30 +00:00
|
|
|
return ret
|
2016-04-14 14:18:35 +00:00
|
|
|
}
|
|
|
|
|
2021-03-26 18:05:42 +00:00
|
|
|
// setEtherbase retrieves the etherbase from the directly specified
|
|
|
|
// command line flags.
|
2021-03-30 07:09:00 +00:00
|
|
|
func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) {
|
2021-03-26 18:05:42 +00:00
|
|
|
if ctx.GlobalIsSet(MinerSigningKeyFlag.Name) {
|
|
|
|
sigkey := ctx.GlobalString(MinerSigningKeyFlag.Name)
|
|
|
|
if sigkey != "" {
|
|
|
|
var err error
|
|
|
|
cfg.Miner.SigKey, err = crypto.HexToECDSA(sigkey)
|
accounts, eth, clique, signer: support for external signer API (#18079)
* accounts, eth, clique: implement external backend + move sighash calc to backend
* signer: implement account_Version on external API
* accounts/external: enable ipc, add copyright
* accounts, internal, signer: formatting
* node: go fmt
* flags: disallow --dev in combo with --externalsigner
* accounts: remove clique-specific signing method, replace with more generic
* accounts, consensus: formatting + fix error in tests
* signer/core: remove (test-) import cycle
* clique: remove unused import
* accounts: remove CliqueHash and avoid dependency on package crypto
* consensus/clique: unduplicate header encoding
2019-02-05 10:23:57 +00:00
|
|
|
if err != nil {
|
2021-03-26 18:05:42 +00:00
|
|
|
Fatalf("Failed to parse ECDSA private key: %v", err)
|
accounts, eth, clique, signer: support for external signer API (#18079)
* accounts, eth, clique: implement external backend + move sighash calc to backend
* signer: implement account_Version on external API
* accounts/external: enable ipc, add copyright
* accounts, internal, signer: formatting
* node: go fmt
* flags: disallow --dev in combo with --externalsigner
* accounts: remove clique-specific signing method, replace with more generic
* accounts, consensus: formatting + fix error in tests
* signer/core: remove (test-) import cycle
* clique: remove unused import
* accounts: remove CliqueHash and avoid dependency on package crypto
* consensus/clique: unduplicate header encoding
2019-02-05 10:23:57 +00:00
|
|
|
}
|
2021-03-26 18:05:42 +00:00
|
|
|
cfg.Miner.Etherbase = crypto.PubkeyToAddress(cfg.Miner.SigKey.PublicKey)
|
|
|
|
}
|
|
|
|
} else if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
|
|
|
|
etherbase := ctx.GlobalString(MinerEtherbaseFlag.Name)
|
|
|
|
if etherbase != "" {
|
|
|
|
cfg.Miner.Etherbase = common.HexToAddress(etherbase)
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
2015-07-07 10:53:36 +00:00
|
|
|
}
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
|
|
|
|
2021-06-10 01:53:06 +00:00
|
|
|
func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config, nodeName, dataDir string) {
|
2021-06-11 08:34:37 +00:00
|
|
|
setNodeKey(ctx, cfg, nodeName, dataDir)
|
2017-04-12 14:27:23 +00:00
|
|
|
setNAT(ctx, cfg)
|
|
|
|
setListenAddress(ctx, cfg)
|
|
|
|
setBootstrapNodes(ctx, cfg)
|
|
|
|
setBootstrapNodesV5(ctx, cfg)
|
2021-04-20 11:32:06 +00:00
|
|
|
setStaticPeers(ctx, cfg)
|
2017-04-12 14:27:23 +00:00
|
|
|
|
2021-06-13 20:14:52 +00:00
|
|
|
if ctx.GlobalIsSet(MaxPeersFlag.Name) {
|
|
|
|
cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name)
|
|
|
|
}
|
2018-02-05 13:41:53 +00:00
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
if ctx.GlobalIsSet(MaxPendingPeersFlag.Name) {
|
|
|
|
cfg.MaxPendingPeers = ctx.GlobalInt(MaxPendingPeersFlag.Name)
|
|
|
|
}
|
2021-03-26 02:08:01 +00:00
|
|
|
if ctx.GlobalIsSet(NoDiscoverFlag.Name) {
|
2017-04-12 14:27:23 +00:00
|
|
|
cfg.NoDiscovery = true
|
2016-09-05 11:08:41 +00:00
|
|
|
}
|
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
if ctx.GlobalIsSet(DiscoveryV5Flag.Name) {
|
|
|
|
cfg.DiscoveryV5 = ctx.GlobalBool(DiscoveryV5Flag.Name)
|
2016-08-15 16:38:32 +00:00
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
|
2021-06-13 20:14:52 +00:00
|
|
|
ethPeers := cfg.MaxPeers
|
|
|
|
cfg.Name = nodeName
|
|
|
|
log.Info("Maximum peer count", "ETH", ethPeers, "total", cfg.MaxPeers)
|
|
|
|
|
2016-11-22 19:52:31 +00:00
|
|
|
if netrestrict := ctx.GlobalString(NetrestrictFlag.Name); netrestrict != "" {
|
|
|
|
list, err := netutil.ParseNetlist(netrestrict)
|
|
|
|
if err != nil {
|
2017-02-22 15:22:50 +00:00
|
|
|
Fatalf("Option %q: %v", NetrestrictFlag.Name, err)
|
2016-11-22 19:52:31 +00:00
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
cfg.NetRestrict = list
|
2016-11-22 19:52:31 +00:00
|
|
|
}
|
|
|
|
|
2021-04-08 07:39:40 +00:00
|
|
|
if ctx.GlobalString(ChainFlag.Name) == params.DevChainName {
|
2017-04-12 14:27:23 +00:00
|
|
|
// --dev mode can't use p2p networking.
|
|
|
|
cfg.MaxPeers = 0
|
|
|
|
cfg.ListenAddr = ":0"
|
|
|
|
cfg.NoDiscovery = true
|
|
|
|
cfg.DiscoveryV5 = false
|
2016-08-15 16:38:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
// SetNodeConfig applies node-related command line flags to the config.
|
|
|
|
func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
2018-11-23 00:32:34 +00:00
|
|
|
setDataDir(ctx, cfg)
|
2021-06-10 01:53:06 +00:00
|
|
|
setNodeUserIdent(ctx, cfg)
|
|
|
|
SetP2PConfig(ctx, &cfg.P2P, cfg.NodeName(), cfg.DataDir)
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
2021-04-30 15:09:03 +00:00
|
|
|
|
2021-03-23 09:00:07 +00:00
|
|
|
func SetNodeConfigCobra(cmd *cobra.Command, cfg *node.Config) {
|
|
|
|
flags := cmd.Flags()
|
|
|
|
//SetP2PConfig(ctx, &cfg.P2P)
|
|
|
|
setNodeUserIdentCobra(flags, cfg)
|
|
|
|
setDataDirCobra(flags, cfg)
|
|
|
|
}
|
2019-05-31 09:30:28 +00:00
|
|
|
|
2021-04-19 07:25:26 +00:00
|
|
|
func DataDirForNetwork(datadir string, network string) string {
|
2021-04-19 21:58:05 +00:00
|
|
|
if datadir != paths.DefaultDataDir() {
|
2021-04-19 07:25:26 +00:00
|
|
|
return datadir
|
|
|
|
}
|
|
|
|
|
|
|
|
switch network {
|
|
|
|
case params.DevChainName:
|
|
|
|
return "" // unless explicitly requested, use memory databases
|
|
|
|
case params.RinkebyChainName:
|
|
|
|
return filepath.Join(datadir, "rinkeby")
|
|
|
|
case params.GoerliChainName:
|
|
|
|
filepath.Join(datadir, "goerli")
|
2021-06-02 07:42:52 +00:00
|
|
|
case params.CalaverasChainName:
|
|
|
|
return filepath.Join(datadir, "calaveras")
|
2021-06-07 11:01:54 +00:00
|
|
|
case params.SokolChainName:
|
|
|
|
return filepath.Join(datadir, "sokol")
|
2021-04-19 07:25:26 +00:00
|
|
|
default:
|
|
|
|
return datadir
|
|
|
|
}
|
|
|
|
|
|
|
|
return datadir
|
|
|
|
}
|
|
|
|
|
2018-11-23 00:32:34 +00:00
|
|
|
func setDataDir(ctx *cli.Context, cfg *node.Config) {
|
2021-04-08 07:39:40 +00:00
|
|
|
if ctx.GlobalIsSet(DataDirFlag.Name) {
|
2018-11-23 00:32:34 +00:00
|
|
|
cfg.DataDir = ctx.GlobalString(DataDirFlag.Name)
|
2021-04-08 07:39:40 +00:00
|
|
|
} else {
|
2021-04-19 07:25:26 +00:00
|
|
|
cfg.DataDir = DataDirForNetwork(cfg.DataDir, ctx.GlobalString(ChainFlag.Name))
|
2018-11-23 00:32:34 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-08 07:39:40 +00:00
|
|
|
|
2021-03-23 09:00:07 +00:00
|
|
|
func setDataDirCobra(f *pflag.FlagSet, cfg *node.Config) {
|
|
|
|
dirname, err := f.GetString(DataDirFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 18:54:41 +00:00
|
|
|
chain, err := f.GetString(ChainFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-04-08 07:39:40 +00:00
|
|
|
if dirname != "" {
|
2021-03-23 09:00:07 +00:00
|
|
|
cfg.DataDir = dirname
|
2021-06-21 18:54:41 +00:00
|
|
|
} else {
|
|
|
|
cfg.DataDir = DataDirForNetwork(cfg.DataDir, chain)
|
2021-03-23 09:00:07 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-23 00:32:34 +00:00
|
|
|
|
2021-03-26 02:08:01 +00:00
|
|
|
func setGPO(ctx *cli.Context, cfg *gasprice.Config) {
|
2017-04-12 14:27:23 +00:00
|
|
|
if ctx.GlobalIsSet(GpoBlocksFlag.Name) {
|
|
|
|
cfg.Blocks = ctx.GlobalInt(GpoBlocksFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(GpoPercentileFlag.Name) {
|
|
|
|
cfg.Percentile = ctx.GlobalInt(GpoPercentileFlag.Name)
|
|
|
|
}
|
2020-09-09 15:38:47 +00:00
|
|
|
if ctx.GlobalIsSet(GpoMaxGasPriceFlag.Name) {
|
|
|
|
cfg.MaxPrice = big.NewInt(ctx.GlobalInt64(GpoMaxGasPriceFlag.Name))
|
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
|
|
|
|
2021-03-23 09:00:07 +00:00
|
|
|
//nolint
|
2021-03-26 02:08:01 +00:00
|
|
|
func setGPOCobra(f *pflag.FlagSet, cfg *gasprice.Config) {
|
2021-03-23 09:00:07 +00:00
|
|
|
if v := f.Int(GpoBlocksFlag.Name, GpoBlocksFlag.Value, GpoBlocksFlag.Usage); v != nil {
|
|
|
|
cfg.Blocks = *v
|
|
|
|
}
|
|
|
|
if v := f.Int(GpoPercentileFlag.Name, GpoPercentileFlag.Value, GpoPercentileFlag.Usage); v != nil {
|
|
|
|
cfg.Percentile = *v
|
|
|
|
}
|
|
|
|
if v := f.Int64(GpoMaxGasPriceFlag.Name, GpoMaxGasPriceFlag.Value, GpoMaxGasPriceFlag.Usage); v != nil {
|
|
|
|
cfg.MaxPrice = big.NewInt(*v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-26 10:40:47 +00:00
|
|
|
func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig) {
|
2018-08-21 17:30:06 +00:00
|
|
|
if ctx.GlobalIsSet(TxPoolLocalsFlag.Name) {
|
|
|
|
locals := strings.Split(ctx.GlobalString(TxPoolLocalsFlag.Name), ",")
|
|
|
|
for _, account := range locals {
|
|
|
|
if trimmed := strings.TrimSpace(account); !common.IsHexAddress(trimmed) {
|
|
|
|
Fatalf("Invalid account in --txpool.locals: %s", trimmed)
|
|
|
|
} else {
|
|
|
|
cfg.Locals = append(cfg.Locals, common.HexToAddress(account))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-05 14:06:05 +00:00
|
|
|
if ctx.GlobalIsSet(TxPoolNoLocalsFlag.Name) {
|
|
|
|
cfg.NoLocals = ctx.GlobalBool(TxPoolNoLocalsFlag.Name)
|
|
|
|
}
|
2017-07-28 13:09:39 +00:00
|
|
|
if ctx.GlobalIsSet(TxPoolJournalFlag.Name) {
|
|
|
|
cfg.Journal = ctx.GlobalString(TxPoolJournalFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(TxPoolRejournalFlag.Name) {
|
|
|
|
cfg.Rejournal = ctx.GlobalDuration(TxPoolRejournalFlag.Name)
|
|
|
|
}
|
2017-05-26 10:40:47 +00:00
|
|
|
if ctx.GlobalIsSet(TxPoolPriceLimitFlag.Name) {
|
|
|
|
cfg.PriceLimit = ctx.GlobalUint64(TxPoolPriceLimitFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(TxPoolPriceBumpFlag.Name) {
|
|
|
|
cfg.PriceBump = ctx.GlobalUint64(TxPoolPriceBumpFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(TxPoolAccountSlotsFlag.Name) {
|
|
|
|
cfg.AccountSlots = ctx.GlobalUint64(TxPoolAccountSlotsFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(TxPoolGlobalSlotsFlag.Name) {
|
|
|
|
cfg.GlobalSlots = ctx.GlobalUint64(TxPoolGlobalSlotsFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(TxPoolAccountQueueFlag.Name) {
|
|
|
|
cfg.AccountQueue = ctx.GlobalUint64(TxPoolAccountQueueFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(TxPoolGlobalQueueFlag.Name) {
|
|
|
|
cfg.GlobalQueue = ctx.GlobalUint64(TxPoolGlobalQueueFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(TxPoolLifetimeFlag.Name) {
|
|
|
|
cfg.Lifetime = ctx.GlobalDuration(TxPoolLifetimeFlag.Name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-02 07:03:50 +00:00
|
|
|
func setEthash(ctx *cli.Context, datadir string, cfg *ethconfig.Config) {
|
2017-04-12 14:27:23 +00:00
|
|
|
if ctx.GlobalIsSet(EthashDatasetDirFlag.Name) {
|
2017-11-24 14:10:27 +00:00
|
|
|
cfg.Ethash.DatasetDir = ctx.GlobalString(EthashDatasetDirFlag.Name)
|
2021-06-02 07:03:50 +00:00
|
|
|
} else {
|
|
|
|
cfg.Ethash.DatasetDir = path.Join(datadir, "erigon", "ethash-dags")
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(EthashCachesInMemoryFlag.Name) {
|
2017-11-24 14:10:27 +00:00
|
|
|
cfg.Ethash.CachesInMem = ctx.GlobalInt(EthashCachesInMemoryFlag.Name)
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
geth 1.9.13 (#469)
* core: initial version of state snapshots
* core/state: lazy sorting, snapshot invalidation
* core/state/snapshot: extract and split cap method, cover corners
* snapshot: iteration and buffering optimizations
* core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
* 123
* core/rawdb, core/state/snapshot: runtime snapshot generation
* core/state/snapshot: fix difflayer origin-initalization after flatten
* add "to merge"
* core/state/snapshot: implement snapshot layer iteration
* core/state/snapshot: node behavioural difference on bloom content
* core: journal the snapshot inside leveldb, not a flat file
* core/state/snapshot: bloom, metrics and prefetcher fixes
* core/state/snapshot: move iterator out into its own files
* core/state/snapshot: implement iterator priority for fast direct data lookup
* core/state/snapshot: full featured account iteration
* core/state/snapshot: faster account iteration, CLI integration
* core: fix broken tests due to API changes + linter
* core/state: fix an account resurrection issue
* core/tests: test for destroy+recreate contract with storage
* squashme
* core/state/snapshot, tests: sync snap gen + snaps in consensus tests
* core/state: extend snapshotter to handle account resurrections
* core/state: fix account root hash update point
* core/state: fix resurrection state clearing and access
* core/state/snapshot: handle deleted accounts in fast iterator
* core: more blockchain tests
* core/state/snapshot: fix various iteration issues due to destruct set
* core: fix two snapshot iterator flaws, decollide snap storage prefix
* core/state/snapshot/iterator: fix two disk iterator flaws
* core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix
* params: begin v1.9.13 release cycle
* cmd/checkpoint-admin: add some documentation (#20697)
* go.mod: update duktape to fix sprintf warnings (#20777)
This revision of go-duktype fixes the following warning
```
duk_logging.c: In function ‘duk__logger_prototype_log_shared’:
duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=]
184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
| ^
In file included from /usr/include/stdio.h:867,
from duk_logging.c:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* core/rawdb: fix freezer table test error check
Fixes: Condition is always 'false' because 'err' is always 'nil'
* core/rawdb: improve table database (#20703)
This PR fixes issues in TableDatabase.
TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix.
The prefix is applied to all entries it maintains. However when we try to retrieve entries
from it we don't handle the key properly. In theory the prefix should be truncated and
only user key is returned. But we don't do it in some cases, e.g. the iterator and batch
replayer created from it. So this PR is the fix to these issues.
* eth: when triggering a sync, check the head header TD, not block
* internal/web3ext: fix clique console apis to work on missing arguments
* rpc: dont log an error if user configures --rpcapi=rpc... (#20776)
This just prevents a false negative ERROR warning when, for some unknown
reason, a user attempts to turn on the module rpc even though it's already going
to be on.
* node, cmd/clef: report actual port used for http rpc (#20789)
* internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783)
Prior to this change, eth_call changed the balance of the sender account in the
EVM environment to 2^256 wei to cover the gas cost of the call execution.
We've had this behavior for a long time even though it's super confusing.
This commit sets the default call gasprice to zero instead of updating the balance,
which is better because it makes eth_call semantics less surprising. Removing
the built-in balance assignment also makes balance overrides work as expected.
* metrics: disable CPU stats (gosigar) on iOS
* cmd/devp2p: tweak DNS TTLs (#20801)
* cmd/devp2p: tweak DNS TTLs
* cmd/devp2p: bump treeNodeTTL to four weeks
* cmd/devp2p: lower route53 change limit again (#20819)
* cmd/devp2p: be very correct about route53 change splitting (#20820)
Turns out the way RDATA limits work is documented after all,
I just didn't search right. The trick to make it work is to
count UPSERTs twice.
This also adds an additional check to ensure TTL changes are
applied on existing records.
* graphql, node, rpc: fix typos in comments (#20824)
* eth: improve shutdown synchronization (#20695)
* eth: improve shutdown synchronization
Most goroutines started by eth.Ethereum didn't have any shutdown sync at
all, which lead to weird error messages when quitting the client.
This change improves the clean shutdown path by stopping all internal
components in dependency order and waiting for them to actually be
stopped before shutdown is considered done. In particular, we now stop
everything related to peers before stopping 'resident' parts such as
core.BlockChain.
* eth: rewrite sync controller
* eth: remove sync start debug message
* eth: notify chainSyncer about new peers after handshake
* eth: move downloader.Cancel call into chainSyncer
* eth: make post-sync block broadcast synchronous
* eth: add comments
* core: change blockchain stop message
* eth: change closeBloomHandler channel type
* eth/filters: fix typo on unindexedLogs function's comment (#20827)
* core: bump txpool tx max size to 128KB
* snapshotter/tests: verify snapdb post-state against trie (#20812)
* core/state/snapshot: basic trie-to-hash implementation
* tests: validate snapshot after test
* core/state/snapshot: fix review concerns
* cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484)
* cmd, consensus: add option to disable mmap for DAG caches/datasets
* consensus: add benchmarks for mmap with/with lock
* cmd/clef: add newaccount command (#20782)
* cmd/clef: add newaccount command
* cmd/clef: document clef_New, update API versioning
* Update cmd/clef/intapi_changelog.md
Co-Authored-By: ligi <ligi@ligi.de>
* Update signer/core/uiapi.go
Co-Authored-By: ligi <ligi@ligi.de>
Co-authored-by: ligi <ligi@ligi.de>
* eth: add debug_accountRange API (#19645)
This new API allows reading accounts and their content by address range.
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
* travis: allow cocoapods deploy to fail (#20833)
* metrics: improve TestTimerFunc (#20818)
The test failed due to what appears to be fluctuations in time.Sleep, which is
not the actual method under test. This change modifies it so we compare the
metered Max to the actual time instead of the desired time.
* README: update private network genesis spec with istanbul (#20841)
* add istanbul and muirGlacier to genesis states in README
* remove muirGlacier, relocate istanbul
* cmd/evm: Rework execution stats (#20792)
- Dump stats also for --bench flag.
- From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested.
- Now the mem stats are for single execution in case of --bench.
* cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843)
* p2p/server: add UDP port mapping goroutine to wait group (#20846)
* accounts/abi faster unpacking of int256 (#20850)
* p2p/discv5: add missing Timer.Stop calls (#20853)
* miner/worker: add missing timer.Stop call (#20857)
* cmd/geth: fix bad genesis test (#20860)
* eth/filters: add missing Ticker.Stop call (#20862)
* eth/fetcher: add missing timer.Stop calls (#20861)
* event: add missing timer.Stop call in TestFeed (#20868)
* metrics: add missing calls to Ticker.Stop in tests (#20866)
* ethstats: add missing Ticker.Stop call (#20867)
* p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869)
* core: add missing Timer.Stop call in TestLogReorgs (#20870)
* rpc: add missing timer.Stop calls in websocket tests (#20863)
* crypto/ecies: improve concatKDF (#20836)
This removes a bunch of weird code around the counter overflow check in
concatKDF and makes it actually work for different hash output sizes.
The overflow check worked as follows: concatKDF applies the hash function N
times, where N is roundup(kdLen, hashsize) / hashsize. N should not
overflow 32 bits because that would lead to a repetition in the KDF output.
A couple issues with the overflow check:
- It used the hash.BlockSize, which is wrong because the
block size is about the input of the hash function. Luckily, all standard
hash functions have a block size that's greater than the output size, so
concatKDF didn't crash, it just generated too much key material.
- The check used big.Int to compare against 2^32-1.
- The calculation could still overflow before reaching the check.
The new code in concatKDF doesn't check for overflow. Instead, there is a
new check on ECIESParams which ensures that params.KeyLen is < 512. This
removes any possibility of overflow.
There are a couple of miscellaneous improvements bundled in with this
change:
- The key buffer is pre-allocated instead of appending the hash output
to an initially empty slice.
- The code that uses concatKDF to derive keys is now shared between Encrypt
and Decrypt.
- There was a redundant invocation of IsOnCurve in Decrypt. This is now removed
because elliptic.Unmarshal already checks whether the input is a valid curve
point since Go 1.5.
Co-authored-by: Felix Lange <fjl@twurst.com>
* rpc: metrics for JSON-RPC method calls (#20847)
This adds a couple of metrics for tracking the timing
and frequency of method calls:
- rpc/requests gauge counts all requests
- rpc/success gauge counts requests which return err == nil
- rpc/failure gauge counts requests which return err != nil
- rpc/duration/all timer tracks timing of all requests
- rpc/duration/<method>/<success/failure> tracks per-method timing
* mobile: use bind.NewKeyedTransactor instead of duplicating (#20888)
It's better to reuse the existing code to create a keyed transactor
than to rewrite the logic again.
* internal/ethapi: add CallArgs.ToMessage method (#20854)
ToMessage is used to convert between ethapi.CallArgs and types.Message.
It reduces the length of the DoCall method by about half by abstracting out
the conversion between the CallArgs and the Message. This should improve the
code's maintainability and reusability.
* eth, les: fix flaky tests (#20897)
* les: fix flaky test
* eth: fix flaky test
* cmd/geth: enable metrics for geth import command (#20738)
* cmd/geth: enable metrics for geth import command
* cmd/geth: enable metrics-flags for import command
* core/vm: use a callcontext struct (#20761)
* core/vm: use a callcontext struct
* core/vm: fix tests
* core/vm/runtime: benchmark
* core/vm: make intpool push inlineable, unexpose callcontext
* docs/audits: add discv5 protocol audits from LA and C53 (#20898)
* .github: change gitter reference to discord link in issue template (#20896)
* couple of fixes to docs in clef (#20900)
* p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen.
* build: upgrade to golangci-lint 1.24.0 (#20901)
* accounts/scwallet: remove unnecessary uses of fmt.Sprintf
* cmd/puppeth: remove unnecessary uses of fmt.Sprintf
* p2p/discv5: remove unnecessary use of fmt.Sprintf
* whisper/mailserver: remove unnecessary uses of fmt.Sprintf
* core: goimports -w tx_pool_test.go
* eth/downloader: goimports -w downloader_test.go
* build: upgrade to golangci-lint 1.24.0
* accounts/abi/bind: Refactored topics (#20851)
* accounts/abi/bind: refactored topics
* accounts/abi/bind: use store function to remove code duplication
* accounts/abi/bind: removed unused type defs
* accounts/abi/bind: error on tuples in topics
* Cosmetic changes to restart travis build
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
* node: allow websocket and HTTP on the same port (#20810)
This change makes it possible to run geth with JSON-RPC over HTTP and
WebSocket on the same TCP port. The default port for WebSocket
is still 8546.
geth --rpc --rpcport 8545 --ws --wsport 8545
This also removes a lot of deprecated API surface from package rpc.
The rpc package is now purely about serving JSON-RPC and no longer
provides a way to start an HTTP server.
* crypto: improve error messages in LoadECDSA (#20718)
This improves error messages when the file is too short or too long.
Also rewrite the test for SaveECDSA because LoadECDSA has its own
test now.
Co-authored-by: Felix Lange <fjl@twurst.com>
* changed date of rpcstack.go since new file (#20904)
* accounts/abi/bind: fixed erroneous filtering of negative ints (#20865)
* accounts/abi/bind: fixed erroneous packing of negative ints
* accounts/abi/bind: added test cases for negative ints in topics
* accounts/abi/bind: fixed genIntType for go 1.12
* accounts/abi: minor nitpick
* cmd: deprecate --testnet, use named networks instead (#20852)
* cmd/utils: make goerli the default testnet
* cmd/geth: explicitly rename testnet to ropsten
* core: explicitly rename testnet to ropsten
* params: explicitly rename testnet to ropsten
* cmd: explicitly rename testnet to ropsten
* miner: explicitly rename testnet to ropsten
* mobile: allow for returning the goerli spec
* tests: explicitly rename testnet to ropsten
* docs: update readme to reflect changes to the default testnet
* mobile: allow for configuring goerli and rinkeby nodes
* cmd/geth: revert --testnet back to ropsten and mark as legacy
* cmd/util: mark --testnet flag as deprecated
* docs: update readme to properly reflect the 3 testnets
* cmd/utils: add an explicit deprecation warning on startup
* cmd/utils: swap goerli and ropsten in usage
* cmd/geth: swap goerli and ropsten in usage
* cmd/geth: if running a known preset, log it for convenience
* docs: improve readme on usage of ropsten's testnet datadir
* cmd/utils: check if legacy `testnet` datadir exists for ropsten
* cmd/geth: check for legacy testnet path in console command
* cmd/geth: use switch statement for complex conditions in main
* cmd/geth: move known preset log statement to the very top
* cmd/utils: create new ropsten configurations in the ropsten datadir
* cmd/utils: makedatadir should check for existing testnet dir
* cmd/geth: add legacy testnet flag to the copy db command
* cmd/geth: add legacy testnet flag to the inspect command
* les, les/lespay/client: add service value statistics and API (#20837)
This PR adds service value measurement statistics to the light client. It
also adds a private API that makes these statistics accessible. A follow-up
PR will add the new server pool which uses these statistics to select
servers with good performance.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
* README: update min go version to 1.13 (#20911)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2
* travis, appveyor: force GO111MODULE=on for every build
* core/rawdb: fix data race between Retrieve and Close (#20919)
* core/rawdb: fixed data race between retrieve and close
closes https://github.com/ethereum/go-ethereum/issues/20420
* core/rawdb: use non-atomic load while holding mutex
* all: simplify and fix database iteration with prefix/start (#20808)
* core/state/snapshot: start fixing disk iterator seek
* ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start
* les, core/state/snapshot: iterator fixes
* all: remove two iterator methods
* all: rename Iteratee.NewIteratorWith -> NewIterator
* ethdb: fix review concerns
* params: update CHTs for the 1.9.13 release
* params: release Geth v1.9.13
* added some missing files
* post-rebase fixups
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Co-authored-by: Ha ĐANG <dvietha@gmail.com>
Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Wenbiao Zheng <delweng@gmail.com>
Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com>
Co-authored-by: Jeff Wentworth <jeff@curvegrid.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Luke Champine <luke.champine@gmail.com>
Co-authored-by: Boqin Qin <Bobbqqin@gmail.com>
Co-authored-by: William Morriss <wjmelements@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
|
|
|
if ctx.GlobalIsSet(EthashCachesLockMmapFlag.Name) {
|
|
|
|
cfg.Ethash.CachesLockMmap = ctx.GlobalBool(EthashCachesLockMmapFlag.Name)
|
|
|
|
}
|
2019-05-27 13:51:49 +00:00
|
|
|
if ctx.GlobalIsSet(FakePoWFlag.Name) {
|
|
|
|
cfg.Ethash.PowMode = ethash.ModeFake
|
|
|
|
}
|
geth 1.9.13 (#469)
* core: initial version of state snapshots
* core/state: lazy sorting, snapshot invalidation
* core/state/snapshot: extract and split cap method, cover corners
* snapshot: iteration and buffering optimizations
* core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
* 123
* core/rawdb, core/state/snapshot: runtime snapshot generation
* core/state/snapshot: fix difflayer origin-initalization after flatten
* add "to merge"
* core/state/snapshot: implement snapshot layer iteration
* core/state/snapshot: node behavioural difference on bloom content
* core: journal the snapshot inside leveldb, not a flat file
* core/state/snapshot: bloom, metrics and prefetcher fixes
* core/state/snapshot: move iterator out into its own files
* core/state/snapshot: implement iterator priority for fast direct data lookup
* core/state/snapshot: full featured account iteration
* core/state/snapshot: faster account iteration, CLI integration
* core: fix broken tests due to API changes + linter
* core/state: fix an account resurrection issue
* core/tests: test for destroy+recreate contract with storage
* squashme
* core/state/snapshot, tests: sync snap gen + snaps in consensus tests
* core/state: extend snapshotter to handle account resurrections
* core/state: fix account root hash update point
* core/state: fix resurrection state clearing and access
* core/state/snapshot: handle deleted accounts in fast iterator
* core: more blockchain tests
* core/state/snapshot: fix various iteration issues due to destruct set
* core: fix two snapshot iterator flaws, decollide snap storage prefix
* core/state/snapshot/iterator: fix two disk iterator flaws
* core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix
* params: begin v1.9.13 release cycle
* cmd/checkpoint-admin: add some documentation (#20697)
* go.mod: update duktape to fix sprintf warnings (#20777)
This revision of go-duktype fixes the following warning
```
duk_logging.c: In function ‘duk__logger_prototype_log_shared’:
duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=]
184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
| ^
In file included from /usr/include/stdio.h:867,
from duk_logging.c:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* core/rawdb: fix freezer table test error check
Fixes: Condition is always 'false' because 'err' is always 'nil'
* core/rawdb: improve table database (#20703)
This PR fixes issues in TableDatabase.
TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix.
The prefix is applied to all entries it maintains. However when we try to retrieve entries
from it we don't handle the key properly. In theory the prefix should be truncated and
only user key is returned. But we don't do it in some cases, e.g. the iterator and batch
replayer created from it. So this PR is the fix to these issues.
* eth: when triggering a sync, check the head header TD, not block
* internal/web3ext: fix clique console apis to work on missing arguments
* rpc: dont log an error if user configures --rpcapi=rpc... (#20776)
This just prevents a false negative ERROR warning when, for some unknown
reason, a user attempts to turn on the module rpc even though it's already going
to be on.
* node, cmd/clef: report actual port used for http rpc (#20789)
* internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783)
Prior to this change, eth_call changed the balance of the sender account in the
EVM environment to 2^256 wei to cover the gas cost of the call execution.
We've had this behavior for a long time even though it's super confusing.
This commit sets the default call gasprice to zero instead of updating the balance,
which is better because it makes eth_call semantics less surprising. Removing
the built-in balance assignment also makes balance overrides work as expected.
* metrics: disable CPU stats (gosigar) on iOS
* cmd/devp2p: tweak DNS TTLs (#20801)
* cmd/devp2p: tweak DNS TTLs
* cmd/devp2p: bump treeNodeTTL to four weeks
* cmd/devp2p: lower route53 change limit again (#20819)
* cmd/devp2p: be very correct about route53 change splitting (#20820)
Turns out the way RDATA limits work is documented after all,
I just didn't search right. The trick to make it work is to
count UPSERTs twice.
This also adds an additional check to ensure TTL changes are
applied on existing records.
* graphql, node, rpc: fix typos in comments (#20824)
* eth: improve shutdown synchronization (#20695)
* eth: improve shutdown synchronization
Most goroutines started by eth.Ethereum didn't have any shutdown sync at
all, which lead to weird error messages when quitting the client.
This change improves the clean shutdown path by stopping all internal
components in dependency order and waiting for them to actually be
stopped before shutdown is considered done. In particular, we now stop
everything related to peers before stopping 'resident' parts such as
core.BlockChain.
* eth: rewrite sync controller
* eth: remove sync start debug message
* eth: notify chainSyncer about new peers after handshake
* eth: move downloader.Cancel call into chainSyncer
* eth: make post-sync block broadcast synchronous
* eth: add comments
* core: change blockchain stop message
* eth: change closeBloomHandler channel type
* eth/filters: fix typo on unindexedLogs function's comment (#20827)
* core: bump txpool tx max size to 128KB
* snapshotter/tests: verify snapdb post-state against trie (#20812)
* core/state/snapshot: basic trie-to-hash implementation
* tests: validate snapshot after test
* core/state/snapshot: fix review concerns
* cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484)
* cmd, consensus: add option to disable mmap for DAG caches/datasets
* consensus: add benchmarks for mmap with/with lock
* cmd/clef: add newaccount command (#20782)
* cmd/clef: add newaccount command
* cmd/clef: document clef_New, update API versioning
* Update cmd/clef/intapi_changelog.md
Co-Authored-By: ligi <ligi@ligi.de>
* Update signer/core/uiapi.go
Co-Authored-By: ligi <ligi@ligi.de>
Co-authored-by: ligi <ligi@ligi.de>
* eth: add debug_accountRange API (#19645)
This new API allows reading accounts and their content by address range.
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
* travis: allow cocoapods deploy to fail (#20833)
* metrics: improve TestTimerFunc (#20818)
The test failed due to what appears to be fluctuations in time.Sleep, which is
not the actual method under test. This change modifies it so we compare the
metered Max to the actual time instead of the desired time.
* README: update private network genesis spec with istanbul (#20841)
* add istanbul and muirGlacier to genesis states in README
* remove muirGlacier, relocate istanbul
* cmd/evm: Rework execution stats (#20792)
- Dump stats also for --bench flag.
- From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested.
- Now the mem stats are for single execution in case of --bench.
* cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843)
* p2p/server: add UDP port mapping goroutine to wait group (#20846)
* accounts/abi faster unpacking of int256 (#20850)
* p2p/discv5: add missing Timer.Stop calls (#20853)
* miner/worker: add missing timer.Stop call (#20857)
* cmd/geth: fix bad genesis test (#20860)
* eth/filters: add missing Ticker.Stop call (#20862)
* eth/fetcher: add missing timer.Stop calls (#20861)
* event: add missing timer.Stop call in TestFeed (#20868)
* metrics: add missing calls to Ticker.Stop in tests (#20866)
* ethstats: add missing Ticker.Stop call (#20867)
* p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869)
* core: add missing Timer.Stop call in TestLogReorgs (#20870)
* rpc: add missing timer.Stop calls in websocket tests (#20863)
* crypto/ecies: improve concatKDF (#20836)
This removes a bunch of weird code around the counter overflow check in
concatKDF and makes it actually work for different hash output sizes.
The overflow check worked as follows: concatKDF applies the hash function N
times, where N is roundup(kdLen, hashsize) / hashsize. N should not
overflow 32 bits because that would lead to a repetition in the KDF output.
A couple issues with the overflow check:
- It used the hash.BlockSize, which is wrong because the
block size is about the input of the hash function. Luckily, all standard
hash functions have a block size that's greater than the output size, so
concatKDF didn't crash, it just generated too much key material.
- The check used big.Int to compare against 2^32-1.
- The calculation could still overflow before reaching the check.
The new code in concatKDF doesn't check for overflow. Instead, there is a
new check on ECIESParams which ensures that params.KeyLen is < 512. This
removes any possibility of overflow.
There are a couple of miscellaneous improvements bundled in with this
change:
- The key buffer is pre-allocated instead of appending the hash output
to an initially empty slice.
- The code that uses concatKDF to derive keys is now shared between Encrypt
and Decrypt.
- There was a redundant invocation of IsOnCurve in Decrypt. This is now removed
because elliptic.Unmarshal already checks whether the input is a valid curve
point since Go 1.5.
Co-authored-by: Felix Lange <fjl@twurst.com>
* rpc: metrics for JSON-RPC method calls (#20847)
This adds a couple of metrics for tracking the timing
and frequency of method calls:
- rpc/requests gauge counts all requests
- rpc/success gauge counts requests which return err == nil
- rpc/failure gauge counts requests which return err != nil
- rpc/duration/all timer tracks timing of all requests
- rpc/duration/<method>/<success/failure> tracks per-method timing
* mobile: use bind.NewKeyedTransactor instead of duplicating (#20888)
It's better to reuse the existing code to create a keyed transactor
than to rewrite the logic again.
* internal/ethapi: add CallArgs.ToMessage method (#20854)
ToMessage is used to convert between ethapi.CallArgs and types.Message.
It reduces the length of the DoCall method by about half by abstracting out
the conversion between the CallArgs and the Message. This should improve the
code's maintainability and reusability.
* eth, les: fix flaky tests (#20897)
* les: fix flaky test
* eth: fix flaky test
* cmd/geth: enable metrics for geth import command (#20738)
* cmd/geth: enable metrics for geth import command
* cmd/geth: enable metrics-flags for import command
* core/vm: use a callcontext struct (#20761)
* core/vm: use a callcontext struct
* core/vm: fix tests
* core/vm/runtime: benchmark
* core/vm: make intpool push inlineable, unexpose callcontext
* docs/audits: add discv5 protocol audits from LA and C53 (#20898)
* .github: change gitter reference to discord link in issue template (#20896)
* couple of fixes to docs in clef (#20900)
* p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen.
* build: upgrade to golangci-lint 1.24.0 (#20901)
* accounts/scwallet: remove unnecessary uses of fmt.Sprintf
* cmd/puppeth: remove unnecessary uses of fmt.Sprintf
* p2p/discv5: remove unnecessary use of fmt.Sprintf
* whisper/mailserver: remove unnecessary uses of fmt.Sprintf
* core: goimports -w tx_pool_test.go
* eth/downloader: goimports -w downloader_test.go
* build: upgrade to golangci-lint 1.24.0
* accounts/abi/bind: Refactored topics (#20851)
* accounts/abi/bind: refactored topics
* accounts/abi/bind: use store function to remove code duplication
* accounts/abi/bind: removed unused type defs
* accounts/abi/bind: error on tuples in topics
* Cosmetic changes to restart travis build
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
* node: allow websocket and HTTP on the same port (#20810)
This change makes it possible to run geth with JSON-RPC over HTTP and
WebSocket on the same TCP port. The default port for WebSocket
is still 8546.
geth --rpc --rpcport 8545 --ws --wsport 8545
This also removes a lot of deprecated API surface from package rpc.
The rpc package is now purely about serving JSON-RPC and no longer
provides a way to start an HTTP server.
* crypto: improve error messages in LoadECDSA (#20718)
This improves error messages when the file is too short or too long.
Also rewrite the test for SaveECDSA because LoadECDSA has its own
test now.
Co-authored-by: Felix Lange <fjl@twurst.com>
* changed date of rpcstack.go since new file (#20904)
* accounts/abi/bind: fixed erroneous filtering of negative ints (#20865)
* accounts/abi/bind: fixed erroneous packing of negative ints
* accounts/abi/bind: added test cases for negative ints in topics
* accounts/abi/bind: fixed genIntType for go 1.12
* accounts/abi: minor nitpick
* cmd: deprecate --testnet, use named networks instead (#20852)
* cmd/utils: make goerli the default testnet
* cmd/geth: explicitly rename testnet to ropsten
* core: explicitly rename testnet to ropsten
* params: explicitly rename testnet to ropsten
* cmd: explicitly rename testnet to ropsten
* miner: explicitly rename testnet to ropsten
* mobile: allow for returning the goerli spec
* tests: explicitly rename testnet to ropsten
* docs: update readme to reflect changes to the default testnet
* mobile: allow for configuring goerli and rinkeby nodes
* cmd/geth: revert --testnet back to ropsten and mark as legacy
* cmd/util: mark --testnet flag as deprecated
* docs: update readme to properly reflect the 3 testnets
* cmd/utils: add an explicit deprecation warning on startup
* cmd/utils: swap goerli and ropsten in usage
* cmd/geth: swap goerli and ropsten in usage
* cmd/geth: if running a known preset, log it for convenience
* docs: improve readme on usage of ropsten's testnet datadir
* cmd/utils: check if legacy `testnet` datadir exists for ropsten
* cmd/geth: check for legacy testnet path in console command
* cmd/geth: use switch statement for complex conditions in main
* cmd/geth: move known preset log statement to the very top
* cmd/utils: create new ropsten configurations in the ropsten datadir
* cmd/utils: makedatadir should check for existing testnet dir
* cmd/geth: add legacy testnet flag to the copy db command
* cmd/geth: add legacy testnet flag to the inspect command
* les, les/lespay/client: add service value statistics and API (#20837)
This PR adds service value measurement statistics to the light client. It
also adds a private API that makes these statistics accessible. A follow-up
PR will add the new server pool which uses these statistics to select
servers with good performance.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
* README: update min go version to 1.13 (#20911)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2
* travis, appveyor: force GO111MODULE=on for every build
* core/rawdb: fix data race between Retrieve and Close (#20919)
* core/rawdb: fixed data race between retrieve and close
closes https://github.com/ethereum/go-ethereum/issues/20420
* core/rawdb: use non-atomic load while holding mutex
* all: simplify and fix database iteration with prefix/start (#20808)
* core/state/snapshot: start fixing disk iterator seek
* ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start
* les, core/state/snapshot: iterator fixes
* all: remove two iterator methods
* all: rename Iteratee.NewIteratorWith -> NewIterator
* ethdb: fix review concerns
* params: update CHTs for the 1.9.13 release
* params: release Geth v1.9.13
* added some missing files
* post-rebase fixups
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Co-authored-by: Ha ĐANG <dvietha@gmail.com>
Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Wenbiao Zheng <delweng@gmail.com>
Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com>
Co-authored-by: Jeff Wentworth <jeff@curvegrid.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Luke Champine <luke.champine@gmail.com>
Co-authored-by: Boqin Qin <Bobbqqin@gmail.com>
Co-authored-by: William Morriss <wjmelements@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
|
|
|
if ctx.GlobalIsSet(EthashDatasetsLockMmapFlag.Name) {
|
|
|
|
cfg.Ethash.DatasetsLockMmap = ctx.GlobalBool(EthashDatasetsLockMmapFlag.Name)
|
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
|
|
|
|
2021-03-26 18:05:42 +00:00
|
|
|
func SetupMinerCobra(cmd *cobra.Command, cfg *params.MiningConfig) {
|
2021-03-23 09:00:07 +00:00
|
|
|
flags := cmd.Flags()
|
|
|
|
var err error
|
|
|
|
cfg.Enabled, err = flags.GetBool(MiningEnabledFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-03-30 07:09:00 +00:00
|
|
|
if cfg.Enabled && len(cfg.Etherbase.Bytes()) == 0 {
|
2021-05-26 10:35:39 +00:00
|
|
|
panic(fmt.Sprintf("Erigon supports only remote miners. Flag --%s or --%s is required", MinerNotifyFlag.Name, MinerSigningKeyFlag.Name))
|
2021-03-30 07:09:00 +00:00
|
|
|
}
|
2021-03-23 09:00:07 +00:00
|
|
|
cfg.Notify, err = flags.GetStringArray(MinerNotifyFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
extraDataStr, err := flags.GetString(MinerExtraDataFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
cfg.ExtraData = []byte(extraDataStr)
|
|
|
|
cfg.GasFloor, err = flags.GetUint64(MinerGasTargetFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
cfg.GasCeil, err = flags.GetUint64(MinerGasLimitFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
price, err := flags.GetInt64(MinerGasPriceFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
cfg.GasPrice = big.NewInt(price)
|
|
|
|
cfg.Recommit, err = flags.GetDuration(MinerRecommitIntervalFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
cfg.Noverify, err = flags.GetBool(MinerNoVerfiyFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extract the current etherbase, new flag overriding legacy one
|
|
|
|
var etherbase string
|
|
|
|
etherbase, err = flags.GetString(MinerEtherbaseFlag.Name)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert the etherbase into an address and configure it
|
2021-03-28 14:40:27 +00:00
|
|
|
if etherbase == "" {
|
2021-03-26 18:05:42 +00:00
|
|
|
Fatalf("No etherbase configured")
|
2021-03-23 09:00:07 +00:00
|
|
|
}
|
|
|
|
cfg.Etherbase = common.HexToAddress(etherbase)
|
|
|
|
}
|
|
|
|
|
2021-06-16 10:57:58 +00:00
|
|
|
func setClique(ctx *cli.Context, cfg *params.SnapshotConfig, datadir string) {
|
2021-04-19 21:58:05 +00:00
|
|
|
cfg.CheckpointInterval = ctx.GlobalUint64(CliqueSnapshotCheckpointIntervalFlag.Name)
|
|
|
|
cfg.InmemorySnapshots = ctx.GlobalInt(CliqueSnapshotInmemorySnapshotsFlag.Name)
|
|
|
|
cfg.InmemorySignatures = ctx.GlobalInt(CliqueSnapshotInmemorySignaturesFlag.Name)
|
|
|
|
if ctx.GlobalIsSet(CliqueDataDirFlag.Name) {
|
|
|
|
cfg.DBPath = path.Join(ctx.GlobalString(CliqueDataDirFlag.Name), "clique/db")
|
|
|
|
} else {
|
|
|
|
cfg.DBPath = path.Join(datadir, "clique/db")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-15 12:43:55 +00:00
|
|
|
func setAuRa(ctx *cli.Context, cfg *params.AuRaConfig, datadir string) {
|
2021-06-25 18:13:40 +00:00
|
|
|
cfg.DBPath = path.Join(datadir, "aura")
|
2021-06-15 12:43:55 +00:00
|
|
|
}
|
|
|
|
|
2021-03-23 09:00:07 +00:00
|
|
|
func setMiner(ctx *cli.Context, cfg *params.MiningConfig) {
|
|
|
|
if ctx.GlobalIsSet(MiningEnabledFlag.Name) {
|
|
|
|
cfg.Enabled = true
|
|
|
|
}
|
2021-03-30 07:09:00 +00:00
|
|
|
if cfg.Enabled && len(cfg.Etherbase.Bytes()) == 0 {
|
2021-05-26 10:35:39 +00:00
|
|
|
panic(fmt.Sprintf("Erigon supports only remote miners. Flag --%s or --%s is required", MinerNotifyFlag.Name, MinerSigningKeyFlag.Name))
|
2021-03-30 07:09:00 +00:00
|
|
|
}
|
2019-04-23 07:08:51 +00:00
|
|
|
if ctx.GlobalIsSet(MinerNotifyFlag.Name) {
|
|
|
|
cfg.Notify = strings.Split(ctx.GlobalString(MinerNotifyFlag.Name), ",")
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(MinerExtraDataFlag.Name) {
|
|
|
|
cfg.ExtraData = []byte(ctx.GlobalString(MinerExtraDataFlag.Name))
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(MinerGasTargetFlag.Name) {
|
|
|
|
cfg.GasFloor = ctx.GlobalUint64(MinerGasTargetFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(MinerGasLimitFlag.Name) {
|
|
|
|
cfg.GasCeil = ctx.GlobalUint64(MinerGasLimitFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
|
|
|
|
cfg.GasPrice = GlobalBig(ctx, MinerGasPriceFlag.Name)
|
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(MinerRecommitIntervalFlag.Name) {
|
2020-06-30 07:05:25 +00:00
|
|
|
cfg.Recommit = ctx.GlobalDuration(MinerRecommitIntervalFlag.Name)
|
2019-04-23 07:08:51 +00:00
|
|
|
}
|
|
|
|
if ctx.GlobalIsSet(MinerNoVerfiyFlag.Name) {
|
2020-06-30 07:05:25 +00:00
|
|
|
cfg.Noverify = ctx.GlobalBool(MinerNoVerfiyFlag.Name)
|
2019-04-23 07:08:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-25 04:20:50 +00:00
|
|
|
func setWhitelist(ctx *cli.Context, cfg *ethconfig.Config) {
|
2018-12-10 12:47:01 +00:00
|
|
|
whitelist := ctx.GlobalString(WhitelistFlag.Name)
|
|
|
|
if whitelist == "" {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
cfg.Whitelist = make(map[uint64]common.Hash)
|
|
|
|
for _, entry := range strings.Split(whitelist, ",") {
|
|
|
|
parts := strings.Split(entry, "=")
|
|
|
|
if len(parts) != 2 {
|
|
|
|
Fatalf("Invalid whitelist entry: %s", entry)
|
2018-11-02 20:26:45 +00:00
|
|
|
}
|
2018-12-10 12:47:01 +00:00
|
|
|
number, err := strconv.ParseUint(parts[0], 0, 64)
|
|
|
|
if err != nil {
|
|
|
|
Fatalf("Invalid whitelist block number %s: %v", parts[0], err)
|
|
|
|
}
|
|
|
|
var hash common.Hash
|
|
|
|
if err = hash.UnmarshalText([]byte(parts[1])); err != nil {
|
|
|
|
Fatalf("Invalid whitelist hash %s: %v", parts[1], err)
|
|
|
|
}
|
|
|
|
cfg.Whitelist[number] = hash
|
2018-11-02 20:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-08 12:59:07 +00:00
|
|
|
// CheckExclusive verifies that only a single instance of the provided flags was
|
2017-11-24 15:07:22 +00:00
|
|
|
// set by the user. Each flag might optionally be followed by a string type to
|
|
|
|
// specialize it further.
|
2019-07-08 12:59:07 +00:00
|
|
|
func CheckExclusive(ctx *cli.Context, args ...interface{}) {
|
2017-04-12 14:27:23 +00:00
|
|
|
set := make([]string, 0, 1)
|
2017-11-24 15:07:22 +00:00
|
|
|
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)
|
|
|
|
if !ok {
|
|
|
|
panic(fmt.Sprintf("invalid argument, not cli.Flag type: %T", args[i]))
|
|
|
|
}
|
|
|
|
// Check if next arg extends current and expand its name if so
|
|
|
|
name := flag.GetName()
|
|
|
|
|
|
|
|
if i+1 < len(args) {
|
|
|
|
switch option := args[i+1].(type) {
|
|
|
|
case string:
|
2018-10-08 14:08:56 +00:00
|
|
|
// Extended flag check, make sure value set doesn't conflict with passed in option
|
2017-11-24 15:07:22 +00:00
|
|
|
if ctx.GlobalString(flag.GetName()) == option {
|
|
|
|
name += "=" + option
|
2018-10-08 14:08:56 +00:00
|
|
|
set = append(set, "--"+name)
|
2017-11-24 15:07:22 +00:00
|
|
|
}
|
2018-10-08 14:08:56 +00:00
|
|
|
// shift arguments and continue
|
2017-11-24 15:07:22 +00:00
|
|
|
i++
|
2018-10-08 14:08:56 +00:00
|
|
|
continue
|
2017-11-24 15:07:22 +00:00
|
|
|
|
|
|
|
case cli.Flag:
|
|
|
|
default:
|
|
|
|
panic(fmt.Sprintf("invalid argument, not cli.Flag or string extension: %T", args[i+1]))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Mark the flag if it's set
|
2017-04-12 14:27:23 +00:00
|
|
|
if ctx.GlobalIsSet(flag.GetName()) {
|
2017-11-24 15:07:22 +00:00
|
|
|
set = append(set, "--"+name)
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
if len(set) > 1 {
|
2017-11-24 15:07:22 +00:00
|
|
|
Fatalf("Flags %v can't be used at the same time", strings.Join(set, ", "))
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetEthConfig applies eth-related command line flags to the config.
|
2021-07-04 07:50:32 +00:00
|
|
|
func SetEthConfig(ctx *cli.Context, nodeConfig *node.Config, cfg *ethconfig.Config) {
|
2021-03-26 18:05:42 +00:00
|
|
|
CheckExclusive(ctx, MinerSigningKeyFlag, MinerEtherbaseFlag)
|
|
|
|
setEtherbase(ctx, cfg)
|
2021-03-26 02:08:01 +00:00
|
|
|
setGPO(ctx, &cfg.GPO)
|
2017-05-26 10:40:47 +00:00
|
|
|
setTxPool(ctx, &cfg.TxPool)
|
2021-07-04 07:50:32 +00:00
|
|
|
setEthash(ctx, nodeConfig.DataDir, cfg)
|
|
|
|
setClique(ctx, &cfg.Clique, nodeConfig.DataDir)
|
|
|
|
setAuRa(ctx, &cfg.Aura, nodeConfig.DataDir)
|
2019-04-23 07:08:51 +00:00
|
|
|
setMiner(ctx, &cfg.Miner)
|
2018-11-02 20:26:45 +00:00
|
|
|
setWhitelist(ctx, cfg)
|
2017-04-12 14:27:23 +00:00
|
|
|
|
2021-07-04 07:50:32 +00:00
|
|
|
cfg.P2PEnabled = len(nodeConfig.P2P.SentryAddr) == 0
|
2021-04-30 15:09:03 +00:00
|
|
|
|
2017-04-12 14:27:23 +00:00
|
|
|
if ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2019-05-27 13:51:49 +00:00
|
|
|
cfg.NetworkID = ctx.GlobalUint64(NetworkIdFlag.Name)
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
|
|
|
|
2020-10-13 11:33:10 +00:00
|
|
|
if ctx.GlobalIsSet(RPCGlobalGasCapFlag.Name) {
|
|
|
|
cfg.RPCGasCap = ctx.GlobalUint64(RPCGlobalGasCapFlag.Name)
|
2020-07-01 17:54:21 +00:00
|
|
|
}
|
|
|
|
if cfg.RPCGasCap != 0 {
|
|
|
|
log.Info("Set global gas cap", "cap", cfg.RPCGasCap)
|
|
|
|
} else {
|
|
|
|
log.Info("Global gas cap disabled")
|
2019-04-08 11:49:52 +00:00
|
|
|
}
|
2020-10-13 11:33:10 +00:00
|
|
|
if ctx.GlobalIsSet(RPCGlobalTxFeeCapFlag.Name) {
|
|
|
|
cfg.RPCTxFeeCap = ctx.GlobalFloat64(RPCGlobalTxFeeCapFlag.Name)
|
2020-06-17 07:46:31 +00:00
|
|
|
}
|
2020-12-01 09:03:41 +00:00
|
|
|
if ctx.GlobalIsSet(NoDiscoverFlag.Name) {
|
2021-04-21 01:48:37 +00:00
|
|
|
cfg.EthDiscoveryURLs = []string{}
|
2020-12-01 09:03:41 +00:00
|
|
|
} else if ctx.GlobalIsSet(DNSDiscoveryFlag.Name) {
|
2020-02-13 13:38:30 +00:00
|
|
|
urls := ctx.GlobalString(DNSDiscoveryFlag.Name)
|
|
|
|
if urls == "" {
|
2020-12-14 09:27:15 +00:00
|
|
|
cfg.EthDiscoveryURLs = []string{}
|
2020-02-13 13:38:30 +00:00
|
|
|
} else {
|
2020-12-14 09:27:15 +00:00
|
|
|
cfg.EthDiscoveryURLs = SplitAndTrim(urls)
|
2020-02-13 13:38:30 +00:00
|
|
|
}
|
|
|
|
}
|
2017-05-04 09:36:20 +00:00
|
|
|
// Override any default configs for hard coded networks.
|
2021-04-08 07:39:40 +00:00
|
|
|
chain := ctx.GlobalString(ChainFlag.Name)
|
|
|
|
switch chain {
|
2021-04-09 16:44:25 +00:00
|
|
|
case "":
|
|
|
|
if cfg.NetworkID == 1 {
|
|
|
|
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
|
|
|
|
}
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.MainnetChainName:
|
2021-01-05 13:31:23 +00:00
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2021-03-12 17:26:06 +00:00
|
|
|
cfg.NetworkID = 1
|
2021-01-05 13:31:23 +00:00
|
|
|
}
|
|
|
|
cfg.Genesis = core.DefaultGenesisBlock()
|
|
|
|
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.RopstenChainName:
|
2015-11-17 16:33:25 +00:00
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2019-05-27 13:51:49 +00:00
|
|
|
cfg.NetworkID = 3
|
2015-11-17 16:33:25 +00:00
|
|
|
}
|
geth 1.9.13 (#469)
* core: initial version of state snapshots
* core/state: lazy sorting, snapshot invalidation
* core/state/snapshot: extract and split cap method, cover corners
* snapshot: iteration and buffering optimizations
* core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
* 123
* core/rawdb, core/state/snapshot: runtime snapshot generation
* core/state/snapshot: fix difflayer origin-initalization after flatten
* add "to merge"
* core/state/snapshot: implement snapshot layer iteration
* core/state/snapshot: node behavioural difference on bloom content
* core: journal the snapshot inside leveldb, not a flat file
* core/state/snapshot: bloom, metrics and prefetcher fixes
* core/state/snapshot: move iterator out into its own files
* core/state/snapshot: implement iterator priority for fast direct data lookup
* core/state/snapshot: full featured account iteration
* core/state/snapshot: faster account iteration, CLI integration
* core: fix broken tests due to API changes + linter
* core/state: fix an account resurrection issue
* core/tests: test for destroy+recreate contract with storage
* squashme
* core/state/snapshot, tests: sync snap gen + snaps in consensus tests
* core/state: extend snapshotter to handle account resurrections
* core/state: fix account root hash update point
* core/state: fix resurrection state clearing and access
* core/state/snapshot: handle deleted accounts in fast iterator
* core: more blockchain tests
* core/state/snapshot: fix various iteration issues due to destruct set
* core: fix two snapshot iterator flaws, decollide snap storage prefix
* core/state/snapshot/iterator: fix two disk iterator flaws
* core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix
* params: begin v1.9.13 release cycle
* cmd/checkpoint-admin: add some documentation (#20697)
* go.mod: update duktape to fix sprintf warnings (#20777)
This revision of go-duktype fixes the following warning
```
duk_logging.c: In function ‘duk__logger_prototype_log_shared’:
duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=]
184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
| ^
In file included from /usr/include/stdio.h:867,
from duk_logging.c:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* core/rawdb: fix freezer table test error check
Fixes: Condition is always 'false' because 'err' is always 'nil'
* core/rawdb: improve table database (#20703)
This PR fixes issues in TableDatabase.
TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix.
The prefix is applied to all entries it maintains. However when we try to retrieve entries
from it we don't handle the key properly. In theory the prefix should be truncated and
only user key is returned. But we don't do it in some cases, e.g. the iterator and batch
replayer created from it. So this PR is the fix to these issues.
* eth: when triggering a sync, check the head header TD, not block
* internal/web3ext: fix clique console apis to work on missing arguments
* rpc: dont log an error if user configures --rpcapi=rpc... (#20776)
This just prevents a false negative ERROR warning when, for some unknown
reason, a user attempts to turn on the module rpc even though it's already going
to be on.
* node, cmd/clef: report actual port used for http rpc (#20789)
* internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783)
Prior to this change, eth_call changed the balance of the sender account in the
EVM environment to 2^256 wei to cover the gas cost of the call execution.
We've had this behavior for a long time even though it's super confusing.
This commit sets the default call gasprice to zero instead of updating the balance,
which is better because it makes eth_call semantics less surprising. Removing
the built-in balance assignment also makes balance overrides work as expected.
* metrics: disable CPU stats (gosigar) on iOS
* cmd/devp2p: tweak DNS TTLs (#20801)
* cmd/devp2p: tweak DNS TTLs
* cmd/devp2p: bump treeNodeTTL to four weeks
* cmd/devp2p: lower route53 change limit again (#20819)
* cmd/devp2p: be very correct about route53 change splitting (#20820)
Turns out the way RDATA limits work is documented after all,
I just didn't search right. The trick to make it work is to
count UPSERTs twice.
This also adds an additional check to ensure TTL changes are
applied on existing records.
* graphql, node, rpc: fix typos in comments (#20824)
* eth: improve shutdown synchronization (#20695)
* eth: improve shutdown synchronization
Most goroutines started by eth.Ethereum didn't have any shutdown sync at
all, which lead to weird error messages when quitting the client.
This change improves the clean shutdown path by stopping all internal
components in dependency order and waiting for them to actually be
stopped before shutdown is considered done. In particular, we now stop
everything related to peers before stopping 'resident' parts such as
core.BlockChain.
* eth: rewrite sync controller
* eth: remove sync start debug message
* eth: notify chainSyncer about new peers after handshake
* eth: move downloader.Cancel call into chainSyncer
* eth: make post-sync block broadcast synchronous
* eth: add comments
* core: change blockchain stop message
* eth: change closeBloomHandler channel type
* eth/filters: fix typo on unindexedLogs function's comment (#20827)
* core: bump txpool tx max size to 128KB
* snapshotter/tests: verify snapdb post-state against trie (#20812)
* core/state/snapshot: basic trie-to-hash implementation
* tests: validate snapshot after test
* core/state/snapshot: fix review concerns
* cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484)
* cmd, consensus: add option to disable mmap for DAG caches/datasets
* consensus: add benchmarks for mmap with/with lock
* cmd/clef: add newaccount command (#20782)
* cmd/clef: add newaccount command
* cmd/clef: document clef_New, update API versioning
* Update cmd/clef/intapi_changelog.md
Co-Authored-By: ligi <ligi@ligi.de>
* Update signer/core/uiapi.go
Co-Authored-By: ligi <ligi@ligi.de>
Co-authored-by: ligi <ligi@ligi.de>
* eth: add debug_accountRange API (#19645)
This new API allows reading accounts and their content by address range.
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
* travis: allow cocoapods deploy to fail (#20833)
* metrics: improve TestTimerFunc (#20818)
The test failed due to what appears to be fluctuations in time.Sleep, which is
not the actual method under test. This change modifies it so we compare the
metered Max to the actual time instead of the desired time.
* README: update private network genesis spec with istanbul (#20841)
* add istanbul and muirGlacier to genesis states in README
* remove muirGlacier, relocate istanbul
* cmd/evm: Rework execution stats (#20792)
- Dump stats also for --bench flag.
- From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested.
- Now the mem stats are for single execution in case of --bench.
* cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843)
* p2p/server: add UDP port mapping goroutine to wait group (#20846)
* accounts/abi faster unpacking of int256 (#20850)
* p2p/discv5: add missing Timer.Stop calls (#20853)
* miner/worker: add missing timer.Stop call (#20857)
* cmd/geth: fix bad genesis test (#20860)
* eth/filters: add missing Ticker.Stop call (#20862)
* eth/fetcher: add missing timer.Stop calls (#20861)
* event: add missing timer.Stop call in TestFeed (#20868)
* metrics: add missing calls to Ticker.Stop in tests (#20866)
* ethstats: add missing Ticker.Stop call (#20867)
* p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869)
* core: add missing Timer.Stop call in TestLogReorgs (#20870)
* rpc: add missing timer.Stop calls in websocket tests (#20863)
* crypto/ecies: improve concatKDF (#20836)
This removes a bunch of weird code around the counter overflow check in
concatKDF and makes it actually work for different hash output sizes.
The overflow check worked as follows: concatKDF applies the hash function N
times, where N is roundup(kdLen, hashsize) / hashsize. N should not
overflow 32 bits because that would lead to a repetition in the KDF output.
A couple issues with the overflow check:
- It used the hash.BlockSize, which is wrong because the
block size is about the input of the hash function. Luckily, all standard
hash functions have a block size that's greater than the output size, so
concatKDF didn't crash, it just generated too much key material.
- The check used big.Int to compare against 2^32-1.
- The calculation could still overflow before reaching the check.
The new code in concatKDF doesn't check for overflow. Instead, there is a
new check on ECIESParams which ensures that params.KeyLen is < 512. This
removes any possibility of overflow.
There are a couple of miscellaneous improvements bundled in with this
change:
- The key buffer is pre-allocated instead of appending the hash output
to an initially empty slice.
- The code that uses concatKDF to derive keys is now shared between Encrypt
and Decrypt.
- There was a redundant invocation of IsOnCurve in Decrypt. This is now removed
because elliptic.Unmarshal already checks whether the input is a valid curve
point since Go 1.5.
Co-authored-by: Felix Lange <fjl@twurst.com>
* rpc: metrics for JSON-RPC method calls (#20847)
This adds a couple of metrics for tracking the timing
and frequency of method calls:
- rpc/requests gauge counts all requests
- rpc/success gauge counts requests which return err == nil
- rpc/failure gauge counts requests which return err != nil
- rpc/duration/all timer tracks timing of all requests
- rpc/duration/<method>/<success/failure> tracks per-method timing
* mobile: use bind.NewKeyedTransactor instead of duplicating (#20888)
It's better to reuse the existing code to create a keyed transactor
than to rewrite the logic again.
* internal/ethapi: add CallArgs.ToMessage method (#20854)
ToMessage is used to convert between ethapi.CallArgs and types.Message.
It reduces the length of the DoCall method by about half by abstracting out
the conversion between the CallArgs and the Message. This should improve the
code's maintainability and reusability.
* eth, les: fix flaky tests (#20897)
* les: fix flaky test
* eth: fix flaky test
* cmd/geth: enable metrics for geth import command (#20738)
* cmd/geth: enable metrics for geth import command
* cmd/geth: enable metrics-flags for import command
* core/vm: use a callcontext struct (#20761)
* core/vm: use a callcontext struct
* core/vm: fix tests
* core/vm/runtime: benchmark
* core/vm: make intpool push inlineable, unexpose callcontext
* docs/audits: add discv5 protocol audits from LA and C53 (#20898)
* .github: change gitter reference to discord link in issue template (#20896)
* couple of fixes to docs in clef (#20900)
* p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen.
* build: upgrade to golangci-lint 1.24.0 (#20901)
* accounts/scwallet: remove unnecessary uses of fmt.Sprintf
* cmd/puppeth: remove unnecessary uses of fmt.Sprintf
* p2p/discv5: remove unnecessary use of fmt.Sprintf
* whisper/mailserver: remove unnecessary uses of fmt.Sprintf
* core: goimports -w tx_pool_test.go
* eth/downloader: goimports -w downloader_test.go
* build: upgrade to golangci-lint 1.24.0
* accounts/abi/bind: Refactored topics (#20851)
* accounts/abi/bind: refactored topics
* accounts/abi/bind: use store function to remove code duplication
* accounts/abi/bind: removed unused type defs
* accounts/abi/bind: error on tuples in topics
* Cosmetic changes to restart travis build
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
* node: allow websocket and HTTP on the same port (#20810)
This change makes it possible to run geth with JSON-RPC over HTTP and
WebSocket on the same TCP port. The default port for WebSocket
is still 8546.
geth --rpc --rpcport 8545 --ws --wsport 8545
This also removes a lot of deprecated API surface from package rpc.
The rpc package is now purely about serving JSON-RPC and no longer
provides a way to start an HTTP server.
* crypto: improve error messages in LoadECDSA (#20718)
This improves error messages when the file is too short or too long.
Also rewrite the test for SaveECDSA because LoadECDSA has its own
test now.
Co-authored-by: Felix Lange <fjl@twurst.com>
* changed date of rpcstack.go since new file (#20904)
* accounts/abi/bind: fixed erroneous filtering of negative ints (#20865)
* accounts/abi/bind: fixed erroneous packing of negative ints
* accounts/abi/bind: added test cases for negative ints in topics
* accounts/abi/bind: fixed genIntType for go 1.12
* accounts/abi: minor nitpick
* cmd: deprecate --testnet, use named networks instead (#20852)
* cmd/utils: make goerli the default testnet
* cmd/geth: explicitly rename testnet to ropsten
* core: explicitly rename testnet to ropsten
* params: explicitly rename testnet to ropsten
* cmd: explicitly rename testnet to ropsten
* miner: explicitly rename testnet to ropsten
* mobile: allow for returning the goerli spec
* tests: explicitly rename testnet to ropsten
* docs: update readme to reflect changes to the default testnet
* mobile: allow for configuring goerli and rinkeby nodes
* cmd/geth: revert --testnet back to ropsten and mark as legacy
* cmd/util: mark --testnet flag as deprecated
* docs: update readme to properly reflect the 3 testnets
* cmd/utils: add an explicit deprecation warning on startup
* cmd/utils: swap goerli and ropsten in usage
* cmd/geth: swap goerli and ropsten in usage
* cmd/geth: if running a known preset, log it for convenience
* docs: improve readme on usage of ropsten's testnet datadir
* cmd/utils: check if legacy `testnet` datadir exists for ropsten
* cmd/geth: check for legacy testnet path in console command
* cmd/geth: use switch statement for complex conditions in main
* cmd/geth: move known preset log statement to the very top
* cmd/utils: create new ropsten configurations in the ropsten datadir
* cmd/utils: makedatadir should check for existing testnet dir
* cmd/geth: add legacy testnet flag to the copy db command
* cmd/geth: add legacy testnet flag to the inspect command
* les, les/lespay/client: add service value statistics and API (#20837)
This PR adds service value measurement statistics to the light client. It
also adds a private API that makes these statistics accessible. A follow-up
PR will add the new server pool which uses these statistics to select
servers with good performance.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
* README: update min go version to 1.13 (#20911)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2
* travis, appveyor: force GO111MODULE=on for every build
* core/rawdb: fix data race between Retrieve and Close (#20919)
* core/rawdb: fixed data race between retrieve and close
closes https://github.com/ethereum/go-ethereum/issues/20420
* core/rawdb: use non-atomic load while holding mutex
* all: simplify and fix database iteration with prefix/start (#20808)
* core/state/snapshot: start fixing disk iterator seek
* ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start
* les, core/state/snapshot: iterator fixes
* all: remove two iterator methods
* all: rename Iteratee.NewIteratorWith -> NewIterator
* ethdb: fix review concerns
* params: update CHTs for the 1.9.13 release
* params: release Geth v1.9.13
* added some missing files
* post-rebase fixups
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Co-authored-by: Ha ĐANG <dvietha@gmail.com>
Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Wenbiao Zheng <delweng@gmail.com>
Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com>
Co-authored-by: Jeff Wentworth <jeff@curvegrid.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Luke Champine <luke.champine@gmail.com>
Co-authored-by: Boqin Qin <Bobbqqin@gmail.com>
Co-authored-by: William Morriss <wjmelements@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
|
|
|
cfg.Genesis = core.DefaultRopstenGenesisBlock()
|
2020-10-05 10:50:26 +00:00
|
|
|
SetDNSDiscoveryDefaults(cfg, params.RopstenGenesisHash)
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.RinkebyChainName:
|
2017-05-04 09:36:20 +00:00
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2019-05-27 13:51:49 +00:00
|
|
|
cfg.NetworkID = 4
|
2017-05-04 09:36:20 +00:00
|
|
|
}
|
|
|
|
cfg.Genesis = core.DefaultRinkebyGenesisBlock()
|
2020-10-05 10:50:26 +00:00
|
|
|
SetDNSDiscoveryDefaults(cfg, params.RinkebyGenesisHash)
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.GoerliChainName:
|
2018-11-16 15:58:24 +00:00
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2019-05-27 13:51:49 +00:00
|
|
|
cfg.NetworkID = 5
|
2018-11-16 15:58:24 +00:00
|
|
|
}
|
|
|
|
cfg.Genesis = core.DefaultGoerliGenesisBlock()
|
2020-10-05 10:50:26 +00:00
|
|
|
SetDNSDiscoveryDefaults(cfg, params.GoerliGenesisHash)
|
2021-05-26 10:35:39 +00:00
|
|
|
case params.ErigonMineName:
|
2021-04-09 12:00:50 +00:00
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2021-05-26 10:35:39 +00:00
|
|
|
cfg.NetworkID = new(big.Int).SetBytes([]byte("erigon-mine")).Uint64() // erigon-mine
|
2021-04-09 12:00:50 +00:00
|
|
|
}
|
2021-05-26 10:35:39 +00:00
|
|
|
cfg.Genesis = core.DefaultErigonGenesisBlock()
|
2021-06-02 07:42:52 +00:00
|
|
|
case params.CalaverasChainName:
|
2021-04-22 17:11:37 +00:00
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2021-06-02 07:42:52 +00:00
|
|
|
cfg.NetworkID = 123 // https://gist.github.com/holiman/c5697b041b3dc18c50a5cdd382cbdd16
|
2021-04-22 17:11:37 +00:00
|
|
|
}
|
2021-06-02 07:42:52 +00:00
|
|
|
cfg.Genesis = core.DefaultCalaverasGenesisBlock()
|
2021-06-07 11:01:54 +00:00
|
|
|
case params.SokolChainName:
|
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
|
|
|
cfg.NetworkID = 77
|
|
|
|
}
|
|
|
|
cfg.Genesis = core.DefaultSokolGenesisBlock()
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.DevChainName:
|
2018-06-14 09:31:31 +00:00
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
|
2019-05-27 13:51:49 +00:00
|
|
|
cfg.NetworkID = 1337
|
2018-06-14 09:31:31 +00:00
|
|
|
}
|
2017-10-24 10:40:42 +00:00
|
|
|
// Create new developer account or reuse existing one
|
2021-03-26 18:05:42 +00:00
|
|
|
developer := cfg.Miner.Etherbase
|
|
|
|
if developer == (common.Address{}) {
|
|
|
|
Fatalf("Please specify developer account address using --miner.etherbase")
|
2017-10-24 10:40:42 +00:00
|
|
|
}
|
2021-03-26 18:05:42 +00:00
|
|
|
log.Info("Using developer account", "address", developer)
|
2017-10-24 10:40:42 +00:00
|
|
|
|
2020-07-21 12:53:47 +00:00
|
|
|
// Create a new developer genesis block or reuse existing one
|
2021-03-26 18:05:42 +00:00
|
|
|
cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer)
|
2021-03-12 17:26:06 +00:00
|
|
|
if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
|
2019-04-23 07:08:51 +00:00
|
|
|
cfg.Miner.GasPrice = big.NewInt(1)
|
2015-09-06 13:46:54 +00:00
|
|
|
}
|
2020-02-13 13:38:30 +00:00
|
|
|
default:
|
2021-04-09 16:44:25 +00:00
|
|
|
Fatalf("Chain name is not recognized: %s", chain)
|
2015-09-06 13:46:54 +00:00
|
|
|
}
|
2017-04-12 14:27:23 +00:00
|
|
|
}
|
2015-12-16 03:26:23 +00:00
|
|
|
|
2020-10-05 10:50:26 +00:00
|
|
|
// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if
|
2020-02-13 13:38:30 +00:00
|
|
|
// no URLs are set.
|
2021-04-25 04:20:50 +00:00
|
|
|
func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) {
|
2020-12-14 09:27:15 +00:00
|
|
|
if cfg.EthDiscoveryURLs != nil {
|
2020-05-22 11:46:34 +00:00
|
|
|
return // already set through flags/config
|
|
|
|
}
|
2020-05-25 17:50:36 +00:00
|
|
|
protocol := "all"
|
2020-05-22 11:46:34 +00:00
|
|
|
if url := params.KnownDNSNetwork(genesis, protocol); url != "" {
|
2020-12-14 09:27:15 +00:00
|
|
|
cfg.EthDiscoveryURLs = []string{url}
|
|
|
|
}
|
2020-02-13 13:38:30 +00:00
|
|
|
}
|
|
|
|
|
2019-01-29 08:14:24 +00:00
|
|
|
func SplitTagsFlag(tagsFlag string) map[string]string {
|
|
|
|
tags := strings.Split(tagsFlag, ",")
|
|
|
|
tagsMap := map[string]string{}
|
|
|
|
|
|
|
|
for _, t := range tags {
|
|
|
|
if t != "" {
|
|
|
|
kv := strings.Split(t, "=")
|
|
|
|
|
|
|
|
if len(kv) == 2 {
|
|
|
|
tagsMap[kv[0]] = kv[1]
|
|
|
|
}
|
2018-07-02 12:51:02 +00:00
|
|
|
}
|
|
|
|
}
|
2019-01-29 08:14:24 +00:00
|
|
|
|
|
|
|
return tagsMap
|
2018-07-02 12:51:02 +00:00
|
|
|
}
|
|
|
|
|
2019-10-30 17:33:01 +00:00
|
|
|
// MakeChainDatabase open a database using the flags passed to the client and will hard crash if it fails.
|
2021-07-04 07:50:32 +00:00
|
|
|
func MakeChainDatabase(cfg *node.Config) ethdb.RwKV {
|
|
|
|
chainDb, err := node.OpenDatabase(cfg, ethdb.Chain)
|
2016-03-01 22:32:43 +00:00
|
|
|
if err != nil {
|
2017-02-22 15:22:50 +00:00
|
|
|
Fatalf("Could not open database: %v", err)
|
2015-04-13 08:13:52 +00:00
|
|
|
}
|
2016-03-01 22:32:43 +00:00
|
|
|
return chainDb
|
|
|
|
}
|
|
|
|
|
2017-03-02 13:03:33 +00:00
|
|
|
func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
|
|
|
var genesis *core.Genesis
|
2021-04-08 07:39:40 +00:00
|
|
|
chain := ctx.GlobalString(ChainFlag.Name)
|
|
|
|
switch chain {
|
|
|
|
case params.RopstenChainName:
|
geth 1.9.13 (#469)
* core: initial version of state snapshots
* core/state: lazy sorting, snapshot invalidation
* core/state/snapshot: extract and split cap method, cover corners
* snapshot: iteration and buffering optimizations
* core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
* 123
* core/rawdb, core/state/snapshot: runtime snapshot generation
* core/state/snapshot: fix difflayer origin-initalization after flatten
* add "to merge"
* core/state/snapshot: implement snapshot layer iteration
* core/state/snapshot: node behavioural difference on bloom content
* core: journal the snapshot inside leveldb, not a flat file
* core/state/snapshot: bloom, metrics and prefetcher fixes
* core/state/snapshot: move iterator out into its own files
* core/state/snapshot: implement iterator priority for fast direct data lookup
* core/state/snapshot: full featured account iteration
* core/state/snapshot: faster account iteration, CLI integration
* core: fix broken tests due to API changes + linter
* core/state: fix an account resurrection issue
* core/tests: test for destroy+recreate contract with storage
* squashme
* core/state/snapshot, tests: sync snap gen + snaps in consensus tests
* core/state: extend snapshotter to handle account resurrections
* core/state: fix account root hash update point
* core/state: fix resurrection state clearing and access
* core/state/snapshot: handle deleted accounts in fast iterator
* core: more blockchain tests
* core/state/snapshot: fix various iteration issues due to destruct set
* core: fix two snapshot iterator flaws, decollide snap storage prefix
* core/state/snapshot/iterator: fix two disk iterator flaws
* core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix
* params: begin v1.9.13 release cycle
* cmd/checkpoint-admin: add some documentation (#20697)
* go.mod: update duktape to fix sprintf warnings (#20777)
This revision of go-duktype fixes the following warning
```
duk_logging.c: In function ‘duk__logger_prototype_log_shared’:
duk_logging.c:184:64: warning: ‘Z’ directive writing 1 byte into a region of size between 0 and 9 [-Wformat-overflow=]
184 | sprintf((char *) date_buf, "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
| ^
In file included from /usr/include/stdio.h:867,
from duk_logging.c:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 25 and 85 bytes into a destination of size 32
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* core/rawdb: fix freezer table test error check
Fixes: Condition is always 'false' because 'err' is always 'nil'
* core/rawdb: improve table database (#20703)
This PR fixes issues in TableDatabase.
TableDatabase is a wrapper of underlying ethdb.Database with an additional prefix.
The prefix is applied to all entries it maintains. However when we try to retrieve entries
from it we don't handle the key properly. In theory the prefix should be truncated and
only user key is returned. But we don't do it in some cases, e.g. the iterator and batch
replayer created from it. So this PR is the fix to these issues.
* eth: when triggering a sync, check the head header TD, not block
* internal/web3ext: fix clique console apis to work on missing arguments
* rpc: dont log an error if user configures --rpcapi=rpc... (#20776)
This just prevents a false negative ERROR warning when, for some unknown
reason, a user attempts to turn on the module rpc even though it's already going
to be on.
* node, cmd/clef: report actual port used for http rpc (#20789)
* internal/ethapi: don't set sender-balance to maxuint, fixes #16999 (#20783)
Prior to this change, eth_call changed the balance of the sender account in the
EVM environment to 2^256 wei to cover the gas cost of the call execution.
We've had this behavior for a long time even though it's super confusing.
This commit sets the default call gasprice to zero instead of updating the balance,
which is better because it makes eth_call semantics less surprising. Removing
the built-in balance assignment also makes balance overrides work as expected.
* metrics: disable CPU stats (gosigar) on iOS
* cmd/devp2p: tweak DNS TTLs (#20801)
* cmd/devp2p: tweak DNS TTLs
* cmd/devp2p: bump treeNodeTTL to four weeks
* cmd/devp2p: lower route53 change limit again (#20819)
* cmd/devp2p: be very correct about route53 change splitting (#20820)
Turns out the way RDATA limits work is documented after all,
I just didn't search right. The trick to make it work is to
count UPSERTs twice.
This also adds an additional check to ensure TTL changes are
applied on existing records.
* graphql, node, rpc: fix typos in comments (#20824)
* eth: improve shutdown synchronization (#20695)
* eth: improve shutdown synchronization
Most goroutines started by eth.Ethereum didn't have any shutdown sync at
all, which lead to weird error messages when quitting the client.
This change improves the clean shutdown path by stopping all internal
components in dependency order and waiting for them to actually be
stopped before shutdown is considered done. In particular, we now stop
everything related to peers before stopping 'resident' parts such as
core.BlockChain.
* eth: rewrite sync controller
* eth: remove sync start debug message
* eth: notify chainSyncer about new peers after handshake
* eth: move downloader.Cancel call into chainSyncer
* eth: make post-sync block broadcast synchronous
* eth: add comments
* core: change blockchain stop message
* eth: change closeBloomHandler channel type
* eth/filters: fix typo on unindexedLogs function's comment (#20827)
* core: bump txpool tx max size to 128KB
* snapshotter/tests: verify snapdb post-state against trie (#20812)
* core/state/snapshot: basic trie-to-hash implementation
* tests: validate snapshot after test
* core/state/snapshot: fix review concerns
* cmd, consensus: add option to disable mmap for DAG caches/datasets (#20484)
* cmd, consensus: add option to disable mmap for DAG caches/datasets
* consensus: add benchmarks for mmap with/with lock
* cmd/clef: add newaccount command (#20782)
* cmd/clef: add newaccount command
* cmd/clef: document clef_New, update API versioning
* Update cmd/clef/intapi_changelog.md
Co-Authored-By: ligi <ligi@ligi.de>
* Update signer/core/uiapi.go
Co-Authored-By: ligi <ligi@ligi.de>
Co-authored-by: ligi <ligi@ligi.de>
* eth: add debug_accountRange API (#19645)
This new API allows reading accounts and their content by address range.
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
* travis: allow cocoapods deploy to fail (#20833)
* metrics: improve TestTimerFunc (#20818)
The test failed due to what appears to be fluctuations in time.Sleep, which is
not the actual method under test. This change modifies it so we compare the
metered Max to the actual time instead of the desired time.
* README: update private network genesis spec with istanbul (#20841)
* add istanbul and muirGlacier to genesis states in README
* remove muirGlacier, relocate istanbul
* cmd/evm: Rework execution stats (#20792)
- Dump stats also for --bench flag.
- From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested.
- Now the mem stats are for single execution in case of --bench.
* cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843)
* p2p/server: add UDP port mapping goroutine to wait group (#20846)
* accounts/abi faster unpacking of int256 (#20850)
* p2p/discv5: add missing Timer.Stop calls (#20853)
* miner/worker: add missing timer.Stop call (#20857)
* cmd/geth: fix bad genesis test (#20860)
* eth/filters: add missing Ticker.Stop call (#20862)
* eth/fetcher: add missing timer.Stop calls (#20861)
* event: add missing timer.Stop call in TestFeed (#20868)
* metrics: add missing calls to Ticker.Stop in tests (#20866)
* ethstats: add missing Ticker.Stop call (#20867)
* p2p/discv5, p2p/testing: add missing Timer.Stop calls in tests (#20869)
* core: add missing Timer.Stop call in TestLogReorgs (#20870)
* rpc: add missing timer.Stop calls in websocket tests (#20863)
* crypto/ecies: improve concatKDF (#20836)
This removes a bunch of weird code around the counter overflow check in
concatKDF and makes it actually work for different hash output sizes.
The overflow check worked as follows: concatKDF applies the hash function N
times, where N is roundup(kdLen, hashsize) / hashsize. N should not
overflow 32 bits because that would lead to a repetition in the KDF output.
A couple issues with the overflow check:
- It used the hash.BlockSize, which is wrong because the
block size is about the input of the hash function. Luckily, all standard
hash functions have a block size that's greater than the output size, so
concatKDF didn't crash, it just generated too much key material.
- The check used big.Int to compare against 2^32-1.
- The calculation could still overflow before reaching the check.
The new code in concatKDF doesn't check for overflow. Instead, there is a
new check on ECIESParams which ensures that params.KeyLen is < 512. This
removes any possibility of overflow.
There are a couple of miscellaneous improvements bundled in with this
change:
- The key buffer is pre-allocated instead of appending the hash output
to an initially empty slice.
- The code that uses concatKDF to derive keys is now shared between Encrypt
and Decrypt.
- There was a redundant invocation of IsOnCurve in Decrypt. This is now removed
because elliptic.Unmarshal already checks whether the input is a valid curve
point since Go 1.5.
Co-authored-by: Felix Lange <fjl@twurst.com>
* rpc: metrics for JSON-RPC method calls (#20847)
This adds a couple of metrics for tracking the timing
and frequency of method calls:
- rpc/requests gauge counts all requests
- rpc/success gauge counts requests which return err == nil
- rpc/failure gauge counts requests which return err != nil
- rpc/duration/all timer tracks timing of all requests
- rpc/duration/<method>/<success/failure> tracks per-method timing
* mobile: use bind.NewKeyedTransactor instead of duplicating (#20888)
It's better to reuse the existing code to create a keyed transactor
than to rewrite the logic again.
* internal/ethapi: add CallArgs.ToMessage method (#20854)
ToMessage is used to convert between ethapi.CallArgs and types.Message.
It reduces the length of the DoCall method by about half by abstracting out
the conversion between the CallArgs and the Message. This should improve the
code's maintainability and reusability.
* eth, les: fix flaky tests (#20897)
* les: fix flaky test
* eth: fix flaky test
* cmd/geth: enable metrics for geth import command (#20738)
* cmd/geth: enable metrics for geth import command
* cmd/geth: enable metrics-flags for import command
* core/vm: use a callcontext struct (#20761)
* core/vm: use a callcontext struct
* core/vm: fix tests
* core/vm/runtime: benchmark
* core/vm: make intpool push inlineable, unexpose callcontext
* docs/audits: add discv5 protocol audits from LA and C53 (#20898)
* .github: change gitter reference to discord link in issue template (#20896)
* couple of fixes to docs in clef (#20900)
* p2p/discover: add initial discovery v5 implementation (#20750)This adds an implementation of the current discovery v5 spec.There is full integration with cmd/devp2p and enode.Iterator in thisversion. In theory we could enable the new protocol as a replacement ofdiscovery v4 at any time. In practice, there will likely be a few morechanges to the spec and implementation before this can happen.
* build: upgrade to golangci-lint 1.24.0 (#20901)
* accounts/scwallet: remove unnecessary uses of fmt.Sprintf
* cmd/puppeth: remove unnecessary uses of fmt.Sprintf
* p2p/discv5: remove unnecessary use of fmt.Sprintf
* whisper/mailserver: remove unnecessary uses of fmt.Sprintf
* core: goimports -w tx_pool_test.go
* eth/downloader: goimports -w downloader_test.go
* build: upgrade to golangci-lint 1.24.0
* accounts/abi/bind: Refactored topics (#20851)
* accounts/abi/bind: refactored topics
* accounts/abi/bind: use store function to remove code duplication
* accounts/abi/bind: removed unused type defs
* accounts/abi/bind: error on tuples in topics
* Cosmetic changes to restart travis build
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
* node: allow websocket and HTTP on the same port (#20810)
This change makes it possible to run geth with JSON-RPC over HTTP and
WebSocket on the same TCP port. The default port for WebSocket
is still 8546.
geth --rpc --rpcport 8545 --ws --wsport 8545
This also removes a lot of deprecated API surface from package rpc.
The rpc package is now purely about serving JSON-RPC and no longer
provides a way to start an HTTP server.
* crypto: improve error messages in LoadECDSA (#20718)
This improves error messages when the file is too short or too long.
Also rewrite the test for SaveECDSA because LoadECDSA has its own
test now.
Co-authored-by: Felix Lange <fjl@twurst.com>
* changed date of rpcstack.go since new file (#20904)
* accounts/abi/bind: fixed erroneous filtering of negative ints (#20865)
* accounts/abi/bind: fixed erroneous packing of negative ints
* accounts/abi/bind: added test cases for negative ints in topics
* accounts/abi/bind: fixed genIntType for go 1.12
* accounts/abi: minor nitpick
* cmd: deprecate --testnet, use named networks instead (#20852)
* cmd/utils: make goerli the default testnet
* cmd/geth: explicitly rename testnet to ropsten
* core: explicitly rename testnet to ropsten
* params: explicitly rename testnet to ropsten
* cmd: explicitly rename testnet to ropsten
* miner: explicitly rename testnet to ropsten
* mobile: allow for returning the goerli spec
* tests: explicitly rename testnet to ropsten
* docs: update readme to reflect changes to the default testnet
* mobile: allow for configuring goerli and rinkeby nodes
* cmd/geth: revert --testnet back to ropsten and mark as legacy
* cmd/util: mark --testnet flag as deprecated
* docs: update readme to properly reflect the 3 testnets
* cmd/utils: add an explicit deprecation warning on startup
* cmd/utils: swap goerli and ropsten in usage
* cmd/geth: swap goerli and ropsten in usage
* cmd/geth: if running a known preset, log it for convenience
* docs: improve readme on usage of ropsten's testnet datadir
* cmd/utils: check if legacy `testnet` datadir exists for ropsten
* cmd/geth: check for legacy testnet path in console command
* cmd/geth: use switch statement for complex conditions in main
* cmd/geth: move known preset log statement to the very top
* cmd/utils: create new ropsten configurations in the ropsten datadir
* cmd/utils: makedatadir should check for existing testnet dir
* cmd/geth: add legacy testnet flag to the copy db command
* cmd/geth: add legacy testnet flag to the inspect command
* les, les/lespay/client: add service value statistics and API (#20837)
This PR adds service value measurement statistics to the light client. It
also adds a private API that makes these statistics accessible. A follow-up
PR will add the new server pool which uses these statistics to select
servers with good performance.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
* README: update min go version to 1.13 (#20911)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2 (#20913)
* travis, appveyor, build, Dockerfile: bump Go to 1.14.2
* travis, appveyor: force GO111MODULE=on for every build
* core/rawdb: fix data race between Retrieve and Close (#20919)
* core/rawdb: fixed data race between retrieve and close
closes https://github.com/ethereum/go-ethereum/issues/20420
* core/rawdb: use non-atomic load while holding mutex
* all: simplify and fix database iteration with prefix/start (#20808)
* core/state/snapshot: start fixing disk iterator seek
* ethdb, rawdb, leveldb, memorydb: implement iterators with prefix and start
* les, core/state/snapshot: iterator fixes
* all: remove two iterator methods
* all: rename Iteratee.NewIteratorWith -> NewIterator
* ethdb: fix review concerns
* params: update CHTs for the 1.9.13 release
* params: release Geth v1.9.13
* added some missing files
* post-rebase fixups
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: gary rong <garyrong0905@gmail.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Co-authored-by: Ha ĐANG <dvietha@gmail.com>
Co-authored-by: Hanjiang Yu <42531996+de1acr0ix@users.noreply.github.com>
Co-authored-by: ligi <ligi@ligi.de>
Co-authored-by: Wenbiao Zheng <delweng@gmail.com>
Co-authored-by: Adam Schmideg <adamschmideg@users.noreply.github.com>
Co-authored-by: Jeff Wentworth <jeff@curvegrid.com>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Co-authored-by: ucwong <ucwong@126.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Luke Champine <luke.champine@gmail.com>
Co-authored-by: Boqin Qin <Bobbqqin@gmail.com>
Co-authored-by: William Morriss <wjmelements@gmail.com>
Co-authored-by: Guillaume Ballet <gballet@gmail.com>
Co-authored-by: Raw Pong Ghmoa <58883403+q9f@users.noreply.github.com>
Co-authored-by: Felföldi Zsolt <zsfelfoldi@gmail.com>
2020-04-19 17:31:47 +00:00
|
|
|
genesis = core.DefaultRopstenGenesisBlock()
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.RinkebyChainName:
|
2017-05-04 09:36:20 +00:00
|
|
|
genesis = core.DefaultRinkebyGenesisBlock()
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.GoerliChainName:
|
2018-11-16 15:58:24 +00:00
|
|
|
genesis = core.DefaultGoerliGenesisBlock()
|
2021-05-26 10:35:39 +00:00
|
|
|
case params.ErigonMineName:
|
|
|
|
genesis = core.DefaultErigonGenesisBlock()
|
2021-06-02 07:42:52 +00:00
|
|
|
case params.CalaverasChainName:
|
|
|
|
genesis = core.DefaultCalaverasGenesisBlock()
|
2021-06-07 11:01:54 +00:00
|
|
|
case params.SokolChainName:
|
|
|
|
genesis = core.DefaultSokolGenesisBlock()
|
2021-04-08 07:39:40 +00:00
|
|
|
case params.DevChainName:
|
2017-10-24 10:40:42 +00:00
|
|
|
Fatalf("Developer chains are ephemeral")
|
2017-03-02 13:03:33 +00:00
|
|
|
}
|
|
|
|
return genesis
|
|
|
|
}
|
|
|
|
|
2016-05-06 09:40:23 +00:00
|
|
|
// MakeConsolePreloads retrieves the absolute paths for the console JavaScript
|
|
|
|
// scripts to preload before starting.
|
|
|
|
func MakeConsolePreloads(ctx *cli.Context) []string {
|
|
|
|
// Skip preloading if there's nothing to preload
|
|
|
|
if ctx.GlobalString(PreloadJSFlag.Name) == "" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
// Otherwise resolve absolute paths and return them
|
2019-02-14 23:02:11 +00:00
|
|
|
var preloads []string
|
2016-05-06 09:40:23 +00:00
|
|
|
|
|
|
|
for _, file := range strings.Split(ctx.GlobalString(PreloadJSFlag.Name), ",") {
|
2021-01-12 14:50:11 +00:00
|
|
|
preloads = append(preloads, strings.TrimSpace(file))
|
2016-05-06 09:40:23 +00:00
|
|
|
}
|
|
|
|
return preloads
|
|
|
|
}
|
2017-04-28 10:38:49 +00:00
|
|
|
|
2020-04-12 18:36:14 +00:00
|
|
|
func CobraFlags(cmd *cobra.Command, urfaveCliFlags []cli.Flag) {
|
|
|
|
flags := cmd.PersistentFlags()
|
|
|
|
for _, flag := range urfaveCliFlags {
|
|
|
|
switch f := flag.(type) {
|
|
|
|
case cli.IntFlag:
|
|
|
|
flags.Int(f.Name, f.Value, f.Usage)
|
|
|
|
case cli.StringFlag:
|
|
|
|
flags.String(f.Name, f.Value, f.Usage)
|
|
|
|
case cli.BoolFlag:
|
|
|
|
flags.Bool(f.Name, false, f.Usage)
|
|
|
|
default:
|
|
|
|
panic(fmt.Errorf("unexpected type: %T", flag))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|