Commit Graph

13354 Commits

Author SHA1 Message Date
Péter Szilágyi
93b0b48701 travis, appveyor, build: bump Go to 1.16
# Conflicts:
#	build/checksums.txt
#	build/ci.go
2021-03-10 16:54:58 +01:00
Péter Szilágyi
f33c516b83 cmd/utils: disable caching preimages by default
# Conflicts:
#	cmd/utils/flags.go
2021-03-10 16:54:33 +01:00
Felföldi Zsolt
f440b1fa73 les: renamed lespay to vflux (#22347)
# Conflicts:
#	les/api.go
#	les/client.go
#	les/clientpool.go
#	les/clientpool_test.go
#	les/peer.go
#	les/protocol.go
#	les/server.go
#	les/server_handler.go
#	les/serverpool.go
#	les/serverpool_test.go
#	les/vflux/client/api.go
#	les/vflux/client/fillset.go
#	les/vflux/client/fillset_test.go
#	les/vflux/client/queueiterator.go
#	les/vflux/client/queueiterator_test.go
#	les/vflux/client/requestbasket.go
#	les/vflux/client/requestbasket_test.go
#	les/vflux/client/timestats.go
#	les/vflux/client/timestats_test.go
#	les/vflux/client/valuetracker.go
#	les/vflux/client/valuetracker_test.go
#	les/vflux/client/wrsiterator.go
#	les/vflux/client/wrsiterator_test.go
#	les/vflux/server/balance.go
#	les/vflux/server/balance_test.go
#	les/vflux/server/balance_tracker.go
#	les/vflux/server/clientdb.go
#	les/vflux/server/clientdb_test.go
#	les/vflux/server/prioritypool.go
#	les/vflux/server/prioritypool_test.go
2021-03-10 14:32:30 +01:00
Felix Lange
b958c6447a p2p/dnsdisc: fix hot-spin when all trees are empty (#22313)
In the random sync algorithm used by the DNS node iterator, we first pick a random
tree and then perform one sync action on that tree. This happens in a loop until any
node is found. If no trees contain any nodes, the iterator will enter a hot loop spinning
at 100% CPU.

The fix is complicated. The iterator now checks if a meaningful sync action can
be performed on any tree. If there is nothing to do, it waits for the next root record
recheck time to arrive and then tries again.

Fixes #22306
2021-03-10 14:31:53 +01:00
Martin Holst Swende
d1b207ff7e eth: implement eth66 (#22241)
* eth/protocols/eth: split up the eth protocol handlers

* eth/protocols/eth: define eth-66 protocol messages

* eth/protocols/eth: poc implement getblockheaders on eth/66

* eth/protocols/eth: implement remaining eth-66 handlers

* eth/protocols: define handler map for eth 66

* eth/downloader: use protocol constants from eth package

* eth/protocols/eth: add ETH66 capability

* eth/downloader: tests for eth66

* eth/downloader: fix error in tests

* eth/protocols/eth: use eth66 for outgoing requests

* eth/protocols/eth: remove unused error type

* eth/protocols/eth: define protocol length

* eth/protocols/eth: fix pooled tx over eth66

* protocols/eth/handlers: revert behavioural change which caused tests to fail

* eth/downloader: fix failing test

* eth/protocols/eth: add testcases + fix flaw with header requests

* eth/protocols: change comments

* eth/protocols/eth: review fixes + fixed flaw in RequestOneHeader

* eth/protocols: documentation

* eth/protocols/eth: review concerns about types
# Conflicts:
#	eth/downloader/downloader_test.go
#	eth/downloader/peer.go
2021-03-10 11:33:45 +01:00
Martin Holst Swende
f9abed27dc node: always show websocket url in logs (#22307) 2021-03-10 11:10:15 +01:00
Or Neeman
9326a45910 rlp: handle case of normal EOF in Stream.readFull (#22336)
io.Reader may return n > 0 and io.EOF at the end of the input stream.
readFull did not handle this correctly, looking only at the error. This fixes
it to check for n == len(buf) as well.
2021-03-10 11:09:26 +01:00
Martin Holst Swende
762a8f30ee core/state: copy the snap when copying the state (#22340)
* core/state: copy the snap when copying the state

* core/state: deep-copy snap stuff during state Copy
# Conflicts:
#	core/state/statedb.go
2021-03-10 11:09:17 +01:00
Martin Holst Swende
5bcef5b9c7 eth/handler, broadcast: optimize tx broadcast mechanism (#22176)
This PR optimizes the broadcast loop. Instead of iterating twice through a given set of transactions to weed out which peers have and which do not have a tx, to send/announce transactions, we do it only once.
2021-03-10 11:09:01 +01:00
rene
254295d9d1 cmd/devp2p/internal/ethtest: use shared message types (#22315)
This updates the eth protocol test suite to use the message type
definitions of the 'production' protocol implementation in eth/protocols/eth.
# Conflicts:
#	cmd/devp2p/internal/ethtest/chain_test.go
#	cmd/devp2p/internal/ethtest/suite.go
#	cmd/devp2p/internal/ethtest/types.go
2021-03-10 11:08:48 +01:00
Péter Szilágyi
f4eb5572fd eth: fix snap sync cancellation
# Conflicts:
#	eth/downloader/downloader.go
2021-03-10 11:05:05 +01:00
Péter Szilágyi
15884a36fd core/state/snapshot: ensure Cap retains a min number of layers
# Conflicts:
#	core/state/snapshot/snapshot.go
#	core/state/snapshot/snapshot_test.go
2021-03-10 11:03:39 +01:00
Guillaume Ballet
fdedca6a6f rpc: increase the number of subscriptions in storm test (#22316)
# Conflicts:
#	rpc/client_test.go
2021-03-10 11:03:05 +01:00
Péter Szilágyi
7989d93e2d trie: fix bloom crash on fast sync restart
# Conflicts:
#	trie/sync.go
2021-03-10 11:02:34 +01:00
Alex Mazalov
e609d51b78 cmd/geth: fix js unclean shutdown (#22302)
# Conflicts:
#	cmd/geth/consolecmd.go
2021-03-10 11:02:20 +01:00
Guillaume Ballet
fbb3e0e206 cmd/utils: add workaround for FreeBSD statfs quirk (#22310)
Make geth build on FreeBSD, fixes #22309.
2021-03-10 11:02:02 +01:00
Péter Szilágyi
7d3d248a9e core: fix temp memory blowup caused by defers holding on to state
# Conflicts:
#	core/blockchain.go
2021-03-10 11:01:37 +01:00
rene
33ae8fd923 cmd/devp2p: fix documentation for eth-test (#22298) 2021-03-10 11:00:41 +01:00
Péter Szilágyi
e7bffb64eb cmd/utils, eth/ethconfig: unindex txs older than ~1 year
# Conflicts:
#	eth/ethconfig/config.go
2021-03-10 11:00:31 +01:00
Marius van der Wijden
17f1258539 accounts/abi/bind: fixed unpacking error (#22230)
There was a dormant error with structured inputs that failed unpacking.
This commit fixes the error by switching casting to the better abi.ConvertType function.
It also adds a test for calling a view function that returns a struct
2021-03-10 11:00:05 +01:00
Sina Mahmoodi
09650bcf2b internal/debug: add switch to format logs with json (#22207)
adds a flag --log.json which if enabled makes the client format logs with JSON.
# Conflicts:
#	internal/debug/flags.go
2021-03-10 10:59:55 +01:00
Martin Holst Swende
1f9850da82 core/state/pruner: fix compaction range error 2021-03-10 10:58:50 +01:00
Péter Szilágyi
97fc3ba0d2 core/state/pruner: fix compaction after pruning 2021-03-10 10:58:39 +01:00
gary rong
a9e6250e72 all: bloom-filter based pruning mechanism (#21724)
* cmd, core, tests: initial state pruner

core: fix db inspector

cmd/geth: add verify-state

cmd/geth: add verification tool

core/rawdb: implement flatdb

cmd, core: fix rebase

core/state: use new contract code layout

core/state/pruner: avoid deleting genesis state

cmd/geth: add helper function

core, cmd: fix extract genesis

core: minor fixes

contracts: remove useless

core/state/snapshot: plugin stacktrie

core: polish

core/state/snapshot: iterate storage concurrently

core/state/snapshot: fix iteration

core: add comments

core/state/snapshot: polish code

core/state: polish

core/state/snapshot: rebase

core/rawdb: add comments

core/rawdb: fix tests

core/rawdb: improve tests

core/state/snapshot: fix concurrent iteration

core/state: run pruning during the recovery

core, trie: implement martin's idea

core, eth: delete flatdb and polish pruner

trie: fix import

core/state/pruner: add log

core/state/pruner: fix issues

core/state/pruner: don't read back

core/state/pruner: fix contract code write

core/state/pruner: check root node presence

cmd, core: polish log

core/state: use HEAD-127 as the target

core/state/snapshot: improve tests

cmd/geth: fix verification tool

cmd/geth: use HEAD as the verification default target

all: replace the bloomfilter with martin's fork

cmd, core: polish code

core, cmd: forcibly delete state root

core/state/pruner: add hash64

core/state/pruner: fix blacklist

core/state: remove blacklist

cmd, core: delete trie clean cache before pruning

cmd, core: fix lint

cmd, core: fix rebase

core/state: fix the special case for clique networks

core/state/snapshot: remove useless code

core/state/pruner: capping the snapshot after pruning

cmd, core, eth: fixes

core/rawdb: update db inspector

cmd/geth: polish code

core/state/pruner: fsync bloom filter

cmd, core: print warning log

core/state/pruner: adjust the parameters for bloom filter

cmd, core: create the bloom filter by size

core: polish

core/state/pruner: sanitize invalid bloomfilter size

cmd: address comments

cmd/geth: address comments

cmd/geth: address comment

core/state/pruner: address comments

core/state/pruner: rename homedir to datadir

cmd, core: address comments

core/state/pruner: address comment

core/state: address comments

core, cmd, tests: address comments

core: address comments

core/state/pruner: release the iterator after each commit

core/state/pruner: improve pruner

cmd, core: adjust bloom paramters

core/state/pruner: fix lint

core/state/pruner: fix tests

core: fix rebase

core/state/pruner: remove atomic rename

core/state/pruner: address comments

all: run go mod tidy

core/state/pruner: avoid false-positive for the middle state roots

core/state/pruner: add checks for middle roots

cmd/geth: replace crit with error

* core/state/pruner: fix lint

* core: drop legacy bloom filter

* core/state/snapshot: improve pruner

* core/state/snapshot: polish concurrent logs to report ETA vs. hashes

* core/state/pruner: add progress report for pruning and compaction too

* core: fix snapshot test API

* core/state: fix some pruning logs

* core/state/pruner: support recovering from bloom flush fail

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
# Conflicts:
#	cmd/geth/main.go
#	cmd/geth/usage.go
#	core/blockchain.go
#	core/blockchain_snapshot_test.go
#	core/genesis.go
#	core/rawdb/database.go
#	core/rawdb/schema.go
#	core/state/snapshot/conversion.go
#	core/state/snapshot/snapshot.go
#	core/state/snapshot/snapshot_test.go
#	eth/backend.go
#	go.mod
#	go.sum
#	tests/block_test_util.go
#	tests/state_test_util.go
#	trie/stacktrie.go
2021-03-10 10:58:22 +01:00
Péter Szilágyi
f5a8ba7cde params: just to make snapshots a bit more official
# Conflicts:
#	params/version.go
2021-03-10 10:31:25 +01:00
isdyaufh8o7cq
1d2cec7b0a metrics: fix cast omission in cpu_syscall.go (#22262)
fixes an regression which caused build failure on certain platforms
# Conflicts:
#	metrics/cpu_syscall.go
2021-03-10 10:30:22 +01:00
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
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