Commit Graph

871 Commits

Author SHA1 Message Date
bas-vk
b59c8399fb internal/ethapi: add personal_sign and fix eth_sign to hash message (#2940)
This commit includes several API changes:

- The behavior of eth_sign is changed. It now accepts an arbitrary
  message, prepends the well-known string

        \x19Ethereum Signed Message:\n<length of message>

  hashes the result using keccak256 and calculates the signature of
  the hash. This breaks backwards compatability!
  
- personal_sign(hash, address [, password]) is added. It has the same
  semantics as eth_sign but also accepts a password. The private key
  used to sign the hash is temporarily unlocked in the scope of the
  request.
  
- personal_recover(message, signature) is added and returns the
  address for the account that created a signature.
2016-10-28 21:25:49 +02:00
Hao Bryan Cheng
89014b4524 core/vm: Ignore EnableJit ChainConfig setting (#3166) 2016-10-21 17:35:03 +02:00
Péter Szilágyi
1291778032
cmd/geth, code, eth/downloader: tune import logs and mem stats 2016-10-21 12:23:39 +03:00
Péter Szilágyi
88a593d559
cmd/geth, trie: report on trie cache unloads, also add debug log 2016-10-19 17:31:19 +03:00
Péter Szilágyi
4f46bd19d0
cmd, core/state: allow configurable trie cache generations 2016-10-19 14:55:13 +03:00
Jeffrey Wilcke
ca49510e6d Merge pull request #3168 from benjaminbrent/develop
core/vm: fix GASPRICE string (resolves #2553)
2016-10-19 13:36:13 +02:00
Jeffrey Wilcke
25ac04a444 Merge pull request #3153 from fjl/trie-unload-fix
trie: improve cache unloading mechanism
2016-10-19 13:35:49 +02:00
Benjamin Brent
55522373fd core/vm: fix GASPRICE string (resolves #2553) 2016-10-19 15:55:34 +11:00
Jeffrey Wilcke
5b262ff5ab Merge pull request #3156 from holiman/metrics-blocks
core: Add block processing time metric collection
2016-10-18 13:26:31 +02:00
Péter Szilágyi
64500ab0fa
common, core, eth/downloader: adjust import log formatting 2016-10-18 13:16:36 +03:00
Martin Holst Swende
00b853418e core: Add block processing time metric collection 2016-10-18 09:29:50 +02:00
Felix Lange
44f419ec0f core/state: bump trie cache values slightly 2016-10-18 04:57:47 +02:00
Péter Szilágyi
81b01f1c2b Merge pull request #3111 from obscuren/gas-price-fork
core, core/vm: added gas price variance table (EIP #150)
2016-10-14 19:32:11 +03:00
Péter Szilágyi
a4d9e63d12 Merge pull request #3138 from karalabe/txpool-pending-limits
core: add global (soft) limits on the pending transactions
2016-10-14 19:10:55 +03:00
Jeffrey Wilcke
64af2aafda core, core/vm: added gas price variance table
This implements 1b & 1c of EIP150 by adding a new GasTable which must be
returned from the RuleSet config method. This table is used to determine
the gas prices for the current epoch.

Please note that when the CreateBySuicide gas price is set it is assumed
that we're in the new epoch phase.

In addition this PR will serve as temporary basis while refactorisation
in being done in the EVM64 PR, which will substentially overhaul the gas
price code.
2016-10-14 18:09:17 +02:00
Felix Lange
40cdcf1183 trie, core/state: improve memory usage and performance (#3135)
* trie: store nodes as pointers

This avoids memory copies when unwrapping node interface values.

name      old time/op  new time/op  delta
Get        388ns ± 8%   215ns ± 2%  -44.56%  (p=0.000 n=15+15)
GetDB      363ns ± 3%   202ns ± 2%  -44.21%  (p=0.000 n=15+15)
UpdateBE  1.57µs ± 2%  1.29µs ± 3%  -17.80%  (p=0.000 n=13+15)
UpdateLE  1.92µs ± 2%  1.61µs ± 2%  -16.25%  (p=0.000 n=14+14)
HashBE    2.16µs ± 6%  2.18µs ± 6%     ~     (p=0.436 n=15+15)
HashLE    7.43µs ± 3%  7.21µs ± 3%   -2.96%  (p=0.000 n=15+13)

* trie: close temporary databases in GetDB benchmark

* trie: don't keep []byte from DB load around

Nodes decoded from a DB load kept hashes and values as sub-slices of
the DB value. This can be a problem because loading from leveldb often
returns []byte with a cap that's larger than necessary, increasing
memory usage.

* trie: unload old cached nodes

* trie, core/state: use cache unloading for account trie

* trie: use explicit private flags (fixes Go 1.5 reflection issue).

* trie: fixup cachegen overflow at request of nick

* core/state: rename journal size constant
2016-10-14 19:04:33 +03:00
Péter Szilágyi
182d9cb752 core: add global (soft) limits on the pending transactions 2016-10-14 15:57:58 +03:00
Jeffrey Wilcke
ca419f3cd8 core: fixed import reporter 2016-10-11 00:16:08 +02:00
Felix Lange
be6a3696a9 Merge pull request #3104 from fjl/core-import-log
core: print import stats more often
2016-10-10 20:38:27 +02:00
Felix Lange
16d8397e30 core: lower transaction pool max queue limit 2016-10-10 15:32:06 +02:00
Felix Lange
e66b158f0b core: print import stats more often
If geth is busy importing 2048 heavy blocks it can take a while before
it prints anything. This change ensures that a message gets printed
every 8s.
2016-10-07 21:03:38 +02:00
Felix Lange
c88e435724 Merge pull request #3088 from bas-vk/rpc-block-output
core/types: renamed receiptRoot to receiptsRoot
2016-10-06 18:32:27 +02:00
Felix Lange
eeb2a1a6e3 Merge pull request #3094 from fjl/tests-update
tests: update test files from github.com/ethereum/tests @ 45bc1d21d3c1
2016-10-06 16:19:53 +02:00
Felix Lange
1b7b2ba216 tests: update test files from github.com/ethereum/tests @ 45bc1d21d3c1
Two new tests are skipped because they're buggy. Making some newer
random state tests work required implementing the 'compressed return
value encoding'.
2016-10-06 15:36:21 +02:00
Felix Lange
3c836dd71b core/state: optimize GetState
There is no need to use the reflection-based decoder to decode []byte.
2016-10-06 15:32:17 +02:00
Felix Lange
90fce8bfa6 core/state: rename Delete/IsDeleted to Suicide/HasSuicided
The delete/remove naming has caused endless confusion in the past.
2016-10-06 15:32:17 +02:00
Felix Lange
1f1ea18b54 core/state: implement reverts by journaling all changes
This commit replaces the deep-copy based state revert mechanism with a
linear complexity journal. This commit also hides several internal
StateDB methods to limit the number of ways in which calling code can
use the journal incorrectly.

As usual consultation and bug fixes to the initial implementation were
provided by @karalabe, @obscuren and @Arachnid. Thank you!
2016-10-06 15:32:16 +02:00
Bas van Kervel
71e8ae01b8 core/types: renamed receiptRoot to receiptsRoot 2016-10-05 12:24:42 +02:00
Péter Szilágyi
b7159818f9 core/state: track dirty state entries for each object 2016-10-03 10:48:01 +03:00
Péter Szilágyi
cb84e3f029 cmd, core, internal, light, tests: avoid hashing the code in the VM 2016-10-01 16:01:58 +03: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
cd791bd855 core, trie: replace state caches with trie journal 2016-09-28 11:27:28 +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
Gustav Simonsson
25ed5fedda core/state: short-circuit balance change if zero value 2016-09-26 01:26:54 -04:00
Gustav Simonsson
b6b17e5648 core/state, light: remove unused StateObject.initCode 2016-09-19 02:16:58 -04:00
Péter Szilágyi
88b012ad3b Merge pull request #3006 from Arachnid/patch
core/state: Fix memory expansion bug by not copying clean objects
2016-09-19 04:20:14 +03:00
Nick Johnson
581b320b9d core/state: Fix memory expansion bug by not copying clean objects 2016-09-19 08:57:08 +08:00
Péter Szilágyi
b6b5ec8f75 core/types: add core type marshal methods too 2016-09-08 18:16:53 +03:00
Péter Szilágyi
b4a5251391 core: abstract out a sorted transaction hash map 2016-09-02 14:15:40 +03:00
Péter Szilágyi
a183ea29f9 core: add upper bound on the queued transctions 2016-09-02 14:15:40 +03:00
Péter Szilágyi
affffb39b3 core/types, miner: switch over to the grouped tx sets 2016-09-02 14:12:03 +03:00
Péter Szilágyi
0ef327bbee core, eth, internal, miner: optimize txpool for quick ops 2016-09-02 14:12:03 +03:00
Péter Szilágyi
795b70423e core, eth, miner: only retain 1 tx/nonce, remove bad ones 2016-09-02 14:12:03 +03:00
Felix Lange
704fde01e8 core/types, core/vm: improve docs, add JSON marshaling methods
In this commit, core/types's types learn how to encode and decode
themselves as JSON. The encoding is very similar to what the RPC API
uses. The RPC API is missing some output fields (e.g. transaction
signature values) which will be added to the API in a later commit. Some
fields that the API generates are ignored by the decoder methods here.
2016-08-04 03:55:33 +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
Felix Lange
475521dd74 Merge pull request #2909 from fjl/account-manager-cleanup
all: clean up tech debt left behind by the API split
2016-08-17 20:59:59 +02:00
Felix Lange
3c09c5f12d core, miner: move Backend to miner
This ensures that package core doesn't depend on package accounts and
resolves an age-old TODO.
2016-08-17 17:39:04 +02:00
Felix Lange
84d11c19fd eth: remove dapp database remains 2016-08-17 17:39:03 +02:00
Bas van Kervel
47ff813012 rpc: refactor subscriptions and filters 2016-08-17 12:59:58 +02:00