Marius van der Wijden
96a424ee84
internal/ethapi: reject non-replay-protected txs over RPC ( #22339 )
...
This PR prevents users from submitting transactions without EIP-155 enabled. This behaviour can be overridden by specifying the flag --rpc.allow-unprotected-txs=true.
# Conflicts:
# cmd/geth/main.go
# eth/backend.go
# les/api_backend.go
# les/client.go
# node/config.go
2021-03-10 17:00:47 +01:00
Martin Holst Swende
fc0778d1f9
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.
# Conflicts:
# cmd/geth/chaincmd.go
# cmd/geth/main.go
# cmd/utils/flags.go
# core/rawdb/database.go
# ethdb/leveldb/leveldb.go
2021-03-10 16:57:59 +01:00
gary rong
5aefc37618
les: clean up server handler ( #22357 )
...
# Conflicts:
# les/server_handler.go
# les/server_requests.go
2021-03-10 16:57:05 +01:00
Felföldi Zsolt
fdd4eb38fa
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>
# Conflicts:
# les/handler_test.go
# les/peer.go
# les/protocol.go
# les/server_handler.go
# les/test_helper.go
2021-03-10 16:56:49 +01:00
Felföldi Zsolt
6a4d9d1b55
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
# Conflicts:
# les/client.go
# les/clientpool.go
# les/commons.go
# les/server.go
# les/vflux/server/balance_test.go
# les/vflux/server/balance_tracker.go
2021-03-10 16:55:16 +01:00
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
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