Commit Graph

105 Commits

Author SHA1 Message Date
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
Felix Lange
87670a7ac1 all: remove weird files 2016-10-30 11:02:34 +01:00
Nick Johnson
00665a0b72 cmd/evm: Allow stdin and files as sources of bytecode (#3172)
* cmd/evm: Allow stdin and files as sources of bytecode

* cmd/evm: Print and exit instead of panicing

* cmd/evm: fix compile and vet errors
2016-10-29 12:07:38 +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
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
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
Felix Lange
6b727c0440 cmd/evm, cmd/geth, cmd/utils: move version handling to cmd/utils 2016-09-05 13:24:11 +02: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
Péter Szilágyi
6362a9d610 Revert "test, cmd/evm, core, core/vm: illegal code hash implementation"
This reverts commit 7a5b571c67.
2016-06-29 11:44:51 +03:00
Jeffrey Wilcke
7a5b571c67 test, cmd/evm, core, core/vm: illegal code hash implementation
This implements a generic approach to enabling soft forks by allowing
anyone to put in hashes of contracts that should not be interacted from.
This will help "The DAO" in their endevour to stop any whithdrawals from
any DAO contract by convincing the mining community to accept their code
hash.
2016-06-22 11:38:25 +03:00
Jeffrey Wilcke
e5165aeb27 cmd/evm: added --create flag indicating the exec code is to be created
This fixes an issue if you wanted to test out code deployment rather
than running a piece of code with an argument. This solves it by adding
a --create flag that indicates the Create function should be used rather
than the Call function.

This also adds a statedb.commit call so that the proper state can be
dumped when requested using the --dump flag.
2016-06-14 17:11:33 +02:00
Péter Szilágyi
90e07b19ab cmd: fix CLI package deprecation warnings 2016-06-10 11:23:00 +03:00
Bas van Kervel
861add3d72 cmd/geth: codegansta/cli package renamed to urfave/cli 2016-06-09 15:37:13 +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
Jeffrey Wilcke
342ae7ce7d core, core/vm, tests: changed the initialisation behaviour of the EVM
The EVM was previously initialised and created for every CALL, CALLCODE,
DELEGATECALL and CREATE. This PR changes this behaviour so that the same
EVM can be used through the session and beyond as long as the
Environment sticks around.
2016-03-23 00:04:00 +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
Gustav Simonsson
1b1f293082 core/state, core, miner: handle missing root error from state.New 2015-10-16 02:22:06 +02:00
Gustav Simonsson
e1616f77c7 core, core/vm, cmd/evm: remove redundant balance check 2015-10-06 12:42: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
Gustav Simonsson
7324176f70 Add tests for uncle timestamps and refactor timestamp type 2015-08-25 04:46:11 +02:00
Jeffrey Wilcke
9cacec70f9 cmd/evm, core/vm, tests: changed DisableVm to EnableVm 2015-08-11 18:43:22 +02:00
Jeffrey Wilcke
184e9ae9a8 core, tests: reduced state copy by N calls
Reduced the amount of state copied that are required by N calls by doing
a balance check prior to any state modifications.
2015-08-07 12:52:23 +02:00
Jeffrey Wilcke
846f34f78b core/vm, tests: implemented semi-jit vm
* changed stack and removed stack ptr. Let go decide on slice reuse.
2015-08-07 12:52:17 +02:00
Jeffrey Wilcke
8fc9830971 cmd/core,xeth: removed unneeded states & added batch writes 2015-07-23 10:45:31 +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
bdae4fd573 all: add some godoc synopsis comments 2015-07-07 14:12:45 +02:00
Felix Lange
e813626ee1 all: remove @author comments 2015-07-07 14:12:44 +02:00
Felix Lange
ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Gustav Simonsson
4c490db6af Use uint64 for block header timestamp 2015-06-30 10:52:11 +02:00
obscuren
5cfae0536f cmd/evm: print trace when running programs 2015-06-10 21:09:12 +02:00
obscuren
f249ccaa89 cmd/evm: implements vm.Environment 2015-06-10 16:46:43 +02:00
obscuren
a7750c929b Fixed tests to reflect log changes 2015-04-08 20:45:39 +02:00
obscuren
f468364e4d fixed tests 2015-04-01 11:42:02 +02:00
obscuren
9de1ad6546 fixed tests 2015-03-24 15:27:05 +01:00
obscuren
0330077d76 moved state and vm to core 2015-03-23 16:59:09 +01:00
obscuren
13781b922a converted to proper types 2015-03-22 12:12:29 +01:00
obscuren
b523441361 Moved ethutil => common 2015-03-16 11:27:38 +01:00
Felix Lange
80985f97da cmd/evm, core, ethdb, state, tests/helper: remove ReadConfig calls 2015-03-10 02:39:53 +01:00
obscuren
ae45a39dc1 Secure trie 2015-02-28 20:52:29 +01:00
obscuren
57f95c1dc7 fixed test 2015-02-04 17:35:49 -08:00
obscuren
fed3e6a808 Refactored ethutil.Config.Db out 2015-01-07 13:17:48 +01:00
Felix Lange
be97785856 cmd/evm: add dummy implementation for GetHash
Fixes the build. AFAIK evm does not bother keeping a chain and
cannot provide a real implementation.
2015-01-06 12:23:37 +01:00
obscuren
117f66e823 Added license headers 2015-01-06 12:13:57 +01:00
obscuren
4dc7ee9087 Closure => Context 2015-01-02 16:14:12 +01:00
obscuren
1085960ed8 fixed trie 2014-12-30 15:58:40 +01:00
obscuren
795b14330a Fixed EVM environment. Closes #215 2014-12-21 15:13:06 +01:00
obscuren
1fb84d3c5f Fixed tests 2014-12-10 10:57:19 +01:00
obscuren
3043b233ea Log is now interface 2014-12-04 12:35:23 +01:00
obscuren
bff5999efa sort tests for evm 2014-12-04 12:09:22 +01:00
obscuren
3664cd58e3 Updated testing tools 2014-12-04 11:30:41 +01:00
obscuren
6c9e503eb8 Removed all implicit logging. Fixed gas issues and jump errors 2014-11-11 22:52:27 +01:00
obscuren
ad0acb5762 Moved messages eventing to chain manager 2014-11-10 13:27:24 +01:00
obscuren
ebb7db263f Added dumps 2014-11-10 12:42:16 +01:00
obscuren
d30571a7a8 Added VM testing tool 2014-11-10 11:47:37 +01:00