Commit Graph

11699 Commits

Author SHA1 Message Date
Felix Lange
cac12843f7 p2p: new dial scheduler (#20592)
* p2p: new dial scheduler

This change replaces the peer-to-peer dial scheduler with a new and
improved implementation. The new code is better than the previous
implementation in two key aspects:

- The time between discovery of a node and dialing that node is
  significantly lower in the new version. The old dialState kept
  a buffer of nodes and launched a task to refill it whenever the buffer
  became empty. This worked well with the discovery interface we used to
  have, but doesn't really work with the new iterator-based discovery
  API.

- Selection of static dial candidates (created by Server.AddPeer or
  through static-nodes.json) performs much better for large amounts of
  static peers. Connections to static nodes are now limited like dynanic
  dials and can no longer overstep MaxPeers or the dial ratio.

* p2p/simulations/adapters: adapt to new NodeDialer interface

* p2p: re-add check for self in checkDial

* p2p: remove peersetCh

* p2p: allow static dials when discovery is disabled

* p2p: add test for dialScheduler.removeStatic

* p2p: remove blank line

* p2p: fix documentation of maxDialPeers

* p2p: change "ok" to "added" in static node log

* p2p: improve dialTask docs

Also increase log level for "Can't resolve node"

* p2p: ensure dial resolver is truly nil without discovery

* p2p: add "looking for peers" log message

* p2p: clean up Server.run comments

* p2p: fix maxDialedConns for maxpeers < dialRatio

Always allocate at least one dial slot unless dialing is disabled using
NoDial or MaxPeers == 0. Most importantly, this fixes MaxPeers == 1 to
dedicate the sole slot to dialing instead of listening.

* p2p: fix RemovePeer to disconnect the peer again

Also make RemovePeer synchronous and add a test.

* p2p: remove "Connection set up" log message

* p2p: clean up connection logging

We previously logged outgoing connection failures up to three times.

- in SetupConn() as "Setting up connection failed addr=..."
- in setupConn() with an error-specific message and "id=... addr=..."
- in dial() as "Dial error task=..."

This commit ensures a single log message is emitted per failure and adds
"id=... addr=... conn=..." everywhere (id= omitted when the ID isn't
known yet).

Also avoid printing a log message when a static dial fails but can't be
resolved because discv4 is disabled. The light client hit this case all
the time, increasing the message count to four lines per failed
connection.

* p2p: document that RemovePeer blocks
2020-02-27 17:21:20 +03:00
Boqin Qin
1d0b41b6b0 accounts: add walletsNoLock to avoid double read lock (#20655) 2020-02-27 17:21:20 +03:00
Boqin Qin
f4cc9cda14 event, p2p/simulations/adapters: fix rare goroutine leaks (#20657)
Co-authored-by: Felix Lange <fjl@twurst.com>
2020-02-27 17:21:20 +03:00
Marius van der Wijden
a8b4a7cd49 accounts/abi/bind/backends: add support for historical state (#20644) 2020-02-27 17:21:20 +03:00
Boqin Qin
0ab2d04b98 event: add missing unlock before panic (#20653) 2020-02-27 17:21:20 +03:00
Adam Schmideg
9b1277fd58 les: log disconnect reason when light server is not synced (#20643)
Co-authored-by: ligi <ligi@ligi.de>
2020-02-27 17:21:20 +03:00
Felix Lange
55bc97775a common/mclock: add NewTimer and Timer.Reset (#20634)
These methods can be helpful when migrating existing timer code.
2020-02-27 17:21:20 +03:00
rjl493456442
34c43f7040 core, eth: implement eth/65 transaction fetcher 2020-02-27 17:21:20 +03:00
winsvega
86f56c9079 cmd/geth retesteth: add eth_getBlockByHash (#20621) 2020-02-27 17:21:20 +03:00
chabashilah
b424097275 signer: add bytes32 as valid primitive (#20609) 2020-02-27 17:21:20 +03:00
Adam Schmideg
54f3195895 rpc: add error when call result parameter is not addressable (#20638) 2020-02-27 17:21:20 +03:00
AmitBRD
b092a70f55 graphql: add transaction signature values (#20623)
The feature update allows the GraphQL API endpoint to retrieve
transaction signature R,S,V parameters.

Co-authored-by: amitshah <amitshah0t7@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2020-02-27 17:21:19 +03:00
Nick Ward
cf59819330 README.md: update evm usage example (#20635) 2020-02-27 17:21:19 +03:00
Martin Holst Swende
4046ea794d internal/ethapi: return non-null "number" for pending block (#20616)
Fixes: #20587, ethereum/web3.py#1572
2020-02-27 17:21:19 +03:00
Felix Lange
85941edbea cmd/devp2p: fix Route53 TXT record splitting (#20626)
For longer records and subtree entries, the deployer created two
separate TXT records. This doesn't work as intended because the client
will receive the two records in arbitrary order. The fix is to encode
longer values as "string1""string2" instead of "string1", "string2".
This encoding creates a single record on AWS Route53.
2020-02-27 17:21:19 +03:00
Martin Holst Swende
999e3ed299 trie: make hasher parallel when number of changes are large (#20488)
* trie: make hasher parallel when number of changes are large

* trie: remove unused field dirtyCount

* trie: rename unhashedCount/unhashed
2020-02-27 17:21:19 +03:00
meowsbits
9ebb2a4d2f cmd/geth: add 'dumpgenesis' command (#20191)
Adds the 'geth dumpgenesis' command, which writes the configured
genesis in JSON format to stdout. This provides a way to generate the
data (structure and content) that can then be used with the 'geth init'
command.
2020-02-27 17:20:36 +03:00
Martin Holst Swende
c9c6171f67 core/evm: less iteration in blockhash (#20589)
* core/vm/runtime: add test for blockhash

* core/evm: less iteration in blockhash

* core/vm/runtime: nitpickfix

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2020-02-27 17:20:36 +03:00
tintin
d7a5c2dd3f tracers: avoid panic on invalid arguments (#20612)
* add regression tests for #20611

* eth/tracers: fix panics occurring for invalid params in js-tracers

Co-authored-by: Martin Holst Swende <martin@swende.se>
2020-02-27 17:20:36 +03:00
Martin Holst Swende
859a345680 trie: separate hashes and committer, collapse on commit
* trie:  make db insert use size instead of full data

* core/state: minor optimization in state onleaf allocation

* trie: implement dedicated committer and hasher

* trie: use dedicated committer/hasher

* trie: linter nitpicks

* core/state, trie: avoid unnecessary storage trie load+commit

* trie: review feedback, mainly docs + minor changes

* trie: start deprecating old hasher

* trie: fix misspell+lint

* trie: deprecate hasher.go, make proof framework use new hasher

* trie: rename pure_committer/hasher to committer/hasher

* trie, core/state: fix review concerns

* trie: more review concerns

* trie: make commit collapse into hashnode, don't touch dirtyness

* trie: goimports fixes

* trie: remove panics
2020-02-27 17:20:36 +03:00
Felix Lange
120928bacb internal/build: don't crash in DownloadFile when offline (#20595) 2020-02-27 17:20:36 +03:00
Martin Holst Swende
279a347a3a params: update bootnodes (#20610) 2020-02-27 17:20:36 +03:00
Martin Holst Swende
f3630b8949 retesteth: clean txpool on rewind, default dao support (#20596) 2020-02-27 17:20:36 +03:00
Guillaume Ballet
cfd99d80ba core/vm/runtime: fix typos in comment (#20608) 2020-02-27 17:20:36 +03:00
Guillaume Ballet
5e39705cfc signer/rules: use goja and remove otto (#20599)
* signer: replace otto with goja

* go.mod: remove Otto
2020-02-27 17:20:36 +03:00
Felix Lange
cf03897b25 rpc: check module availability at startup (#20597)
Fixes #20467

Co-authored-by: meowsbits <45600330+meowsbits@users.noreply.github.com>
2020-02-27 17:20:36 +03:00
Zhou Zhiyao
8e306c7e47 rpc: reset writeConn when conn is closed on readErr (#20414)
This change makes the client attempt to reconnect when a write fails.
We already had reconnect support, but the reconnect would previously
happen on the next call after an error. Being more eager leads to a
smoother experience overall.
2020-02-27 17:20:36 +03:00
Guillaume Ballet
80fcbd3040 console, internal/jsre: use github.com/dop251/goja (#20470)
This replaces the JavaScript interpreter used by the console with goja,
which is actively maintained and a lot faster than otto. Clef still uses otto
and eth/tracers still uses duktape, so we are currently dependent on three
different JS interpreters. We're looking to replace the remaining uses of otto
soon though.
2020-02-27 17:20:36 +03:00
Guillaume Ballet
91a19add0b cmd/evm: accept --input for disasm command (#20548) 2020-02-27 17:20:36 +03:00
Martin Holst Swende
2f469b2c81 cmd/geth/retesteth: use canon head instead of keeping alternate count (#20572) 2020-02-27 17:20:36 +03:00
Guillaume Ballet
c9326e098c eth: fix comment typo in handler.go (#20575) 2020-02-27 17:20:36 +03:00
Martin Holst Swende
906f989762 cmd: implement abidump (#19958)
* abidump: implement abi dump command

* cmd/abidump: add license
2020-02-27 17:20:36 +03:00
Felix Lange
5f7f638ac5 log, internal/debug: delete RotatingFileHandler (#20586)
* log: delete RotatingFileHandler

We added this for the dashboard, which is gone now. The
handler never really worked well and had data race and file
handling issues.

* internal/debug: remove unused RotatingFileHandler setup code
2020-02-27 17:20:36 +03:00
Péter Szilágyi
e7ef24cd4b params: begin Geth v1.9.11 release cycle 2020-02-27 17:20:36 +03:00
Igor Mandrigin
70d7274c4d prepare for merging 2020-02-27 17:20:35 +03:00
Alex Sharov
3e944cb4b8
bolt v1.4.3 (#379)
* test_bolt_version

* test_bolt_version

* test_bolt_version

* test_bolt_version

* test_bolt_version

* test_bolt_version

* trigger CI
2020-02-22 07:56:42 +00:00
Igor Mandrigin
ec559db1c8
Formal semantics: more instructions (#366) 2020-02-17 19:56:30 +03:00
Alex Sharov
21ce7b4c0d
check in trie.hook was transformed incorrectly (#372) 2020-02-17 13:24:07 +07:00
Andrew Ashikhmin
b541bff1eb
Enable GetNodeData by default (#368)
* Add a missing IsGetNodeData check

* Enable GetNodeData by default
2020-02-16 16:50:24 +00:00
Alex Sharov
fdbba5202b
Trie: store self-destructed accounts (#355)
* squash commits

* enable storage cache

* make linter happy

* fix subtree prefix len check

* save cahnges to test master

* remove restriction on prefix len

* fix comparison of last bits

* fix wrong alignment

* remove debug prints

* commit current state

* commit current state

* avoid changing state of resolver from multiwalk

* remove debug code

* remove debug code

* remove debug code

* remove unnecessary copy

* make code more readable

* reduce rebuildHashes initial resolution

* fix test after rebase to master

* make code more readable

* improve pruner

* pruner add IntermediateCache bucket

* fix panic in Walk on short keys

* reduce allocations for storage keys decompression by increasing default buffer size

* re-run CI

* fix iterator behaviour

* rename cache to hash for unification

* re-run ci

* avoid using underlying DB

* hash all subtree nodes before unload

* fix getNode method

* need to check node type, not parent - before put to hashBucket

* return back parent type check, doesn't work without it.

* don't recalculate hash again

* move unloadFunc from trie to pruner

* rename bucket to shorter name

* rename bucket to shorter name

* clean

* rebase to master
2020-02-12 13:52:59 +00:00
Andrew Ashikhmin
05a3483cb1
Fix hash map leaks (#367)
* Enable testGetNodeData by default

* Crude TestHashMapLeak

* nodeFlag ->nodeRef

* linter

* accountNode shouln't be in hashMap since only branch and short nodes are the standart ones

* Finalize hash eviction logic

* small changes to TestHashMapLeak

* Fix for the incorrect hash

Co-authored-by: ledgerwatch <akhounov@gmail.com>
2020-02-12 11:34:44 +00:00
ledgerwatch
767a374c2e
Tx pool use triedbstate, fixes to GetNodeData and move it to experimental (#364)
* Use TrieDbState for tx pool

* Not initialise tx pool until state is loaded

* Add preimage

* Fix account

* Print codehash

* Print correct code hash

* Print incarnatin

* Print incarnatin

* Use proper incarnation

* Print dbValue

* Actually fix

* Actually fix

* Fix verifySnapshot

* readAccount to get code hash

* Next incarnation

* Print addrHashes with 0 incarnations

* Print storage history

* Print storage history

* Print storage history

* Print storage history

* Print all storage history

* print change set keys

* print change set keys

* print change set keys

* print change set keys

* Not print codebucket info

* Fixes

* Fix for incarnation

* Fix for storage history bucket

* Try to fix the leak

* Try to fix the leak

* Try to fix the leak

* Try to fix the leak

* Try to fix the leak

* Try to fix the leak

* Try to fix the leak

* Fix embedded nodes

* Hasher

* Fix

* Test fixes

* Add experimental debug flag

* Fix tx_pool_test

* Disable GetNodeData test unless in experiment

* Fix more tests

* Fix lint and revert some changes

* Fix lint

* Fix lint
2020-02-10 17:05:32 +00:00
Evgeny Danilenko
c7a10934d8
Mining data races (#361)
* data races

* log cencelation
2020-02-10 21:28:30 +07:00
Igor Mandrigin
aafacd04d7
Debug Web UI prototype (#362) 2020-02-09 13:31:52 +03:00
Andrew Ashikhmin
08e651c779 Add subtrie's nodes to the hash map when it's hooked (#360)
* log trie's hashMap size

* Add subtrie's nodes to the hash map when it's hooked
2020-02-08 22:18:20 +00:00
Igor Mandrigin
f4d0747949
stateless: flush the partial witnesses DB for every saved witness (#354)
* stateless: flush the partial witnesses DB for every saved witness.

it seems to fix to the out of memory error I had on blocks over 2.5M;

* fix linters

* simplify
2020-02-06 13:58:58 +03:00
Andrew Ashikhmin
8585516071
Serve GetNodeData for nodes in memory (Issue #300) 2020-02-06 11:53:09 +01:00
Igor Mandrigin
eb0a772070
BRANCH formal semantics (#337) 2020-02-06 13:39:31 +03:00
Richard Schumann
4f99f61268
adding some design assets including a new logo (#351)
* Create readme.MD

* update readme

* update readme

* update readme

* Update readme.MD

* update

* test

* Create test

* Create test

* Create readme.md

* masterfile logo turbo-geth

* Create readme.md

* turbo-geth logo rendered as png

* Create readme.md

* turbo-geth logo as svg

* Delete test

* colors

* colors preview + sketch library

* Delete test

* Create readme.md

* turbo-geth wallpapers + sketch file

Co-authored-by: ledgerwatch <akhounov@gmail.com>
2020-02-03 14:17:23 +00:00
Evgeny Danilenko
17a4a56634
Refactor mining. Remove a few mining goroutines (#338)
* add context

* extract chain events

* run commit in goroutines

* mine only on canonical

* typo

* linters

* fmt

* mark unused methods

* restore stress test

* test single miner

* remove unsafe Trie storage

* remove locks from miner

* restore interrupt

* remove result goroutine

* remove unconfirmedBlocks

* cherry-pick 04a1d475ff1a36ad8f92fec80385df18c52bdc1f

* extract uncles

* one miner succeeded

* restore context cancel

* cleanup

* skip an unstable test

* remove pending state

* use context instead of interrupt func

* calculate sealHash only once

* comment out unstable test

* after merge

* fix after merge

Co-authored-by: ledgerwatch <akhounov@gmail.com>
2020-02-03 15:02:26 +03:00