Commit Graph

13382 Commits

Author SHA1 Message Date
Péter Szilágyi
9ef50edea3 core/forkid, params: unset Berlin fork number (#22413) 2021-03-12 16:09:19 +01:00
gary rong
926bc2dd85 cmd/utils: fix txlookuplimit for archive node (#22419)
* cmd/utils: fix exclusive check for archive node

* cmd/utils: set the txlookuplimit to 0
# Conflicts:
#	cmd/utils/flags.go
2021-03-12 16:09:11 +01:00
gary rong
8e959c0d01 params: update chts (#22418) 2021-03-12 16:08:29 +01:00
Marius van der Wijden
68a41cdeb8 cmd/geth: put allowUnsecureTx flag in RPC section (#22412)
# Conflicts:
#	cmd/geth/usage.go
2021-03-12 16:08:22 +01:00
Péter Szilágyi
03eafd8580 core/vm/runtime: more unshipping
# Conflicts:
#	core/vm/runtime/runtime_test.go
2021-03-12 16:08:00 +01:00
Péter Szilágyi
d00a121246 core, eth: unship EIP 2315
# Conflicts:
#	core/vm/contract.go
#	core/vm/gen_structlog.go
#	core/vm/instructions.go
#	core/vm/instructions_test.go
#	core/vm/interpreter.go
#	core/vm/logger.go
#	core/vm/logger_json.go
#	core/vm/logger_test.go
#	core/vm/stack/stack.go
#	eth/tracers/tracer.go
#	eth/tracers/tracer_test.go
2021-03-12 16:05:37 +01:00
gary rong
a9fb6bd2b0 core/rawdb: fix the transaction indexer (#22395)
# Conflicts:
#	core/rawdb/chain_iterator.go
2021-03-12 15:53:21 +01:00
Felföldi Zsolt
e3f0782057 les: UDP pre-negotiation of available server capacity (#22183)
This PR implements the first one of the "lespay" UDP queries which
is already useful in itself: the capacity query. The server pool is making
use of this query by doing a cheap UDP query to determine whether it is
worth starting the more expensive TCP connection process.
# Conflicts:
#	les/client.go
#	les/clientpool.go
#	les/clientpool_test.go
#	les/enr_entry.go
#	les/server.go
#	les/vflux/client/serverpool.go
#	les/vflux/client/serverpool_test.go
#	les/vflux/server/balance.go
#	les/vflux/server/balance_test.go
#	les/vflux/server/prioritypool.go
#	les/vflux/server/prioritypool_test.go
#	p2p/nodestate/nodestate.go
2021-03-12 15:53:04 +01:00
Martin Holst Swende
d85afb7d20 core/state: fix eta calculation on pruning (#22386) 2021-03-12 15:52:25 +01:00
Marius van der Wijden
e052d8e268 accounts/keystore: use github.com/google/uuid (#22217)
This replaces the github.com/pborman/uuid dependency with
github.com/google/uuid because the former is only a wrapper for
the latter (since v1.0.0).

Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	accounts/keystore/key.go
#	accounts/keystore/passphrase.go
#	accounts/keystore/presale.go
#	cmd/ethkey/generate.go
#	go.mod
#	go.sum
2021-03-12 15:52:15 +01:00
Felix Lange
e4fb882c98 rpc: add separate size limit for websocket (#22385)
This makes the WebSocket message size limit independent of the
limit used for HTTP requests. The new limit for WebSocket messages 
is 15MB.
2021-03-12 15:50:22 +01:00
Péter Szilágyi
d23002e76a all: define Berlin hard fork spec
# Conflicts:
#	cmd/geth/config.go
#	cmd/geth/main.go
#	core/genesis.go
#	core/state_transition.go
#	core/vm/evm.go
#	core/vm/interpreter.go
#	eth/backend.go
#	eth/ethconfig/config.go
#	les/client.go
#	light/txpool.go
#	tests/state_test_util.go
2021-03-12 15:50:09 +01:00
Felföldi Zsolt
d785b18d0f les: move server pool to les/vflux/client (#22377)
* les: move serverPool to les/vflux/client

* les: add metrics

* les: moved ValueTracker inside ServerPool

* les: protect against node registration before server pool is started

* les/vflux/client: fixed tests

* les: make peer registration safe
# Conflicts:
#	les/client.go
#	les/client_handler.go
#	les/peer.go
#	les/vflux/client/queueiterator_test.go
#	les/vflux/client/serverpool.go
#	les/vflux/client/serverpool_test.go
#	les/vflux/client/valuetracker.go
#	les/vflux/client/valuetracker_test.go
2021-03-12 15:41:13 +01:00
rene
ba494be5a9 cmd/devp2p: add eth66 test suite (#22363)
Co-authored-by: Martin Holst Swende <martin@swende.se>
# Conflicts:
#	go.mod
2021-03-12 15:40:44 +01:00
lightclient
50d975302d all: add support for EIP-2718, EIP-2930 transactions (#21502)
This adds support for EIP-2718 typed transactions as well as EIP-2930
access list transactions (tx type 1). These EIPs are scheduled for the
Berlin fork.

There very few changes to existing APIs in core/types, and several new APIs
to deal with access list transactions. In particular, there are two new
constructor functions for transactions: types.NewTx and types.SignNewTx.
Since the canonical encoding of typed transactions is not RLP-compatible,
Transaction now has new methods for encoding and decoding: MarshalBinary
and UnmarshalBinary.

The existing EIP-155 signer does not support the new transaction types.
All code dealing with transaction signatures should be updated to use the
newer EIP-2930 signer. To make this easier for future updates, we have
added new constructor functions for types.Signer: types.LatestSigner and
types.LatestSignerForChainID.

This change also adds support for the YoloV3 testnet.

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
# Conflicts:
#	accounts/abi/bind/backends/simulated.go
#	cmd/evm/internal/t8ntool/execution.go
#	cmd/evm/internal/t8ntool/transition.go
#	cmd/geth/main.go
#	cmd/geth/usage.go
#	core/bench_test.go
#	core/state/statedb.go
#	core/state_prefetcher.go
#	core/state_processor.go
#	core/state_transition.go
#	core/tx_pool.go
#	core/types/block.go
#	core/types/derive_sha.go
#	core/types/gen_tx_json.go
#	core/types/receipt.go
#	core/types/receipt_test.go
#	core/types/transaction.go
#	core/types/transaction_signing.go
#	core/types/transaction_test.go
#	ethclient/ethclient.go
#	ethclient/signer.go
#	graphql/graphql.go
#	internal/ethapi/api.go
#	internal/guide/guide_test.go
#	les/benchmark.go
#	les/odr_test.go
#	light/odr_test.go
#	light/txpool.go
#	miner/worker.go
#	miner/worker_test.go
#	signer/core/api.go
#	tests/state_test_util.go
#	trie/stacktrie_test.go
#	turbo/stages/blockchain_test.go
2021-03-12 15:40:24 +01:00
gary rong
b83a20d3b7 les, light: improve txstatus retrieval (#22349)
Transaction unindexing will be enabled by default as of 1.10, which causes tx status retrieval will be broken without this PR.

This PR introduces a retry mechanism in TxStatus retrieval.
# Conflicts:
#	les/client.go
#	les/fetcher_test.go
#	les/handler_test.go
#	les/odr.go
#	les/odr_requests.go
#	les/odr_test.go
#	les/peer.go
#	les/pruner_test.go
#	les/request_test.go
#	les/sync_test.go
#	les/test_helper.go
#	les/ulc_test.go
#	light/odr.go
#	light/odr_util.go
2021-03-10 17:07:04 +01:00
gary rong
e602a34fb8 cmd, eth, les: enable serving light clients when non-synced (#22250)
This PR adds a more CLI flag, so that the les-server can serve light clients even the local node is not synced yet.

This functionality is needed in some testing environments(e.g. hive). After launching the les server, no more blocks will be imported so the node is always marked as "non-synced".
# Conflicts:
#	cmd/geth/main.go
#	cmd/geth/usage.go
#	cmd/utils/flags.go
#	eth/ethconfig/gen_config.go
#	les/server.go
2021-03-10 17:06:42 +01:00
Péter Szilágyi
901015daad eth/protocols/snap: lower abortion and resumption logs to debug 2021-03-10 17:03:46 +01:00
Péter Szilágyi
b172a8cdb6 travis: manually install Android since Travis is stale (#22373) 2021-03-10 17:03:02 +01:00
Péter Szilágyi
4b01f40066 travis: bump builders to Bionic 2021-03-10 17:02:51 +01:00
Péter Szilágyi
569d23ea59 travis: bump Android NDK version 2021-03-10 17:02:40 +01:00
Péter Szilágyi
9f87f5146d Dockerfile: bump to Go 1.16 base images
# Conflicts:
#	Dockerfile
#	Dockerfile.alltools
2021-03-10 17:02:11 +01:00
Péter Szilágyi
e767a6dbfd accounts/abi/bind: fix up Go mod files for Go 1.16
# Conflicts:
#	accounts/abi/bind/bind_test.go
2021-03-10 17:01:49 +01:00
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