Commit Graph

13485 Commits

Author SHA1 Message Date
Péter Szilágyi
ac5fc75e07 cmd/utils: enable snapshots by default
# Conflicts:
#	cmd/utils/flags.go
2021-03-10 10:28:08 +01:00
Guillaume Ballet
1ccf0ee51c consensus: remove seal verification from the consensus engine interface (#22274)
# Conflicts:
#	consensus/ethash/algorithm_test.go
2021-03-10 10:27:50 +01:00
Martin Holst Swende
aaeb4a40a3 eth: don't wait for snap registration if we're not running snap (#22272)
Prevents a situation where we (not running snap) connects with a peer running snap, and get stalled waiting for snap registration to succeed (which will never happen), which cause a waitgroup wait to halt shutdown
2021-03-10 10:26:58 +01:00
Marius van der Wijden
da73189b00 internal/ethapi: fix typo in comment (#22271) 2021-03-10 10:26:47 +01:00
gary rong
7d799473e5 eth: move eth.Config to a common package (#22205)
This moves the eth config definition into a separate package, eth/ethconfig.
Packages eth and les can now import this common package instead of
importing eth from les, reducing dependencies.

Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	cmd/faucet/faucet.go
#	cmd/geth/config.go
#	cmd/utils/cmd.go
#	cmd/utils/flags.go
#	cmd/utils/flags_legacy.go
#	console/console_test.go
#	eth/backend.go
#	eth/bloombits.go
#	eth/ethconfig/config.go
#	ethclient/ethclient_test.go
#	graphql/graphql_test.go
#	les/api_test.go
#	les/client.go
#	les/commons.go
#	les/costtracker.go
#	les/server.go
#	les/test_helper.go
#	mobile/geth.go
2021-03-10 10:25:55 +01:00
Marius van der Wijden
27e1102b52 internal/ethapi: comment nitpick (#22270) 2021-03-10 10:08:57 +01:00
Marius van der Wijden
67f26fad00 fuzzers: added consensys/gurvy library to bn256 differential fuzzer (#21812)
This pr adds consensys' gurvy bn256 variant into the code for differential fuzzing.
# Conflicts:
#	go.mod
#	go.sum
#	tests/fuzzers/bn256/bn256_fuzz.go
2021-03-10 10:08:43 +01:00
Marius van der Wijden
d6266d7230 core: reset txpool state on sethead (#22247)
fixes an issue where local transactions that were included in the chain before a SetHead were rejected if resubmitted, since the txpool had not reset the state to the current (older) state.
2021-03-10 10:07:01 +01:00
alex.sharov
e79d3b414a table stat metrics 2021-03-10 11:11:03 +07:00
Alex Sharov
060f3b9a60
Grafana: add Btree metrics (#1547) 2021-03-10 10:58:57 +07:00
ucwong
e7cc88e4af trie : use trie.NewStackTrie instead of new(trie.Trie) (#22246)
The PR makes use of the stacktrie, which is is more lenient on resource consumption, than the regular trie, in cases where we only need it for DeriveSha
# Conflicts:
#	cmd/evm/internal/t8ntool/execution.go
#	consensus/clique/clique.go
#	consensus/ethash/consensus.go
#	core/genesis.go
#	core/tx_pool_test.go
#	eth/fetcher/block_fetcher.go
#	eth/fetcher/block_fetcher_test.go
#	les/odr_requests.go
#	miner/miner_test.go
#	miner/worker.go
#	turbo/stages/blockchain_test.go
2021-03-09 15:57:28 +01:00
Alex Prut
1fb76cca04 all: remove unneeded parentheses (#21921)
* remove uneeded convertion type

* remove redundant type in composite literal

* omit explicit type where implicit

* remove unused redundant parenthesis

* remove redundant import alias duktape
# Conflicts:
#	core/state/snapshot/conversion.go
#	eth/tracers/tracer.go
#	metrics/cpu_syscall.go
#	trie/trie_test.go
2021-03-09 13:59:30 +01:00
rene
a0af38304e cmd/geth, node: allow configuring JSON-RPC on custom path prefix (#22184)
This change allows users to set a custom path prefix on which to mount the http-rpc
or ws-rpc handlers via the new flags --http.rpcprefix and --ws.rpcprefix.

Fixes #21826

Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	cmd/geth/main.go
#	cmd/geth/usage.go
#	cmd/utils/flags.go
#	go.sum
#	graphql/graphql_test.go
#	node/node_test.go
#	node/rpcstack_test.go
2021-03-09 13:58:42 +01:00
Péter Szilágyi
08ad6aaec7 eth: check snap satelliteness, delegate drop to eth (#22235)
* eth: check snap satelliteness, delegate drop to eth

* eth: better handle eth/snap satellite relation, merge reg/unreg paths
# Conflicts:
#	eth/handler.go
#	eth/peer.go
2021-03-09 13:55:09 +01:00
Sina Mahmoodi
89846dec13 eth/tracers: fix unigram tracer (#22248) 2021-03-09 13:51:39 +01:00
Martin Holst Swende
227c57cd2e cmd/clef: don't check file permissions on windows (#22251)
Fixes #20123
2021-03-09 13:51:33 +01:00
Felföldi Zsolt
efb94a9cba les/utils: UDP rate limiter (#21930)
* les/utils: Limiter

* les/utils: dropped prior weight vs variable cost logic, using fixed weights

* les/utils: always create node selector in addressGroup

* les/utils: renamed request weight to request cost

* les/utils: simplified and improved the DoS penalty mechanism

* les/utils: minor fixes

* les/utils: made selection weight calculation nicer

* les/utils: fixed linter warning

* les/utils: more precise and reliable probabilistic test

* les/utils: fixed linter warning
# Conflicts:
#	les/utils/weighted_select.go
2021-03-09 13:51:22 +01:00
Sina Mahmoodi
c376039049 cmd,core,eth,params,tests: define yolov3 + enable EIP-2565 (#22213)
Removes the yolov2 definition, adds yolov3, including EIP-2565. This PR also disables some of the erroneously generated blockchain and statetests, and adds the new genesis hash + alloc for yolov3.
This PR disables the CLI switches for yolo, since it's not complete until we merge support for 2930.
# Conflicts:
#	cmd/evm/internal/t8ntool/execution.go
#	cmd/geth/chaincmd.go
#	cmd/geth/consolecmd.go
#	cmd/geth/main.go
#	cmd/geth/usage.go
#	cmd/utils/flags.go
#	core/state_processor.go
#	core/vm/evm.go
#	core/vm/interpreter.go
#	tests/block_test.go
2021-03-09 13:47:37 +01:00
Guillaume Ballet
f409cdad76 rpc: deprecate Client.ShhSubscribe (#22239)
It never worked, whisper uses polling.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-03-09 12:54:18 +01:00
Felföldi Zsolt
0d8a69b8c6 les: switch to new discv5 (#21940)
This PR enables running the new discv5 protocol in both LES client
and server mode. In client mode it mixes discv5 and dnsdisc iterators
(if both are enabled) and filters incoming ENRs for "les" tag and fork ID.
The old p2p/discv5 package and all references to it are removed.

Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	cmd/bootnode/main.go
#	cmd/faucet/faucet.go
#	cmd/utils/flags.go
#	les/client.go
#	les/commons.go
#	les/enr_entry.go
#	les/server.go
#	les/serverpool.go
#	les/serverpool_test.go
#	mobile/discover.go
#	mobile/params.go
#	p2p/discv5/database.go
#	p2p/discv5/metrics.go
#	p2p/discv5/net.go
#	p2p/discv5/net_test.go
#	p2p/discv5/node.go
#	p2p/discv5/node_test.go
#	p2p/discv5/sim_test.go
#	p2p/discv5/table.go
#	p2p/discv5/table_test.go
#	p2p/discv5/ticket.go
#	p2p/discv5/topic.go
#	p2p/discv5/topic_test.go
#	p2p/discv5/udp.go
#	p2p/server.go
2021-03-09 12:54:06 +01:00
Guillaume Ballet
e90a6ecd33 accounts/scwallet: update documentation (#22242) 2021-03-09 12:51:08 +01:00
Felix Lange
b33db3f184 accounts/scwallet: use go-ethereum crypto instead of go-ecdh (#22212)
* accounts/scwallet: use go-ethereum crypto instead of go-ecdh

github.com/wsddn/go-ecdh is a wrapper package for ECDH functionality
with any elliptic curve.

Since 'generic' ECDH is not required in accounts/scwallet (the curve is
always secp256k1), we can just use the standard library functionality
and our own crypto libraries to perform ECDH and save a dependency.

* Update accounts/scwallet/securechannel.go

Co-authored-by: Guillaume Ballet <gballet@gmail.com>

* Use the correct key

Co-authored-by: Guillaume Ballet <gballet@gmail.com>
# Conflicts:
#	accounts/scwallet/securechannel.go
#	go.mod
#	go.sum
2021-03-09 12:50:54 +01:00
Martin Holst Swende
c2181323b3 core: speed up header import (#21967)
This PR implements the following modifications

- Don't shortcut check if block is present, thus avoid disk lookup
- Don't check hash ancestry in early-check (it's still done in parallel checker)
- Don't check time.Now for every single header

Charts and background info can be found here: https://github.com/holiman/headerimport/blob/main/README.md
With these changes, writing 1M headers goes down to from 80s to 62s.
# Conflicts:
#	consensus/ethash/consensus.go
#	core/rawdb/freezer_table.go
2021-03-09 12:50:06 +01:00
Martin Holst Swende
cd63ae0f60 core/state: fix panic in state dumping (#22225)
# Conflicts:
#	core/state/dump.go
2021-03-09 12:48:05 +01:00
Péter Szilágyi
951ba14b7e internal/ethapi: print tx details when submitting (#22170)
This adds more info about submitted transactions in log messages.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-03-09 12:46:49 +01:00
Marius van der Wijden
ba1cf55943 tests/fuzzers/abi: fixed one-off panic with int.Min64 value (#22233)
* tests/fuzzers/abi: fixed one-off panic with int.Min64 value

* tests/fuzzers/abi: fixed one-off panic with int.Min64 value
2021-03-09 12:46:40 +01:00
Martin Holst Swende
ff2b58887f eth, p2p: reserve half peer slots for snap peers during snap sync (#22171)
* eth, p2p: reserve half peer slots for snap peers during snap sync

* eth: less logging

* eth: rework the eth/snap peer reservation logic

* eth: rework the eth/snap peer reservation logic (again)
2021-03-09 12:46:30 +01:00
gary rong
7cf0ff3b9f eth/tracers: move tracing APIs into eth/tracers (#22161)
This moves the tracing RPC API implementation to package eth/tracers.
By doing so, package eth no longer depends on tracing and the duktape JS engine.

The change also enables tracing using the light client. All tracing methods work with the
light client, but it's a lot slower compared to using a full node.
# Conflicts:
#	cmd/utils/flags.go
#	eth/api.go
#	eth/tracers/api.go
#	les/api_backend.go
2021-03-09 12:46:20 +01:00
gary rong
d30c9d7d12 core: reset to genesis when middle block is missing (#22135)
When a sethead/rewind finds that the targeted block is missing, it resets to genesis instead of crashing. Closes #22129
# Conflicts:
#	core/blockchain.go
2021-03-09 12:39:41 +01:00
Melvin Junhee Woo
ceddabdf24 snapshot: merge loops for better performance (#22160)
# Conflicts:
#	core/state/snapshot/difflayer.go
2021-03-09 12:37:43 +01:00
Igor Mandrigin
2ea14f63cc go.mod: upgrade github.com/huin/goupnp 2021-03-09 12:37:27 +01:00
rene
dc93ddac27 graphql: change receipt status to decimal instead of hex (#22187)
This PR fixes the receipt status field to be decimal instead of a hex string,
as called for by the spec.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-03-09 12:36:40 +01:00
Marius van der Wijden
75d76876a6 go.mod: update dependencies (#22216)
This updates go module dependencies as discussed in #22050.
# Conflicts:
#	go.mod
#	go.sum
2021-03-09 12:36:25 +01:00
Martin Holst Swende
e6dd171f2f eth/protocols/snap: snap sync testing (#22179)
* eth/protocols/snap: make timeout configurable

* eth/protocols/snap: snap sync testing

* eth/protocols/snap: test to trigger panic

* eth/protocols/snap: fix race condition on timeouts

* eth/protocols/snap: return error on cancelled sync

* squashme: updates + test causing panic + properly serve accounts in order

* eth/protocols/snap: revert failing storage response

* eth/protocols/snap: revert on bad responses (storage, code)

* eth/protocols/snap: fix account handling stall

* eth/protocols/snap: fix remaining revertal-issues

* eth/protocols/snap: timeouthandler for bytecode requests

* eth/protocols/snap: debugging + fix log message

* eth/protocols/snap: fix misspelliings in docs

* eth/protocols/snap: fix race in bytecode handling

* eth/protocols/snap: undo deduplication of storage roots

* synctests: refactor + minify panic testcase

* eth/protocols/snap: minor polishes

* eth: minor polishes to make logs more useful

* eth/protocols/snap: remove excessive logs from the test runs

* eth/protocols/snap: stress tests with concurrency

* eth/protocols/snap: further fixes to test cancel channel handling

* eth/protocols/snap: extend test timeouts on CI

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-03-09 12:34:26 +01:00
ligi
a7b9ff7243 cmd, geth: CLI help fixes (#22220)
* cmd, geth: Reflect command being optional - closes 22218

* cmd, geth: Set current year to 2021
2021-03-09 12:33:40 +01:00
Felix Lange
f984684fb6 common/mclock: remove dependency on github.com/aristanetworks/goarista (#22211)
It takes three lines of code to get to runtime.nanotime, no need to
pull a dependency for that.
# Conflicts:
#	go.mod
#	go.sum
2021-03-09 12:33:30 +01:00
gary rong
c57f9f1f81 trie: fix range prover (#22210)
Fixes a special case when the trie only has a single trie node and the range proof only contains a single element.
# Conflicts:
#	trie/proof.go
#	trie/proof_test.go
2021-03-09 12:32:00 +01:00
Łukasz Zimnoch
d69a25a11c event: add ResubscribeErr (#22191)
This adds a way to get the error of the failing subscription
for logging/debugging purposes.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-03-09 12:31:43 +01:00
Sina Mahmoodi
92c1b86119 eth/filters: fix potential deadlock in filter timeout loop (#22178)
This fixes #22131 and adds a test reproducing the issue.
# Conflicts:
#	eth/filters/filter_system_test.go
#	les/client.go
2021-03-09 12:31:36 +01:00
Péter Szilágyi
40a366086e core/state: convert prefetcher to concurrent per-trie loader
# Conflicts:
#	accounts/abi/bind/backends/simulated.go
#	core/blockchain.go
#	core/state/state_object.go
#	core/state/state_test.go
#	core/state/statedb.go
#	core/state/statedb_test.go
#	eth/api_tracer.go
#	miner/worker.go
2021-03-09 12:30:09 +01:00
Martin Holst Swende
6c3d78d0d9 core: implement background trie prefetcher
Squashed from the following commits:

core/state: lazily init snapshot storage map
core/state: fix flawed meter on storage reads
core/state: make statedb/stateobjects reuse a hasher
core/blockchain, core/state: implement new trie prefetcher
core: make trie prefetcher deliver tries to statedb
core/state: refactor trie_prefetcher, export storage tries
blockchain: re-enable the next-block-prefetcher
state: remove panics in trie prefetcher
core/state/trie_prefetcher: address some review concerns

sq

# Conflicts:
#	core/blockchain.go
#	core/state/database.go
#	core/state/state_object.go
#	core/state/statedb.go
2021-03-09 11:15:19 +01:00
meowsbits
71a78fafd0 downloader: extract findAncestor search functions (#21744)
This is a simple refactoring, extracting common ancestor
negotiation logic to named function
2021-03-09 11:13:39 +01:00
ucwong
13eecf52cf go.mod: upgrade golang-lru (#22134)
# Conflicts:
#	go.mod
#	go.sum
2021-03-09 11:13:31 +01:00
Marius van der Wijden
14a8a75552 oss-fuzz: fix abi fuzzer (#22199) 2021-03-09 10:51:27 +01:00
gary rong
773ca75cc9 eth, les: add new config field SyncFromCheckpoint (#22123)
This PR introduces a new config field SyncFromCheckpoint for light client.

In some special scenarios, it's required to start synchronization from some
arbitrary checkpoint or even from the scratch. So this PR offers this
flexibility to users so that the synchronization start point can be configured.

There are two relevant configs: SyncFromCheckpoint and Checkpoint.

- If the SyncFromCheckpoint is true, the light client will try to sync from the
  specified checkpoint.

- If the Checkpoint is not configured, then the light client will sync from the
  scratch(from the latest header if the database is not empty)

Additional notes: these two configs are not visible in the CLI flags but only
accessable in the config file.

Example Usage:

[Eth]
SyncFromCheckpoint = true

[Eth.Checkpoint]
SectionIndex = 100
SectionHead = "0xabc"
CHTRoot = "0xabc"
BloomRoot = "0xabc"

PS. Historical checkpoint can be retrieved from the synced full node or light
client via les_getCheckpoint API.
# Conflicts:
#	eth/gen_config.go
#	les/client_handler.go
#	les/commons.go
#	les/sync.go
#	les/sync_test.go
#	les/test_helper.go
2021-03-09 10:51:19 +01:00
Alex Mazalov
ed42a61cc8 cmd/geth: graceful shutdown if disk is full (#22103)
Adding warnings of free disk space left and graceful shutdown when there is not enough space left.
This also adds a flag datadir.minfreedisk which can be used to set the trigger for low disk space, and setting it to zero disables the check.

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	cmd/geth/main.go
#	cmd/geth/usage.go
#	cmd/utils/cmd.go
2021-03-09 10:50:14 +01:00
gary rong
6236523169 core/state/snapshot: write snapshot generator in batch (#22163)
* core/state/snapshot: write snapshot generator in batch

* core: refactor the tests

* core: update tests

* core: update tests
# Conflicts:
#	core/blockchain_snapshot_test.go
#	core/state/snapshot/generate.go
#	core/state/snapshot/journal.go
2021-03-09 10:49:30 +01:00
Marius van der Wijden
e78f1a9f6e cmd/geth: dump config for metrics (#22083)
* cmd/geth: dump config

* cmd/geth: dump config

* cmd/geth: properly read config again

* cmd/geth: override metrics if flags are set

* cmd/geth: write metrics regardless if enabled

* cmd/geth: renamed to metricsfromcliargs

* metrics: add default configuration
# Conflicts:
#	cmd/geth/config.go
2021-03-09 10:49:12 +01:00
Marius van der Wijden
519d6e3edf tests/fuzzers/abi: better test generation (#22158)
* tests/fuzzers/abi: better test generation

* tests/fuzzers/abi: fixed packing issue

* oss-fuzz: enable abi fuzzer
# Conflicts:
#	tests/fuzzers/abi/abifuzzer.go
2021-03-09 10:48:53 +01:00
gary rong
6d9c22a5a0 les: remove useless protocol defines (#22115)
This PR has two changes in the les protocol:

- the auxRoot is not supported. See ethereum/devp2p#171 for more information
- the empty response will be returned in GetHelperTrieProofsMsg request if the merkle
   proving is failed. note, for backward compatibility, the empty merkle proof as well as
   the request auxiliary data will still be returned in  les2/3 protocol no matter the proving
   is successful or not. the proving failure can happen e.g. request the proving for a
   non-included entry in helper trie (unstable header).
# Conflicts:
#	les/benchmark.go
#	les/handler_test.go
#	les/odr_requests.go
#	les/server_handler.go
2021-03-09 10:38:55 +01:00