Commit Graph

8714 Commits

Author SHA1 Message Date
Péter Szilágyi
8f12d76a47
params: remove redundant consts, disable metro on AllProtocolChanges 2017-07-04 12:28:58 +03:00
Nick Johnson
be8f8409bc eth/downloader, les, light: Changes in response to review 2017-07-03 15:17:12 +01:00
Martin Holst Swende
a633a2d7ea core: Prevent local tx:s from being discarded 2017-06-30 22:55:10 +02:00
Martin Holst Swende
67aff49822 core: Change local-handling to use sender-account instead of tx hashes 2017-06-30 22:43:26 +02:00
Péter Szilágyi
8c313eed26
consensus, core: EIP 100 polishes, fix chain maker diff
This PR polishes the EIP 100 difficulty adjustment algorithm
to match the same mechanisms as the Homestead was implemented
to keep the code uniform. It also avoids a few memory allocs
by reusing big1 and big2, pulling it out of the common package
and into ethash.

The commit also fixes chain maker to forward the uncle hash
when creating a simulated chain (it wasn't needed until now
so we just skipped a copy there).
2017-06-30 16:42:09 +03:00
Jeffrey Wilcke
c4d28aee9b
consensus/ethash: implement Metropolis EIP 100 2017-06-30 16:41:25 +03:00
Péter Szilágyi
a0aa071ca6 Merge pull request #14732 from ethersphere/swarm-remove-ethapi
cmd/swarm: Exit if --ethapi is set
2017-06-30 13:06:52 +03:00
Lewis Marshall
c7041fe145 cmd/swarm: Exit if --ethapi is set
The previous attempt to use --ethapi as a fallback if --ens-api is not
set does not work because --ens-api has a default value, and also
setting --ens-api to "" is the suggested way to disable ENS lookups.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
2017-06-30 10:16:03 +01:00
Péter Szilágyi
41318f3776 Merge pull request #14646 from ethersphere/swarm-ens-api
cmd/swarm: Support using Mainnet for resolving ENS names
2017-06-29 19:09:01 +03:00
Péter Szilágyi
65b96dc4b9 Merge pull request #14727 from holiman/count_txs_right
Fix error when reporting numer of txs in imported blocks
2017-06-29 16:49:43 +03:00
Martin Holst Swende
8bbd598ef4 core: fix an off-by-one when the block import counts blocks 2017-06-29 14:19:10 +02:00
Nick Johnson
ae11545bc5 eth, les: Refactor downloader peer to use structs 2017-06-29 12:49:18 +01:00
Nick Johnson
0550957989 eth, les, light: Refactor downloader to use blockchain interface 2017-06-28 15:58:41 +01:00
Péter Szilágyi
dfd076244d Merge pull request #14718 from holiman/gascalc_fix
core/vm: fix overflow in gas calculation formula
2017-06-28 13:12:13 +03:00
Martin Holst Swende
6dc32e897a core/vm: add benchmarks for some ops and precompiles (#14641) 2017-06-28 11:45:45 +02:00
Martin Holst Swende
e4301564c2 core/vm : fix testcase for gas calculation 2017-06-28 10:47:07 +02:00
Martin Holst Swende
bae7565231 core/vm: fix overflow in gas calculation formula 2017-06-28 09:51:31 +02:00
Felix Lange
9e5f03b6c4 core/state: access trie through Database interface, track errors (#14589)
With this commit, core/state's access to the underlying key/value database is
mediated through an interface. Database errors are tracked in StateDB and
returned by CommitTo or the new Error method.

Motivation for this change: We can remove the light client's duplicated copy of
core/state. The light client now supports node iteration, so tracing and storage
enumeration can work with the light client (not implemented in this commit).
2017-06-27 15:57:06 +02:00
Péter Szilágyi
bb366271fe Merge pull request #14686 from fjl/hexutil-json-type-error
common/hexutil: wrap errors in json.UnmarshalTypeError
2017-06-27 15:02:43 +03:00
Felix Lange
4a741df757 common/hexutil: wrap errors in json.UnmarshalTypeError
This adds type and struct field context to error messages.
Instead of "hex string of odd length" users will now see "json: cannot
unmarshal hex string of odd length into Go struct field SendTxArgs.from
of type common.Address".
2017-06-27 13:15:12 +02:00
RJ Catalano
5421a08d2f accounts/abi: reorganizing package with small fixes (#14610)
* accounts/abi: reorganizing package and some notes and a quick correction of name.

Signed-off-by: RJ Catalano <rj@monax.io>

get rid of some imports

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: move file names

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: fix boolean decode function

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: fix for the array set and for creating a bool

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: be very very very correct

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: fix up error message and variable names

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: take out unnecessary argument in pack method

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: add bool unpack test and add a panic to readBool function

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: fix panic message

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: change from panic to basic error

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: fix nil to false

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: fill out type regex tests and fill with the correct type for integers

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: move packNumbers into pack.go.

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: separation of the testing suite into appropriately named files.

Signed-off-by: RJ Catalano <rj@monax.io>

* account/abi: change to hex string tests.

Signed-off-by: RJ Catalano <rj@monax.io>

* account/abi: fix up rest of tests to hex

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: declare bool at the package level

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: use errors package in the error file.

Signed-off-by: RJ Catalano <rj@monax.io>

* accounts/abi: fix ugly hack and fix error type declaration.

Signed-off-by: RJ Catalano <rj@monax.io>
2017-06-27 11:05:33 +03:00
Addy Yeow
cf611c50b9 build: fix devel golang detection on debian/ubuntu (#14711) 2017-06-27 09:11:41 +02:00
Péter Szilágyi
c008176f9f Merge pull request #14690 from karalabe/faucet-key-reuse
cmd/puppeth: fix key reuse during faucet deploys
2017-06-26 14:03:46 +03:00
Lewis Marshall
f3359d5e58 cmd/swarm: Support using Mainnet for resolving ENS names
Signed-off-by: Lewis Marshall <lewis@lmars.net>
2017-06-26 12:51:33 +02:00
Péter Szilágyi
feb2932706 Merge pull request #14540 from bas-vk/whisper-api
whisperv5: integrate whisper and implement API
2017-06-26 13:44:35 +03:00
Péter Szilágyi
ea1d1825a8 cmd/geth: fix whisper flag group capitalization 2017-06-26 13:40:43 +03:00
Péter Szilágyi
f321ed23fb Merge pull request #14687 from markya0616/unused_events
core: remove unused events
2017-06-26 13:27:39 +03:00
bloonfield
413dc1d265 rpc: fix closure problem in batch processing (#14688)
Demo of the issue: https://play.golang.org/p/EeTLFfppqC
2017-06-26 12:26:22 +03:00
Péter Szilágyi
fdf2184b1e Merge pull request #14697 from homotopycolimit/master
swarm/storage: remove panic on invalid chunk
2017-06-26 12:21:11 +03:00
Aron
3c7338d6c8 Makefile: add make swarm command (#14698)
* Makefile: add make swarm command

* Makefile: minor code formatting polishes
2017-06-26 12:19:53 +03:00
G. Kay Lee
ef8d4711d5 Update README.md (#14701)
README: change heading to "Go Ethereum"
2017-06-26 12:17:06 +03:00
aron
caa00b7e6d swarm/storage: remove panic on invalid chunk 2017-06-25 16:10:54 +02:00
Péter Szilágyi
5603eb9116
cmd/puppeth: fix key reuse during faucet deploys 2017-06-23 13:34:21 +03:00
Felix Lange
78c04c920d params, VERSION: 1.6.7 unstable 2017-06-23 11:28:43 +02:00
Felix Lange
10a45cb59b params: 1.6.6 stable 2017-06-23 11:26:54 +02:00
Péter Szilágyi
cd88f69715 Merge pull request #14596 from markya0616/valid_clique_vote
consensus/clique: choose valid votes
2017-06-23 11:21:38 +03:00
Péter Szilágyi
46d0d04f97 Merge pull request #14685 from karalabe/ethdb-metrics-fail-fix
eth: gracefully error if database cannot be opened
2017-06-23 11:10:29 +03:00
Péter Szilágyi
514659a023
consensus/clique: minor cleanups 2017-06-23 11:06:38 +03:00
Felix Lange
01c9cf1cb5 node: don't return non-nil database on error 2017-06-23 09:56:30 +02:00
Péter Szilágyi
b751cf3901 Merge pull request #14681 from fjl/build-fixup
travis.yml, cmd/swarm: fix Travis CI build
2017-06-23 10:30:27 +03:00
Bas van Kervel
b6e99deee9 whisper: renamed Info#Message to Info#Messages 2017-06-23 09:18:02 +02:00
Péter Szilágyi
d40179f882
eth: gracefully error if database cannot be opened 2017-06-23 10:12:41 +03:00
mark.lin
beb708e6d7 core: remove unused events 2017-06-23 10:39:38 +08:00
Felix Lange
f2c5b2cc1c travis.yml: add fakeroot to launchpad builder 2017-06-22 22:21:59 +02:00
Felix Lange
a4277450b2 cmd/swarm: disable TestCLISwarmUp because it's flaky 2017-06-22 22:17:53 +02:00
Péter Szilágyi
b664bedcf2 Merge pull request #14673 from holiman/txfix
core: add testcase for txpool
2017-06-22 23:01:43 +03:00
Péter Szilágyi
eebde1a2e2
core: ensure transactions correctly drop on pool limiting 2017-06-22 21:03:54 +03:00
Martin Holst Swende
b0b3cf2eeb
core: add testcase for txpool 2017-06-22 20:36:07 +03:00
Péter Szilágyi
c98d9b49bf Merge pull request #14677 from karalabe/miner-cli-gasprice
cmd/geth: corrently init gas price for CLI CPU mining
2017-06-22 15:54:24 +03:00
Felix Lange
0042f13d47 eth/downloader: separate state sync from queue (#14460)
* eth/downloader: separate state sync from queue

Scheduling of state node downloads hogged the downloader queue lock when
new requests were scheduled. This caused timeouts for other requests.
With this change, state sync is fully independent of all other downloads
and doesn't involve the queue at all.

State sync is started and checked on in processContent. This is slightly
awkward because processContent doesn't have a select loop. Instead, the
queue is closed by an auxiliary goroutine when state sync fails. We
tried several alternatives to this but settled on the current approach
because it's the least amount of change overall.

Handling of the pivot block has changed slightly: the queue previously
prevented import of pivot block receipts before the state of the pivot
block was available. In this commit, the receipt will be imported before
the state. This causes an annoyance where the pivot block is committed
as fast block head even when state downloads fail. Stay tuned for more
updates in this area ;)

* eth/downloader: remove cancelTimeout channel

* eth/downloader: retry state requests on timeout

* eth/downloader: improve comment

* eth/downloader: mark peers idle when state sync is done

* eth/downloader: move pivot block splitting to processContent

This change also ensures that pivot block receipts aren't imported
before the pivot block itself.

* eth/downloader: limit state node retries

* eth/downloader: improve state node error handling and retry check

* eth/downloader: remove maxStateNodeRetries

It fails the sync too much.

* eth/downloader: remove last use of cancelCh in statesync.go

Fixes TestDeliverHeadersHang*Fast and (hopefully)
the weird cancellation behaviour at the end of fast sync.

* eth/downloader: fix leak in runStateSync

* eth/downloader: don't run processFullSyncContent in LightSync mode

* eth/downloader: improve comments

* eth/downloader: fix vet, megacheck

* eth/downloader: remove unrequested tasks anyway

* eth/downloader, trie: various polishes around duplicate items

This commit explicitly tracks duplicate and unexpected state
delieveries done against a trie Sync structure, also adding
there to import info logs.

The commit moves the db batch used to commit trie changes one
level deeper so its flushed after every node insertion. This
is needed to avoid a lot of duplicate retrievals caused by
inconsistencies between Sync internals and database. A better
approach is to track not-yet-written states in trie.Sync and
flush on commit, but I'm focuing on correctness first now.

The commit fixes a regression around pivot block fail count.
The counter previously was reset to 1 if and only if a sync
cycle progressed (inserted at least 1 entry to the database).
The current code reset it already if a node was delivered,
which is not stong enough, because unless it ends up written
to disk, an attacker can just loop and attack ad infinitum.

The commit also fixes a regression around state deliveries
and timeouts. The old downloader tracked if a delivery is
stale (none of the deliveries were requestedt), in which
case it didn't mark the node idle and did not send further
requests, since it signals a past timeout. The current code
did mark it idle even on stale deliveries, which eventually
caused two requests to be in flight at the same time, making
the deliveries always stale and mass duplicating retrievals
between multiple peers.

* eth/downloader: fix state request leak

This commit fixes the hang seen sometimes while doing the state
sync. The cause of the hang was a rare combination of events:
request state data from peer, peer drops and reconnects almost
immediately. This caused a new download task to be assigned to
the peer, overwriting the old one still waiting for a timeout,
which in turned leaked the requests out, never to be retried.
The fix is to ensure that a task assignment moves any pending
one back into the retry queue.

The commit also fixes a regression with peer dropping due to
stalls. The current code considered a peer stalling if they
timed out delivering 1 item. However, the downloader never
requests only one, the minimum is 2 (attempt to fine tune
estimated latency/bandwidth). The fix is simply to drop if
a timeout is detected at 2 items.

Apart from the above bugfixes, the commit contains some code
polishes I made while debugging the hang.

* core, eth, trie: support batched trie sync db writes

* trie: rename SyncMemCache to syncMemBatch
2017-06-22 15:26:03 +03:00