Commit Graph

11930 Commits

Author SHA1 Message Date
gary rong
434245bb01 core/state/snapshot: fix trie generator reporter (#21004)
# Conflicts:
#	core/state/snapshot/conversion.go
#	go.sum
2020-05-20 15:26:22 +03:00
Péter Szilágyi
5f3bcbe1c3 core/state/snapshot: fix journal nil deserialziation
# Conflicts:
#	core/state/snapshot/journal.go
2020-05-20 15:26:22 +03:00
gary rong
c646d6abf3 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
# Conflicts:
#	core/state/snapshot/account.go
#	core/state/snapshot/conversion.go
#	core/state/snapshot/difflayer.go
#	core/state/snapshot/difflayer_test.go
#	core/state/snapshot/generate.go
#	core/state/snapshot/iterator.go
#	core/state/snapshot/iterator_binary.go
#	core/state/snapshot/iterator_fast.go
#	core/state/snapshot/iterator_test.go
#	core/state/snapshot/snapshot.go
#	core/state/snapshot/snapshot_test.go
#	core/state/statedb.go
#	tests/block_test_util.go
2020-05-20 15:26:22 +03:00
ucwong
177eba9806 go.mod : goupnp v1.0.0 upgrade (#20996)
# Conflicts:
#	go.mod
#	go.sum
2020-05-20 15:26:22 +03:00
Martin Holst Swende
c39d21415a 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-05-20 15:26:22 +03:00
ucwong
3bf99802c6 event, whisper/whisperv6: use defer where possible (#20940)
# Conflicts:
#	whisper/whisperv6/whisper.go
2020-05-20 15:26:22 +03:00
Steven E. Harris
d047bc90cd rpc: add explicit 200 response for empty HTTP GET (#20952) 2020-05-20 15:26:22 +03:00
ucwong
4753d95fc9 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.
# Conflicts:
#	go.mod
#	go.sum
2020-05-20 15:26:22 +03:00
Felix Lange
d5469b3b3c 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>
# Conflicts:
#	core/blockchain_test.go
2020-05-20 15:26:22 +03:00
Julian Y
3406f9d718 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>
# Conflicts:
#	rpc/client_example_test.go
2020-05-20 15:26:22 +03:00
Boqin Qin
9258f47717 core: add check in AddChildIndexer to avoid double lock (#20982)
This fixes a theoretical double lock condition which could occur in

    indexer.AddChildIndexer(indexer)

Nobody would ever do that though.

Co-authored-by: Felix Lange <fjl@twurst.com>
2020-05-20 15:26:22 +03:00
Marius van der Wijden
3c2b9248ed accounts/abi: added abi test cases, minor bug fixes (#20903)
* accounts/abi: added documentation

* accounts/abi: reduced usage of arguments.LengthNonIndexed

* accounts/abi: simplified reflection logic

* accounts/abi: moved testjson data into global declaration

* accounts/abi: removed duplicate test cases

* accounts/abi: reworked abi tests

* accounts/abi: added more tests for abi packing

* accounts/abi/bind: refactored base tests

* accounts/abi: run pack tests as subtests

* accounts/abi: removed duplicate tests

* accounts/abi: removed unnused arguments.LengthNonIndexed

Due to refactors to the code, we do not need the arguments.LengthNonIndexed function anymore.
You can still get the length by calling len(arguments.NonIndexed())

* accounts/abi: added type test

* accounts/abi: modified unpack test to pack test

* accounts/abi: length check on arrayTy

* accounts/abi: test invalid abi

* accounts/abi: fixed rebase error

* accounts/abi: fixed rebase errors

* accounts/abi: removed unused definition

* accounts/abi: merged packing/unpacking tests

* accounts/abi: fixed [][][32]bytes encoding

* accounts/abi: added tuple test cases

* accounts/abi: renamed getMockLog -> newMockLog

* accounts/abi: removed duplicate test

* accounts/abi: bools -> booleans
# Conflicts:
#	accounts/abi/unpack_test.go
2020-05-20 15:26:22 +03:00
Steven E. Harris
8856454979 node: shut down all node-related HTTP servers gracefully (#20956)
Rather than just closing the underlying network listener to stop our
HTTP servers, use the graceful shutdown procedure, waiting for any
in-process requests to finish.
2020-05-20 15:26:22 +03:00
Péter Szilágyi
2f13f9835a eth: fix shutdown regression to abort downloads, not just cancel 2020-05-20 15:26:22 +03:00
tgyKomgo
82171fe189 p2p/enode: update code comment (#20972)
It is possible to specify enode URLs using domain name since
commit b90cdbaa79, but the code comment still said that only
IP addresses are allowed.

Co-authored-by: admin@komgo.io <KomgoRocks2018!>
2020-05-20 15:26:22 +03:00
gary rong
91061d043e core/state/snapshot: fix binary iterator (#20970)
# Conflicts:
#	core/state/snapshot/iterator_binary.go
#	core/state/snapshot/iterator_test.go
2020-05-20 15:26:22 +03:00
gary rong
126d94fa7c trie: initial implementation for range proof (#20908)
* trie: initial implementation for range proof

* trie: add benchmark

* trie: fix lint

* trie: fix minor issue

* trie: unset the edge valuenode as well

* trie: unset the edge valuenode as nilValuenode
# Conflicts:
#	les/odr_requests.go
#	trie/proof.go
#	trie/proof_test.go
2020-05-20 15:26:22 +03:00
Marius van der Wijden
a7e120dc4c accounts/keystore: fix double import race (#20915)
* accounts/keystore: fix race in Import/ImportECDSA

* accounts/keystore: added import/export tests

* cmd/geth: improved TestAccountImport test

* accounts/keystore: added import/export tests

* accounts/keystore: fixed naming

* accounts/keystore: fixed typo

* accounts/keystore: use mutex instead of rwmutex

* accounts: use errors instead of fmt
# Conflicts:
#	accounts/keystore/keystore_test.go
#	cmd/geth/accountcmd_test.go
2020-05-20 15:26:22 +03:00
icodezjb
83857d4f4a core: mirror full node reorg logic in light client too (#20931)
* core: fix the condition of reorg

* core: fix nitpick to only retrieve head once

* core: don't reorg if received chain is longer at same diff

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
# Conflicts:
#	core/headerchain.go
2020-05-20 15:26:22 +03:00
gary rong
ad9e4241b1 all: seperate consensus error and evm internal error (#20830)
* all: seperate consensus error and evm internal error

There are actually two types of error will be returned when
a tranaction/message call is executed: (a) consensus error
(b) evm internal error. The former should be converted to
a consensus issue, e.g. The sender doesn't enough asset to
purchase the gas it specifies. The latter is allowed since
evm itself is a blackbox and internal error is allowed to happen.

This PR emphasizes the difference by introducing a executionResult
structure. The evm error is embedded inside. So if any error
returned, it indicates consensus issue happens.

And also this PR improve the `EstimateGas` API to return the concrete
revert reason if the transaction always fails

* all: polish

* accounts/abi/bind/backends: add tests

* accounts/abi/bind/backends, internal: cleanup error message

* all: address comments

* core: fix lint

* accounts, core, eth, internal: address comments

* accounts, internal: resolve revert reason if possible

* accounts, internal: address comments
# Conflicts:
#	accounts/abi/abi.go
#	accounts/abi/bind/backends/simulated.go
#	cmd/geth/retesteth.go
#	core/state/snapshot/difflayer_test.go
#	core/state/snapshot/disklayer_test.go
#	core/state/snapshot/iterator_test.go
#	core/state_processor.go
#	core/state_transition.go
#	core/vm/evm.go
#	core/vm/instructions.go
#	core/vm/jump_table.go
#	eth/api_tracer.go
#	internal/ethapi/api.go
#	les/odr_test.go
#	light/odr_test.go
#	tests/state_test_util.go
2020-05-20 15:26:22 +03:00
ucwong
b781181b28 go.mod : update fastcache to 1.5.7 (#20936)
# Conflicts:
#	go.mod
#	go.sum
2020-05-20 15:26:22 +03:00
ucwong
6f75f79ebe p2p: defer wait group done in protocol start (#20951) 2020-05-20 15:26:22 +03:00
Martin Holst Swende
e0f33c2abb core/state/snapshot: make difflayer account iterator seek operation inclusive
# Conflicts:
#	core/state/snapshot/iterator.go
#	core/state/snapshot/iterator_test.go
2020-05-20 15:26:22 +03:00
Boqin Qin
94abaf9542 snapshot: add Unlock before return (#20948)
* Forget Unlock in snapshot

* Remove Unlock before panic
# Conflicts:
#	core/state/snapshot/iterator.go
2020-05-20 15:26:22 +03:00
rene
aa2f2b742a cmd, core: remove override muir glacier and override istanbul (#20942)
# Conflicts:
#	core/genesis.go
#	eth/backend.go
#	les/client.go
2020-05-20 15:26:22 +03:00
Marius van der Wijden
b3ce15932b accounts/abi: Prevent recalculation of internal fields (#20895)
* accounts/abi: prevent recalculation of ID, Sig and String

* accounts/abi: fixed unpacking of no values

* accounts/abi: multiple fixes to arguments

* accounts/abi: refactored methodName and eventName

This commit moves the complicated logic of how we assign method names
and event names if they already exist into their own functions for
better readability.

* accounts/abi: prevent recalculation of internal

In this commit, I changed the way we calculate the string
representations, sig representations and the id's of methods. Before
that these fields would be recalculated everytime someone called .Sig()
.String() or .ID() on a method or an event.

Additionally this commit fixes issue #20856 as we assign names to inputs
with no name (input with name "" becomes "arg0")

* accounts/abi: added unnamed event params test

* accounts/abi: fixed rebasing errors in method sig

* accounts/abi: fixed rebasing errors in method sig

* accounts/abi: addressed comments

* accounts/abi: added FunctionType enumeration

* accounts/abi/bind: added test for unnamed arguments

* accounts/abi: improved readability in NewMethod, nitpicks

* accounts/abi: method/eventName -> overloadedMethodName
# Conflicts:
#	accounts/abi/abi.go
#	accounts/abi/abi_test.go
2020-05-20 15:26:22 +03:00
Boqin Qin
b70eaf8a21 event: fix inconsistency in Lock and Unlock (#20933)
Co-authored-by: Felix Lange <fjl@twurst.com>
2020-05-20 15:26:22 +03:00
Nishant Das
93840b6c72 p2p/discover: add helper methods to UDPv5 (#20918)
This adds two new methods to UDPv5, AllNodes and LocalNode.

AllNodes returns all the nodes stored in the local table; this is
useful for the purposes of metrics collection and also debugging any
potential issues with other discovery v5 implementations.

LocalNode returns the local node object. The reason for exposing this
is so that users can modify and set/delete new key-value entries in
the local record.
2020-05-20 15:26:22 +03:00
Péter Szilágyi
62e8bc4db9 params: begin v1.9.14 release cycle 2020-05-20 15:26:22 +03:00
Martin Holst Swende
6230254b02 trie: fix concurrent usage of secKeyBuf, ref #20920
# Conflicts:
#	trie/database.go
2020-05-20 15:26:22 +03:00
Igor Mandrigin
ef737c457a add to-merge 2020-05-20 15:26:22 +03:00
Andrew Ashikhmin
5bc45f2426
Use uint256 in EVM implementation (kudos to Pawel Bylica) (#551)
* core/vm: improve jumpdest lookup

* Use uint256 in EVM implementation (kudos to Pawel Bylica)

* Safety precaution in opMulmod

Co-authored-by: Martin Holst Swende <martin@swende.se>
2020-05-18 08:10:59 +01:00
ledgerwatch
1fb11f4323
Decompose SubTrieLoader into DB loading and trie building part (#555)
* First change

* Fix

* Fix

* Completely decompose finaliseRoot and finaliseStorageRoot

* Further decomposition

* Fix linter

* Created receiver function

* Separate DefaultReceiver

* Introduce middle receiver

* Prototype of getProof, not working correctly yet

* Fix linter

* Fix linter

* Fix lint
2020-05-18 08:02:58 +01:00
Alex Sharov
b3a5c62147
sort buckets then sort keys inside buckets, then send data to MultiPut (#553) 2020-05-17 05:46:30 +01:00
ledgerwatch
3cf6466635
Separation of DB iterations from GenStructStep in the SubTrieLoader (#552)
* Use stream type constants

* More changes

* Fixes

* Diagnostics

* go.mod

* Fixes

* Fixes

* Tests

* Fixes

* Remove printf

* Remove Current() from RetainList

* Fix tests
2020-05-16 10:48:02 +01:00
Alex Sharov
02dd405e93
MGR Schedule v0 (#550)
* MGR Make Schedule v0
2020-05-15 15:58:36 +07:00
ledgerwatch
f9d83c655b
Cap number of goroutines to 3 (#549) 2020-05-15 08:52:58 +01:00
Igor Mandrigin
fd77eaf86a
Staged Sync: Execution phase should use "plain state" (#548)
* introduce PlainStateReader with fallbacks

* no 10.000 changes in tests

* even less iterations

* remove even more iterations

* add `go run ./cmd/geth --syncmode staged --plainstate` flag

* fix serialization calls

* make a more sensible file default

doesn’t affect anything, because this flag is always overriden when parsing CLI. but still.
2020-05-15 08:52:45 +01:00
ledgerwatch
729303eb6b
Start transforming SubTrieLoader into iterator/stream (#547)
* Splitting up into interations

* Some fixes

* Fixes

* Fix linter

* Fix linter

* Improvements after review

* Add more diagnostics

* Fix and better printing
2020-05-14 18:12:33 +01:00
ledgerwatch
9f3f768ab4
Rename Resolver => SubTrieLoader, ResolveSet => RetainList (#544)
* Rename Resolver => SubTrieLoader, ResolveSet => RetainList

* Fix linter

* Fix linter

* Fix linter

* Fix linter
2020-05-12 15:24:43 +01:00
ledgerwatch
82a67f4d48
eth_getProof step2 - Decouple Resolver from Trie, remove ResolveRequest (#543)
* Removing PrepareResolveParams and NeedResolution

* Remove ResolveRequest

* Decouple resolver from trie

* Remove hooks from resolver

* Fix util compilation

* More test fixes

* Compiled tests in trie

* Fix trie tests

* Fix linter

* Fix linter

* Fix linter

* Fix linter
2020-05-12 08:22:45 +01:00
ledgerwatch
41b5fce078
resolver: merge HashBuilder-s and ResolveSet-s, decouple from ResolveRequest-s (#540)
* merge hbStorage and hb in resolver

* Fix prepare

* Remove tracing by default

* cleanup

* Fix linter

* Not to include incarnation into the ResolveRequest

* Fix linter

* Fix linter

* Fix test

* Fix linter

* Revert

* Fix for infinite loop

* Fix linter

* Collapse rss into rs

* remove reliance of requests in resolver

* Remove currentReq

* Remove fields from ResolveRequest

* Fix linter
2020-05-11 05:46:07 +01:00
ledgerwatch
cc9163a41c
Remove empty file (#541)
* Remove empty file

* Remove another file
2020-05-10 21:43:49 +01:00
Giulio rebuffo
89a4f8ddff
Fix --rinkeby and --goerli (#539)
* fixed goerli and rinkeby testnets

* merge
2020-05-09 20:29:00 +01:00
ledgerwatch
8ded73fc4f
Refactoring of resolver_stateful (#537) 2020-05-09 12:37:09 +01:00
ledgerwatch
5b2a11137b
[WIP] Fix block tests that were failing due to CalcTrieRoots (#536)
* Fix block tests, add support for code nodes in the stream

* Fix typo

* Fix test

* Comment cleanup
2020-05-09 05:44:56 +01:00
ledgerwatch
ba27c39615
Optimise resolver (#535)
* Avoid repetitive skipping in resolver

* Fix linter

* Stop overshooting
2020-05-08 14:41:37 +01:00
ledgerwatch
b4d2e57428
Introduce incarnationMap in both DbStateReader and DbStateWriter (#534)
* Add incarnationMap into db_state_reader

* Fix test

* Add incarnationMap back to the DbStateWriter
2020-05-08 05:52:55 +01:00
ledgerwatch
d60e35e80e
Fix for the sync failure on block 2792476 (#533)
* Commit after every block

* Commit after every block

* Read account

* Read account

* Small rewrite of resolver logic

* Revert "Commit after every block"

This reverts commit 6a67392f99860ca544fb6d3f4333ea36b9399b7a.

* Revert "Commit after every block"

This reverts commit 6da4c2296fa61d952de5f51e29ed68905d33c3ee.

* Fix linter

* Fix

* Fix

* Fix

* Fix

* Optimisation

* Fixes

* Skip irrelevant storage always

* Fix

* testResolve

* Another fix

* Fix

* Fix fix

* Cleanup
2020-05-08 05:52:43 +01:00
b00ris
2a6f12520c
remove pruning option. Inverse enabling pruning logic. (#532) 2020-05-07 14:31:14 +01:00