Commit Graph

896 Commits

Author SHA1 Message Date
Jeffrey Wilcke 591b463b32 core: added small private test framework
For an example on how to create such a test run: `godep -hhtp=:6060 and
navigate to http://localhost:6060/pkg/github.com/ethereum/go-ethereum/core/#example_MakeCallHelper
2016-11-17 14:14:05 +01:00
Jeffrey Wilcke 1097bdb1b6 core, eth: Fixed creation if private addresses on public state
Whenever a private transaction was initiated and executed the address
would be created on the public state when initialising the initial Call.
To prevent this we use the msg's address rather than using the to method
on the state transition object.

Improved private transaction tests by checking existance of private and
public addresses on the incorrect state.
2016-11-17 13:22:58 +01:00
Jeffrey Wilcke fb5564a7de core: added private tx test, added PrivateMessage
PrivateMessage embeds Message and requires IsPrivate() bool to be
defined on the implementation.
2016-11-17 12:15:04 +01:00
Jeffrey Wilcke 410edf0b1a core: set correct public state for all state transition functions
Fixed an issue where public state and private state were mixed during
the initial phase of the state transition. This causes severe issues
when creating new contracts (and addresses) and messes up the public
nonce, which, indirectly, has an effect on the contracts that are
created on the public state for both public and private txs.
2016-11-17 00:05:44 +01:00
Patrick Mylund Nielsen 23201564ff Merge pull request #7 from jpmorganchase/incrementignored
Increment sender nonce even if we are ignoring a private transaction
2016-11-16 13:08:39 -05:00
Patrick Mylund Nielsen 46d00bf639 Return zero gas usage on private transactions whether or not you're party to the transaction 2016-11-16 13:03:42 -05:00
Patrick Mylund Nielsen 497ab68ce0 Increment sender nonce even if we are ignoring a private transaction 2016-11-16 12:57:41 -05:00
Bas van Kervel c371524cbb eth: look in private an public state on reading state data 2016-11-16 18:51:06 +01:00
Jeffrey Wilcke 6d75c3b1c0 core/quorum, core: add private transaction state processing 2016-11-16 15:53:42 +01:00
Bas van Kervel 9bb4635f70 cmd,eth enforce gas price of 0 2016-11-15 18:40:08 +01:00
Patrick Mylund Nielsen 3c536c7db7 Remove whitespace in state_transition.go 2016-11-14 00:34:50 -05:00
Patrick Mylund Nielsen 13eb8db520 Add temporary PrivateTransactionManager integration 2016-11-14 00:33:56 -05:00
bas-vk 70a49efaf6 Merge pull request #14 from bas-vk/votetxpriority
core/types,core/quorum: give vote transactions priority
2016-11-09 16:04:58 +01:00
Bas van Kervel 2a133748cb core/types,core/quorum: give vote transactions priority 2016-11-09 16:04:29 +01:00
Jeffrey Wilcke 9a13f094e5 Merge pull request #10 from bas-vk/callvmenv
core,eth: support calling public accounts
2016-11-09 15:33:17 +01:00
Bas van Kervel 936e7473bb quorum: Add README and example files 2016-11-03 15:59:33 +01:00
Bas van Kervel d3a871c2f4 core,eth: support calling public accounts 2016-11-03 09:51:01 +01:00
Jeffrey Wilcke 9392153a75 Merge pull request #5 from obscuren/private-tx
core, core/types: implemented private transaction check
2016-11-02 16:35:18 +01:00
Jeffrey Wilcke 1ad23deb8e core, core/types: implemented private transaction check
Transactions are considered private when the V param is either 37 or 38.
2016-11-01 22:25:59 +01:00
Bas van Kervel fb486961d6 core, eth: add support for storage root retrieval for accounts 2016-11-01 17:33:56 +01:00
Jeffrey Wilcke e7815c59f0 core: identify private transactions 2016-11-01 12:57:26 +01:00
Jeffrey Wilcke 763f939f47 core, core/vm: dual state & read only EVM
This commit implements a dual state approach. The dual state approach
separates public and private state by making the core vm environment
context aware.

Although not currently implemented it will need to prohibit value
transfers and it must initialise all transactions from accounts on the
public state. This means that sending transactions increments the
account nonce on the public state and contract addresses are derived
from the public state when initialised by a transaction. For obvious
reasons, contract created by private contracts are still derived from
public state.

This is required in order to have consensus over the public state at all
times as non-private participants would still process the transaction on
the public state even though private payload can not be decrypted. This
means that participants of a private group must do the same in order to
have public consensus. However the creation of the contract and
interaction still occurs on the private state.

It implements support for the following calling model:

S: sender, (X): private, X: public, ->: direction, [ ]: read only mode

1. S -> A -> B
2. S -> (A) -> (B)
3. S -> (A) -> [ B -> C ]

It does not support

1. (S) -> A
2. (S) -> (A)
3. S -> (A) -> B

Implemented "read only" mode for the EVM. Read only mode is checked
during any opcode that could potentially modify the state. If such an
opcode is encountered during "read only", it throws an exception.

The EVM is flagged "read only" when a private contract calls in to
public state.
2016-11-01 12:57:26 +01:00
Bas van Kervel f7cb85824c quorum integration 2016-10-30 09:20:48 +01:00
Péter Szilágyi f0dbec0c93
cmd, params: only set default fork configs for test and mainnet 2016-10-29 17:07:07 +03:00
Péter Szilágyi 8639b0fae9
cmd/utils, core, params: explicitly pick reprice fork for fast sync 2016-10-29 12:10:00 +03:00
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