Commit Graph

11723 Commits

Author SHA1 Message Date
Martin Holst Swende
4535230059
cmd, core, eth: background transaction indexing (#20302)
* cmd, core, eth: init tx lookup in background

* core/rawdb: tiny log fixes to make it clearer what's happening

* core, eth: fix rebase errors

* core/rawdb: make reindexing less generic, but more optimal

* rlp: implement rlp list iterator

* core/rawdb: new implementation of tx indexing/unindex using generic tx iterator and hashing rlp-data

* core/rawdb, cmd/utils: fix review concerns

* cmd/utils: fix merge issue

* core/rawdb: add some log formatting polishes

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2020-05-11 18:58:43 +03:00
Felix Lange
6f54ae24cd
p2p: add 0 port check in dialer (#21008)
* p2p: add low port check in dialer

We already have a check like this for UDP ports, add a similar one in
the dialer. This prevents dials to port zero and it's also an extra
layer of protection against spamming HTTP servers.

* p2p/discover: use errLowPort in v4 code

* p2p: change port check

* p2p: add comment

* p2p/simulations/adapters: ensure assigned port is in all node records
2020-05-11 18:11:17 +03:00
AusIV
069a7e1f8a
core/rawdb: stop freezer process as part of freezer.Close() (#21010)
* core/rawdb: Stop freezer process as part of freezer.Close()

When you call db.Close(), it was closing the leveldb database first,
then closing the freezer, but never stopping the freezer process.
This could cause the freezer to attempt to write to leveldb after
leveldb had been closed, leading to a crash with a non-zero exit code.

This change adds a quit channel to the freezer, and freezer.Close()
will not return until the freezer process has stopped.

Additionally, when you call freezerdb.Close(), it will close the
AncientStore before closing leveldb, to ensure that the freezer goroutine
will be stopped before leveldb is closed.

* core/rawdb: Fix formatting for golint

* core/rawdb: Use backoff flag to avoid repeating select

* core/rawdb: Include accidentally omitted backoff
2020-05-11 15:11:17 +03:00
Martin Holst Swende
bd60295de5
console: fix some crashes/errors in the bridge (#21050)
Fixes #21046
2020-05-11 11:59:21 +02:00
Marius van der Wijden
930e82d7f4
params, cmd/utils: remove outdated discv5 bootnodes, deprecate flags (#20949)
* params: remove outdated discv5 bootnodes

* cmd/utils: deprecated bootnodesv4/v5 flags
2020-05-11 11:16:32 +03:00
Péter Szilágyi
37877e86ed
Merge pull request #21056 from karalabe/statedb-simpler-code
core/state: make GetCodeSize mirror GetCode implementation wise
2020-05-11 11:09:25 +03:00
gary rong
263622f44f
accounts/abi/bind/backend, internal/ethapi: recap gas limit with balance (#21043)
* accounts/abi/bind/backend, internal/ethapi: recap gas limit with balance

* accounts, internal: address comment and fix lint

* accounts, internal: extend log message

* tiny nits to format hexutil.Big and nil properly

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2020-05-11 11:08:20 +03:00
Péter Szilágyi
0b2edf05bb
core/state: make GetCodeSize mirror GetCode implementation wise 2020-05-11 10:28:56 +03:00
ligi
e29e4c2376
build: fix CLI params for windows LNK files (#21055)
* build: Fix CLI params for windows LNK files

closes #21054

* Remove parameters
2020-05-11 10:05:37 +03:00
Martin Holst Swende
82f9ed49fa
core/state: avoid statedb.dbErr due to emptyCode (#21051)
* core/state: more verbose stateb errors

* core/state: fix flaw

* core/state: fixed lint

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2020-05-08 21:52:20 +03:00
Martin Holst Swende
b0b65d017f
core/state: abort commit if read errors have occurred (#21039)
This finally adds the error check that the documentation of StateDB.dbErr
promises to do. dbErr was added in 9e5f03b6c (June 2017), and the check was
already missing in that commit. We somehow survived without it for three years.
2020-05-07 15:13:34 +02:00
Martin Holst Swende
1152f45849
core/state: include zero-address in state dump if present (#21038)
* Include 0x0000 address into the dump if it is present

* core/state: go fmt

Co-authored-by: Alexey Akhunov <akhounov@gmail.com>
2020-05-07 16:06:31 +03:00
Marius van der Wijden
dd88bd82c9
accounts/abi/bind: add void if no return args specified (#21002)
* accounts/abi/bind: add void if no return args specified

Currently the java generator generates invalid input on pure/view functions
that have no return type. e.g. `function f(uint u) view public {}`
This is not a problem in practice as people rarely ever write functions like this.

* accounts/abi/bind: use elseif instead of nested if
2020-05-07 10:24:10 +03:00
gary rong
85944c2561
core/state/snapshot: fix typo (#21037) 2020-05-07 10:07:59 +03:00
Péter Szilágyi
87c463c47a
Merge pull request #21036 from karalabe/snapshot-storage-leak
core/state/snapshot: don't create storage list for non-existing accounts
2020-05-06 18:11:15 +03:00
Péter Szilágyi
90af6dae6e
core/state/snapshot: don't create storage list for non-existing accounts 2020-05-06 17:22:38 +03:00
Boqin Qin
39c64d85a2
core: avoid double-lock in tx_pool_test (#20984) 2020-05-06 15:47:59 +02:00
Guillaume Ballet
234cc8e77f
eth/downloader: minor typo fixes in comments (#21035) 2020-05-06 15:35:04 +02:00
gary rong
5cdc2dffda
trie: fix TestBadRangeProof unit test (#21034) 2020-05-06 15:33:57 +02:00
ploui
c2147ee154
eth: don't inadvertently enable snapshots in archive nodes (#21025)
* eth: don't reassign more cache than is being made available

* eth: don't inadvertently enable snapshot in a case where --snapshot wasn't given
2020-05-06 13:01:01 +03:00
Péter Szilágyi
b98259868b
Merge pull request #21032 from karalabe/skip-announce-goroutine-eth64
eth: skip transaction announcer goroutine on eth<65
2020-05-06 12:59:33 +03:00
Péter Szilágyi
292570ad6c
Merge pull request #21028 from karalabe/memfix-32bit-arch
cmd/geth: handle memfixes on 32bit arch with large RAM
2020-05-06 12:58:51 +03:00
Péter Szilágyi
34ed2d834a
eth: skip transaction announcer goroutine on eth<65 2020-05-06 12:47:27 +03:00
Marius van der Wijden
933acf3389
account/abi: remove superfluous type checking (#21022)
* accounts/abi: added getType func to Type struct

* accounts/abi: fixed tuple unpack

* accounts/abi: removed type.Type

* accounts/abi: added comment

* accounts/abi: removed unused types

* accounts/abi: removed superfluous declarations

* accounts/abi: typo
2020-05-05 16:30:43 +02:00
Péter Szilágyi
44a3b8c04c
Merge pull request #21026 from karalabe/disable-highmem-test
tests: skip consensus test using 1GB RAM
2020-05-05 15:11:40 +03:00
Péter Szilágyi
a52511e692
build: raise test timeout back to 10 mins (#21027) 2020-05-05 15:11:00 +03:00
Péter Szilágyi
8f8ff8d601
cmd/geth: handle memfixes on 32bit arch with large RAM 2020-05-05 14:22:51 +03:00
Péter Szilágyi
4515772993
tests: skip consensus test using 1GB RAM 2020-05-05 12:27:09 +03:00
rene
c989bca173
cmd/utils: renames flags related to http-rpc server (#20935)
* rpc flags related to starting http server renamed to http

* old rpc flags aliased and still functional

* pprof flags fixed

* renames gpo related flags

* linted

* renamed rpc flags for consistency and clarity

* added warn logs

* added more warn logs for all deprecated flags for consistency

* moves legacy flags to separate file, hides older flags under show-deprecated-flags command

* legacy prefix and moved some more legacy flags to legacy file

* fixed circular import

* added docs

* fixed imports lint error

* added notes about when flags were deprecated

* cmd/utils: group flags by deprecation date + reorder by date,

* modified deprecated comments for consistency, added warn log for --rpc

* making sure deprecated flags are still functional

* show-deprecated-flags command cleaned up

* fixed lint errors

* corrected merge conflict

* IsSet --> GlobalIsSet

* uncategorized flags, if not deprecated, displayed under misc

Co-authored-by: Martin Holst Swende <martin@swende.se>
2020-05-05 11:19:17 +03:00
Péter Szilágyi
587656619d
Merge pull request #21023 from karalabe/snapshot-verify-iterator-release
core/state/snapshot: release iterator after verification
2020-05-04 17:10:17 +03:00
Péter Szilágyi
da59147014
core/state/snapshot: release iterator after verification 2020-05-04 15:14:08 +03:00
Péter Szilágyi
5e45db7610
Merge pull request #21021 from karalabe/tests-snapshot-gen-cleanup
tests: cleanup snapshot generator goroutine leak
2020-05-04 15:12:35 +03:00
Marius van der Wijden
ab72803e6f
accounts/abi: move U256Bytes to common/math (#21020) 2020-05-04 14:09:14 +02:00
Marius van der Wijden
e872083d44
accounts/abi: removed Kind from Type struct (#21009)
* accounts/abi: removed Kind from Type struct

* accounts/abi: removed unused code
2020-05-04 13:20:20 +02:00
Péter Szilágyi
65cd28aa0e
tests: cleanup snapshot generator goroutine leak 2020-05-04 12:10:02 +03:00
Martin Holst Swende
510b6f90db
accounts/external: convert signature v value to 0/1 (#20997)
This fixes an issue with clef, which already transforms the signature
to use the legacy 27/28 encoding.

Fixes #20994
2020-05-01 13:52:41 +02:00
Boqin Qin
c43be6cf87
les: remove invalid use of t.Fatal in TestHandshake (#21012) 2020-05-01 13:48:52 +02:00
Felix Lange
7e4d1925f0
go.sum: run go mod tidy (#21014) 2020-05-01 12:51:04 +02:00
Martin Holst Swende
d2d3166f35
accounts/external: fill account-cache if that hasn't already been done, fixes #20995 (#20998) 2020-04-30 18:57:06 +02:00
gary rong
2337aa64eb
core/state/snapshot: fix trie generator reporter (#21004) 2020-04-30 10:43:50 +03:00
Péter Szilágyi
3cebfb6664
Merge pull request #21003 from karalabe/snapshot-journal-nilfix
core/state/snapshot: fix journal nil deserialziation
2020-04-30 10:26:25 +03:00
Péter Szilágyi
4b6f6ffe23
core/state/snapshot: fix journal nil deserialziation 2020-04-29 18:00:29 +03:00
gary rong
26d271dfbb
core/state/snapshot: implement storage iterator (#20971)
* core/state/snapshot: implement storage iterator

* core/state/snapshot, tests: implement helper function

* core/state/snapshot: fix storage issue

If an account is deleted in the tx_1 but recreated in the tx_2,
the it can happen that in this diff layer, both destructedSet
and storageData records this account. In this case, the storage
iterator should be able to iterate the slots belong to new account
but disable further iteration in deeper layers(belong to old account)

* core/state/snapshot: address peter and martin's comment

* core/state: address comments

* core/state/snapshot: fix test
2020-04-29 12:53:08 +03:00
ucwong
1264c19f11
go.mod : goupnp v1.0.0 upgrade (#20996) 2020-04-28 14:57:07 +03:00
Martin Holst Swende
7f95a85fd4
signer, log: properly escape character sequences (#20987)
* signer: properly handle terminal escape characters

* log: use strconv conversion instead of custom escape function

* log: remove relection tests for nil
2020-04-28 14:28:38 +03:00
ucwong
0708b573bc
event, whisper/whisperv6: use defer where possible (#20940) 2020-04-28 10:53:08 +02:00
Steven E. Harris
9887edd580
rpc: add explicit 200 response for empty HTTP GET (#20952) 2020-04-28 10:43:21 +02:00
ucwong
1893266c59
go.mod: upgrade to golang-lru v0.5.4 (#20992)
golang-lru is now a go module, and the upgrade corrects a couple
of minor issues. In particular, the library could crash if you inserted
nil into an LRU cache.
2020-04-28 10:22:23 +02:00
Felix Lange
92a7538ed3
core: improve TestLogRebirth (#20961)
This is a resubmit of #20668 which rewrites the problematic test
without any additional goroutines. It also documents the test better.

The purpose of this test is checking whether log events are sent
correctly when importing blocks. The test was written at a time when
blockchain events were delivered asynchronously, making the check hard
to pull off. Now that core.BlockChain delivers events synchronously
during the call to InsertChain, the test can be simplified.

Co-authored-by: BurtonQin <bobbqqin@gmail.com>
2020-04-28 10:06:49 +02:00
Julian Y
5c3993444d
rpc: make ExampleClientSubscription work with the geth API (#19483)
This corrects the call to eth_getBlockByNumber, which previously
returned this error:

  can't get latest block: missing value for required argument 1

Co-authored-by: Felix Lange <fjl@twurst.com>
2020-04-27 17:25:24 +02:00