Commit Graph

94 Commits

Author SHA1 Message Date
Nick Johnson 72ed186f46 eth, internal: Implement getModifiedAccountsBy(Hash|Number) using trie diffs (#15512)
* eth, internal: Implement  using trie diffs

* eth, internal: Changes in response to review

* eth: More fixes to getModifiedAccountsBy*

* eth: minor polishes on error capitalization
2017-11-20 17:18:50 +02:00
rjl493456442 94903d572b
internal, accounts, eth: utilize vm failed flag to help gas estimation 2017-10-02 15:26:40 +03:00
Ernesto del Toro 3c8656347f eth, internal/ethapi: fix spelling of 'Ethereum' (#15164) 2017-09-20 11:31:31 +02:00
Felix Lange 10181b57a9 core, eth/downloader: commit block data using batches (#15115)
* ethdb: add Putter interface and Has method

* ethdb: improve docs and add IdealBatchSize

* ethdb: remove memory batch lock

Batches are not safe for concurrent use.

* core: use ethdb.Putter for Write* functions

This covers the easy cases.

* core/state: simplify StateSync

* trie: optimize local node check

* ethdb: add ValueSize to Batch

* core: optimize HasHeader check

This avoids one random database read get the block number. For many uses
of HasHeader, the expectation is that it's actually there. Using Has
avoids a load + decode of the value.

* core: write fast sync block data in batches

Collect writes into batches up to the ideal size instead of issuing many
small, concurrent writes.

* eth/downloader: commit larger state batches

Collect nodes into a batch up to the ideal size instead of committing
whenever a node is received.

* core: optimize HasBlock check

This avoids a random database read to get the number.

* core: use numberCache in HasHeader

numberCache has higher capacity, increasing the odds of finding the
header without a database lookup.

* core: write imported block data using a batch

Restore batch writes of state and add blocks, tx entries, receipts to
the same batch. The change also simplifies the miner.

This commit also removes posting of logs when a forked block is imported.

* core: fix DB write error handling

* ethdb: use RLock for Has

* core: fix HasBlock comment
2017-09-09 19:03:07 +03:00
rjl493456442 28aea46ac0
core: implement Metropolis EIP 658, receipt status byte 2017-08-22 18:35:17 +03:00
Egon Elbre 8f06b7980d eth: fix megacheck warnings 2017-08-07 19:54:20 +03: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 c2a494c743
eth: update default gas price when not mining too 2017-05-29 10:21:34 +03:00
Péter Szilágyi a2f23ca9b1 cmd, core, eth, miner: remove txpool gas price limits (#14442) 2017-05-16 21:07:27 +02:00
Felix Lange 207bd7d2cd eth: add debug_storageRangeAt 2017-04-25 02:14:32 +02:00
Péter Szilágyi a7b9e484d0 consensus, core, ethstats: use engine specific block beneficiary (#14318)
* consensus, core, ethstats: use engine specific block beneficiary

* core, eth, les, miner: use explicit beneficiary during mining
2017-04-12 16:38:31 +03:00
Péter Szilágyi bfe5eb7f8c eth: accept transactions when starting CPU mining (#13882) 2017-04-10 10:43:01 +02:00
Péter Szilágyi b801be99d4
consensus, eth: don't CPU mine by default during remote mining 2017-04-07 17:22:06 +03:00
Martin Holst Swende cc303017c3 debug: convert uint64-blocknumber into rpc.Blocknumber (#13862)
* debug: Converted uint64-blocknumber into rpc.Blocknumber

* api/debug: Fix pending block issues in DumpBlock
2017-04-05 17:49:54 +02:00
Péter Szilágyi 09777952ee core, consensus: pluggable consensus engines (#3817)
This commit adds pluggable consensus engines to go-ethereum. In short, it
introduces a generic consensus interface, and refactors the entire codebase to
use this interface.
2017-04-05 00:16:29 +02:00
Felix Lange c213fd1fd8 all: import "context" instead of "golang.org/x/net/context"
There is no need to depend on the old context package now that the
minimum Go version is 1.7. The move to "context" eliminates our weird
vendoring setup. Some vendored code still uses golang.org/x/net/context
and it is now vendored in the normal way.

This change triggered new vet checks around context.WithTimeout which
didn't fire with golang.org/x/net/context.
2017-03-22 20:49:15 +01:00
Péter Szilágyi b7d93500f1 all: finish integrating Go ethash, delete C++ vendor 2017-03-09 15:50:14 +01:00
Péter Szilágyi 9184249b39 Logger updates 3 (#3730)
* accounts, cmd, eth, ethdb: port logs over to new system

* ethdb: drop concept of cache distribution between dbs

* eth: fix some log nitpicks to make them nicer
2017-03-02 14:06:16 +01:00
Péter Szilágyi d4fd06c3dc
all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
Martin Holst Swende 72dcd3c58b core, eth, internal: Added `debug_getBadBlocks()` method (#3654)
* core,eth,internal: Added `debug_getBadBlocks()` method

When bad blocks are discovered, these are stored within geth.
An RPC-endpoint makes them availablewithin the `debug`
namespace. This feature makes it easier to discover network forks.

```

* core, api: go format + docs

* core/blockchain: Documentation, fix minor nitpick

* core: fix failing blockchain test
2017-02-13 21:44:06 +01:00
Nick Johnson 17d92233d9 cmd/geth, core: add support for recording SHA3 preimages (#3543) 2017-01-17 12:19:50 +01:00
Felix Lange c5df37c111 eth: accept leading zeros for nonce parameter of submitWork (#3558) 2017-01-13 00:37:23 +01:00
Péter Szilágyi 18c77744ff
all: fix spelling errors 2017-01-06 19:44:35 +02:00
Jeffrey Wilcke bbc4ea4ae8 core/vm: improved EVM run loop & instruction calling (#3378)
The run loop, which previously contained custom opcode executes have been
removed and has been simplified to a few checks.

Each operation consists of 4 elements: execution function, gas cost function,
stack validation function and memory size function. The execution function
implements the operation's runtime behaviour, the gas cost function implements
the operation gas costs function and greatly depends on the memory and stack,
the stack validation function validates the stack and makes sure that enough
items can be popped off and pushed on and the memory size function calculates
the memory required for the operation and returns it.

This commit also allows the EVM to go unmetered. This is helpful for offline
operations such as contract calls.
2017-01-05 11:52:10 +01:00
Péter Szilágyi 89a32267f7
eth: fix miner start API to accept int, not hexint 2016-12-23 11:28:11 +02:00
Felix Lange cf71f5cd60 rpc: remove HexNumber, replace all uses with hexutil types
This change couldn't be automated because HexNumber was used for numbers
of all sizes.
2016-12-20 14:41:58 +01:00
Péter Szilágyi 0ee796632a eth, miner: verify PoW in the remote agent to notify submitter (#3438) 2016-12-20 02:14:36 +01:00
Nick Johnson 9ba9fe818d cmd/utils, eth: Add gzip support for chain dump and restore 2016-12-14 08:59:55 +00:00
Jeffrey Wilcke 3fc7c97827 core, core/vm: implemented a generic environment (#3348)
Environment is now a struct (not an interface). This
reduces a lot of tech-debt throughout the codebase where a virtual
machine environment had to be implemented in order to test or run it.

The new environment is suitable to be used en the json tests, core
consensus and light client.
2016-12-06 02:16:03 +01:00
Jeffrey Wilcke 4dca5d4db7 core/types, params: EIP#155 2016-11-13 14:55:30 +01:00
Jeffrey Wilcke 445feaeef5 core, core/state, trie: EIP158, reprice & skip empty account write
This commit implements EIP158 part 1, 2, 3 & 4

1. If an account is empty it's no longer written to the trie. An empty
  account is defined as (balance=0, nonce=0, storage=0, code=0).
2. Delete an empty account if it's touched
3. An empty account is redefined as either non-existent or empty.
4. Zero value calls and zero value suicides no longer consume the 25k
  reation costs.

params: moved core/config to params

Signed-off-by: Jeffrey Wilcke <jeffrey@ethereum.org>
2016-11-13 10:44:04 +01:00
Péter Szilágyi 289b30715d Godeps, vendor: convert dependency management to trash (#3198)
This commit converts the dependency management from Godeps to the vendor
folder, also switching the tool from godep to trash. Since the upstream tool
lacks a few features proposed via a few PRs, until those PRs are merged in
(if), use github.com/karalabe/trash.

You can update dependencies via trash --update.

All dependencies have been updated to their latest version.

Parts of the build system are reworked to drop old notions of Godeps and
invocation of the go vet command so that it doesn't run against the vendor
folder, as that will just blow up during vetting.

The conversion drops OpenCL (and hence GPU mining support) from ethash and our
codebase. The short reasoning is that there's noone to maintain and having
opencl libs in our deps messes up builds as go install ./... tries to build
them, failing with unsatisfied link errors for the C OpenCL deps.

golang.org/x/net/context is not vendored in. We expect it to be fetched by the
user (i.e. using go get). To keep ci.go builds reproducible the package is
"vendored" in build/_vendor.
2016-10-28 19:05:01 +02:00
Péter Szilágyi 710435b51b core, eth, trie: reuse trie journals in all our code 2016-09-28 11:27:31 +03:00
Felix Lange a59a93f476 core/state: track all accounts in canon state
This change introduces a global, per-state cache that keeps account data
in the canon state. Thanks to @karalabe for lots of fixes.
2016-09-26 10:09:52 +02:00
Nick Johnson 2f99720901 core/vm, eth: Add support for javascript trace functions 2016-08-23 15:06:39 +01:00
Nick Johnson 781915f183 core/vm: Refactor tracing to make Tracer the main interface
This CL makes several refactors:
 - Define a Tracer interface, implementing the `CaptureState` method
 - Add the VM environment as the first argument of
   `Tracer.CaptureState`
 - Rename existing functionality `StructLogger` an make it an
   implementation of `Tracer`
 - Delete `StructLogCollector` and make `StructLogger` collect the logs
   directly
 - Change all callers to use the new `StructLogger` where necessary and
   extract logs from that.
 - Deletes the apparently obsolete and likely nonfunctional 'TraceCall'
   from the eth API.

Callers that only wish accumulated logs can use the `StructLogger`
implementation straightforwardly. Callers that wish to efficiently
capture VM traces and operate on them without excessive copying can now
implement the `Tracer` interface to receive VM state at each step and
do with it as they wish.

This CL also removes the accumulation of logs from the vm.Environment;
this was necessary as part of the refactor, but also simplifies it by
removing a responsibility that doesn't directly belong to the
Environment.
2016-08-22 09:26:15 +01:00
zsfelfoldi 00787fe781 core: added CheckNonce() to Message interface 2016-07-11 12:35:23 +02:00
Péter Szilágyi 96dc42d99c cmd, common, console, eth, release: drop redundant "full"s 2016-06-30 13:03:26 +03:00
Péter Szilágyi 1e50f5dd28 Merge pull request #2159 from zsfelfoldi/light-backend
eth: separate common and full node-specific API and backend service
2016-06-30 12:57:50 +03:00
zsfelfoldi 3a97280ae8 eth: separate common and full node-specific API and backend service 2016-06-16 17:36:38 +02:00
Péter Szilágyi 22ef7370e7 Merge pull request #2686 from obscuren/issue-2542
core/state, eth: Updated suicides objects when tracing transactions
2016-06-14 16:54:46 +03:00
Jeffrey Wilcke bb3651abc8 core/state, eth: Updated suicides objects when tracing transactions
Consensus rules dictate that objects can only be removed during the
finalisation of the transaction (i.e. after all calls have finished).
Thus calling a suicided contract twice from the same transaction:
A->B(S)->ret(A)->B(S) results in 2 suicides. Calling the suicided
object twice from two transactions: A->B(S), A->B, results in only one
suicide and a call to an empty object.

Our current debug tracing functionality replays all transaction that
were executed prior to the targetted transaction in order to provide
the user with an accurate trace.

As a side effect to calling StateDB.IntermediateRoot it also deletes any
suicides objects. Our tracing code never calls this function because it
isn't interested in the intermediate root. Becasue of this it caused a
bug in the tracing code where transactions that were send to priviously
deleted objects resulted in two suicides rather than one suicide and a
call to an empty object.

Fixes #2542
2016-06-13 11:57:42 +02:00
zsfelfoldi f9917c8c7b core: improved chainDb using sequential keys 2016-06-07 16:38:56 +02:00
Rémy Roy f86ea9aad5 eth/api: fixed GetCompilers when there is no error creating Solc 2016-05-24 16:44:33 -04:00
Jeffrey Wilcke 7f515b0e88 Merge pull request #2564 from bas-vk/submit-tx
eth: add new RPC method (personal.) SignAndSendTransaction
2016-05-23 14:17:46 +02:00
Bas van Kervel 64a6c2c1b6 eth: add new RPC method (personal.) SignAndSendTransaction 2016-05-20 15:54:18 +02:00
Péter Szilágyi 1580ec1804 accounts/abi/bind, eth: rely on getCode for sanity checks, not estimate and call 2016-05-20 12:29:28 +03:00
Jeffrey Wilcke 4b1a7d3868 eth: fixed regression in eth_signTransaction fixes #2578
Sign transaction returned the unsigned transaction rather than the
signed one.
2016-05-18 17:25:34 +02:00
Jeffrey Wilcke 7d59c5c58d eth: fixed tracing functions using the current header instead of parent
Fixes #2525
2016-05-09 10:24:31 +02:00
Péter Szilágyi 586eddfd09 release, all: integrate the release service into geth 2016-05-02 16:20:21 +03:00