Commit Graph

80 Commits

Author SHA1 Message Date
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 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
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
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
zsfelfoldi 00787fe781 core: added CheckNonce() to Message interface 2016-07-11 12:35:23 +02:00
Jeffrey Wilcke 1f3596c25a core: transition db now also returns the required gas amount
Exposes some core methods to transition and compute new state
information and adds an additional return value to the transition db
method to fetch required gas for that particular message (excluding gas
refunds from any SSTORE[X] = 0 and SUICIDE.

Fixes #2395
2016-04-01 01:01:10 +02:00
Jeffrey Wilcke f0cbebb19f core: added basic chain configuration
Added chain configuration options and write out during genesis database
insertion. If no "config" was found, nothing is written to the database.

Configurations are written on a per genesis base. This means
that any chain (which is identified by it's genesis hash) can have their
own chain settings.
2016-04-01 01:01:10 +02:00
Jeffrey Wilcke 14013372ae core: Added EVM configuration options
The EVM is now initialised with an additional configured object that
allows you to turn on debugging options.
2016-03-23 23:02:42 +01:00
Péter Szilágyi f30b809f00 Merge pull request #2215 from bas-vk/estimategas
core: improved check for contract creation
2016-03-01 10:59:12 +02:00
Jeffrey Wilcke b6d88a0e9f core, core/vm, crypto: fixes for homestead
* Removed some strange code that didn't apply state reverting properly
* Refactored code setting from vm & state transition to the executioner
* Updated tests
2016-02-18 10:11:48 +01:00
Gustav Simonsson 371871d685 parmas, crypto, core, core/vm: homestead consensus protocol changes
* change gas cost for contract creating txs
* invalidate signature with s value greater than secp256k1 N / 2
* OOG contract creation if not enough gas to store code
* new difficulty adjustment algorithm
* new DELEGATECALL op code
2016-02-18 10:08:11 +01:00
Bas van Kervel 0ff2adb21b core: improved check for contract creation 2016-02-16 10:52:46 +01:00
Felix Lange de8d5aaa92 core, core/state: move gas tracking out of core/state
The amount of gas available for tx execution was tracked in the
StateObject representing the coinbase account. This commit makes the gas
counter a separate type in package core, which avoids unintended
consequences of intertwining the counter with state logic.
2015-10-17 10:24:34 +02:00
Jeffrey Wilcke 361082ec4b cmd/evm, core/vm, test: refactored VM and core
* Moved `vm.Transfer` to `core` package and changed execution to call
`env.Transfer` instead of `core.Transfer` directly.
* core/vm: byte code VM moved to jump table instead of switch
* Moved `vm.Transfer` to `core` package and changed execution to call
  `env.Transfer` instead of `core.Transfer` directly.
* Byte code VM now shares the same code as the JITVM
* Renamed Context to Contract
* Changed initialiser of state transition & unexported methods
* Removed the Execution object and refactor `Call`, `CallCode` &
  `Create` in to their own functions instead of being methods.
* Removed the hard dep on the state for the VM. The VM now
  depends on a Database interface returned by the environment. In the
  process the core now depends less on the statedb by usage of the env
* Moved `Log` from package `core/state` to package `core/vm`.
2015-10-04 01:13:54 +02:00
Felix Lange 00b45acb9e core: improve block gas tracking 2015-09-01 23:11:03 +02:00
Felix Lange bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange 3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Jeffrey Wilcke e6bb9c1cad core, miner: removed vm errors from consensus err checking
Removed VM errors from the consensus errors. They now used for output
only.
2015-07-06 12:43:05 +02:00
Gustav Simonsson 0f04af5916 Fix core error forwarding, unify OOG VM err 2015-07-04 09:27:42 +02:00
Jeffrey Wilcke 529fb7a7d7 core, xeth: core.AddressFromMessage removed => crypto.CreateAddress 2015-07-02 11:19:10 +02:00
Felix Lange fccc7d71eb core: remove superfluous big.Int allocations
With blocks now being immutable, use big.Int values from
accessor functions instead of copying their results.
2015-06-29 18:51:48 +02:00
Felix Lange 992dc74efd core: avoid duplicate calls to Transaction.Data 2015-06-29 18:51:48 +02:00
Felix Lange 0b22ad99c1 core: optimize IntrinsicGas 2015-06-29 18:51:48 +02:00
Felix Lange 1d42888d30 core/types: make blocks immutable 2015-06-29 18:51:47 +02:00
obscuren 07c3de3f75 core, miner, xeth: renamed gas methods
* BuyGas => SubGas
* RefundGas => AddGas
* SetGasPool => SetGasLimit
2015-06-21 17:09:19 +02:00
obscuren 5721fcf668 core/state, core/vm: cleanup refunds 2015-06-17 10:20:33 +02:00
obscuren 10af69b57c core, core/vm: moved logger and added gas cost to struct logging 2015-06-10 19:56:40 +02:00
obscuren 38c61f6f25 core, core/vm: added structure logging
This also reduces the time required spend in the VM
2015-06-10 12:23:49 +02:00
Gustav Simonsson 147a699c65 Add missing err checks on From() (skip RPC for now) 2015-06-01 22:12:03 +02:00
Gustav Simonsson 32276e8b01 Update StateTests and nil create return on failed code deposit 2015-05-15 18:49:31 +02:00
obscuren 6184781b49 Improved transaction pool
The transaction pool will now some easily be able to pre determine the
validity of a transaction by checking the following:

* Account existst
* gas limit higher than the instrinsic gas
* enough funds to pay upfront costs
* nonce check
2015-04-08 20:47:32 +02:00
obscuren 1889727144 Moved logging to logger.Core 2015-04-04 13:24:01 +02:00
Gustav Simonsson c26c8d3a44 Read most protocol params from common/params.json
* Add params package with exported variables generated from
  github.com/ethereum/common/blob/master/params.json
* Use params package variables in applicable places
* Add check for minimum gas limit in validation of block's gas limit
* Remove common/params.json from go-ethereum to avoid
  outdated version of it
2015-04-02 06:22:32 +02:00
obscuren 0a554a1f27 Blocktest fixed, Execution fixed
* Added new CreateAccount method which properly overwrites previous
  accounts (excluding balance)
* Fixed block tests (100% success)
2015-04-01 10:53:32 +02:00
obscuren ff9d66e096 Cleaned up changes 2015-03-24 15:23:16 +01:00
obscuren 23bccbbc58 Modified according to poc 9 changes
* Refund of value
2015-03-24 15:15:17 +01:00
obscuren 576df064e5 Updated for PV59
* Value XFER are refunded back to the sender if the execution fails
2015-03-24 11:49:30 +01:00
obscuren 0330077d76 moved state and vm to core 2015-03-23 16:59:09 +01:00
obscuren 0a1eeca41e conversions. -compilable- 2015-03-18 13:00:01 +01:00
obscuren 0fa7859b94 Fixed VM & Tests w/ conversion 2015-03-17 13:24:25 +01:00
Felix Lange 17c5ba2b6b core: actually convert transaction pool 2015-03-17 12:16:21 +01:00
Felix Lange ee7202fa00 Merge remote-tracking branch 'ethereum/conversion' into conversion 2015-03-17 12:01:40 +01:00
Felix Lange 27f7aa0163 core: adapt Message for new Transaction.From signature 2015-03-17 12:00:29 +01:00
obscuren 515d9432fc converted vm 2015-03-17 11:19:23 +01:00
obscuren 94505146a2 updated vm env 2015-03-16 23:17:28 +01:00