Commit Graph

12333 Commits

Author SHA1 Message Date
Martin Holst Swende
c4a2b682ff
cmd/geth: add db commands stats, compact, put, get, delete (#22014)
This PR introduces:

- db.put to put a value into the database
- db.get to read a value from the database
- db.delete to delete a value from the database
- db.stats to check compaction info from the database
- db.compact to trigger a db compaction

It also moves inspectdb to db.inspect.
2021-02-23 11:27:32 +01:00
gary rong
3ecfdccd9a
les: clean up server handler (#22357) 2021-02-22 14:33:11 +01:00
Felföldi Zsolt
8f03e3b107
tests/fuzzers/les: add fuzzer for les server handler (#22282)
* les: refactored server handler

* tests/fuzzers/les: add fuzzer for les server handler

* tests, les: update les fuzzer

tests: update les fuzzer

tests/fuzzer/les: release resources

tests/fuzzer/les: pre-initialize all resources

* les: refactored server handler and fuzzer

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2021-02-20 10:40:38 +01:00
Felföldi Zsolt
8647233a8e
les: fix balance expiration (#22343)
* les/lespay/server: fix balance expiration and add test

* les: move client balances to a new db

* les: rename lespayDb to lesDb
2021-02-19 15:53:12 +01:00
Felföldi Zsolt
c027507e03
les: renamed lespay to vflux (#22347) 2021-02-19 14:44:16 +01:00
Felix Lange
d36276d85e
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-02-19 09:54:46 +01:00
Martin Holst Swende
6ec1561044
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
2021-02-18 18:54:29 +02:00
Martin Holst Swende
b1835b3855
node: always show websocket url in logs (#22307) 2021-02-18 10:40:19 +01:00
Or Neeman
9ec32a9e7b
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-02-18 10:19:49 +01:00
Martin Holst Swende
52e5c38aa5
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
2021-02-18 10:05:47 +02:00
Martin Holst Swende
e01096f531
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-02-17 14:59:00 +01:00
Péter Szilágyi
1489c3f494
Merge pull request #22334 from karalabe/fix-snap-cancel
eth: fix snap sync cancellation
2021-02-16 16:30:07 +02:00
rene
f9445e93bb
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.
2021-02-16 15:23:03 +01:00
Péter Szilágyi
bfdff4c5b8
eth: fix snap sync cancellation 2021-02-16 16:11:33 +02:00
Péter Szilágyi
6291fc9230
Merge pull request #22331 from karalabe/enforce-min-snap-difflayers
core/state/snapshot: ensure Cap retains a min number of layers
2021-02-16 15:26:37 +02:00
Péter Szilágyi
9ec3329899
core/state/snapshot: ensure Cap retains a min number of layers 2021-02-16 15:25:20 +02:00
Péter Szilágyi
915c614959
Merge pull request #22332 from karalabe/fix-fastsync-restart-bloom-crash
trie: fix bloom crash on fast sync restart
2021-02-16 13:30:15 +02:00
Guillaume Ballet
f4fcd4f506
rpc: increase the number of subscriptions in storm test (#22316) 2021-02-16 11:40:59 +02:00
Péter Szilágyi
e991bdae24
trie: fix bloom crash on fast sync restart 2021-02-16 10:44:38 +02:00
Alex Mazalov
77787802fe
cmd/geth: fix js unclean shutdown (#22302) 2021-02-15 19:47:47 +01:00
Guillaume Ballet
08c878acd2
cmd/utils: add workaround for FreeBSD statfs quirk (#22310)
Make geth build on FreeBSD, fixes #22309.
2021-02-15 19:37:09 +01:00
Felföldi Zsolt
7d1b711c7d
les: enable les/4 and add tests (#22321) 2021-02-12 20:48:18 +01:00
Péter Szilágyi
2fc465a7be
Merge pull request #22319 from karalabe/fix-defer-leak
core: fix temp memory blowup caused by defers holding on to state
2021-02-12 15:34:35 +02:00
Péter Szilágyi
ef227c5f42
core: fix temp memory blowup caused by defers holding on to state 2021-02-12 12:45:34 +02:00
rene
111abdcfbd
cmd/devp2p: fix documentation for eth-test (#22298) 2021-02-11 12:09:13 +01:00
Péter Szilágyi
1bbc8a1944
Merge pull request #22293 from karalabe/txunindex-1year
cmd/utils, eth/ethconfig: unindex txs older than ~1 year
2021-02-10 16:02:35 +02:00
Péter Szilágyi
409b16e5ab
cmd/utils, eth/ethconfig: unindex txs older than ~1 year 2021-02-10 16:01:37 +02:00
Marius van der Wijden
cb3c7e4319
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-02-10 13:12:13 +01:00
Sina Mahmoodi
27786671d2
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.
2021-02-09 10:42:55 +01:00
Péter Szilágyi
2fdba3aacb
Merge pull request #22294 from holiman/pruner_compact_fix
core/state/pruner: fix compaction range error
2021-02-09 11:01:21 +02:00
Martin Holst Swende
74dbc20260
core/state/pruner: fix compaction range error 2021-02-08 20:31:52 +01:00
Péter Szilágyi
944d901436
Merge pull request #22291 from karalabe/fix-pruner-compaction
core/state/pruner: fix compaction after pruning
2021-02-08 19:19:38 +02:00
Péter Szilágyi
2728672c28
core/state/pruner: fix compaction after pruning 2021-02-08 19:18:40 +02:00
Péter Szilágyi
123e934e72
Merge pull request #22288 from karalabe/1.10.unstable
params: just to make snapshots a bit more official
2021-02-08 13:16:50 +02:00
gary rong
f566dd305e
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>
2021-02-08 13:16:30 +02:00
Péter Szilágyi
d86906f1e6
params: just to make snapshots a bit more official 2021-02-08 13:03:06 +02:00
Péter Szilágyi
bbe694fc52
Merge pull request #22280 from karalabe/snapshot-default
cmd/utils: enable snapshots by default
2021-02-08 12:58:54 +02:00
isdyaufh8o7cq
477fd420b3
metrics: fix cast omission in cpu_syscall.go (#22262)
fixes an regression which caused build failure on certain platforms
2021-02-08 11:36:49 +01:00
Péter Szilágyi
994cdc69c8
cmd/utils: enable snapshots by default 2021-02-07 20:13:59 +02:00
Guillaume Ballet
e74bd587f7
consensus: remove seal verification from the consensus engine interface (#22274) 2021-02-05 20:44:34 +02:00
Martin Holst Swende
7ed860d4f1
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-02-05 14:15:22 +01:00
Marius van der Wijden
fba5a63afe
internal/ethapi: fix typo in comment (#22271) 2021-02-05 13:51:53 +01:00
gary rong
098a2b6e26
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>
2021-02-05 13:51:15 +01:00
Marius van der Wijden
28121324ac
internal/ethapi: comment nitpick (#22270) 2021-02-05 12:35:55 +02:00
Marius van der Wijden
54735a6723
fuzzers: added consensys/gurvy library to bn256 differential fuzzer (#21812)
This pr adds consensys' gurvy bn256 variant into the code for differential fuzzing.
2021-02-03 15:04:28 +01:00
Marius van der Wijden
3512b41c5c
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-02-03 11:02:35 +01:00
ucwong
83e4c49e2b
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
2021-02-02 13:09:23 +01:00
Alex Prut
ef84da8481
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
2021-02-02 11:32:44 +02:00
rene
4eae0c6b6f
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>
2021-02-02 10:05:46 +01:00
Péter Szilágyi
e3430ac7df
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
2021-02-02 10:44:36 +02:00