Commit Graph

49 Commits

Author SHA1 Message Date
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
Yoichi Hirai
86bc7795a3 vm: Replace some SstoreClearGas with SstoreResetGas 2016-06-21 21:15:26 +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
Leif Jurvetson
b7bb2d8589 core: various typos 2016-03-15 11:08:18 -07:00
Ricardo Catalinas Jiménez
436fc8d76a all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()
As we aren't really using the standarized SHA-3
2016-02-21 22:34:34 +00: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
Peter Pratscher
15780ead07 core/vm, rpc/api: renamed to debug.replayTransaction, migrated to new RPC, integrated feedback
Integrated code review suggestions

Integrated last review comments
2016-02-02 15:20:18 +01:00
Péter Szilágyi
752c75fb21 core/vm: resolve circular dependency to debug vm storage 2016-01-11 18:21:39 +02:00
Péter Szilágyi
af9afb686b core/vm: copy stack element to prevent overwrites 2015-10-12 00:14:35 +03: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
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
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
bdae4fd573 all: add some godoc synopsis comments 2015-07-07 14:12:45 +02:00
Felix Lange
ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Gustav Simonsson
0f04af5916 Fix core error forwarding, unify OOG VM err 2015-07-04 09:27:42 +02:00
Gustav Simonsson
4c490db6af Use uint64 for block header timestamp 2015-06-30 10:52:11 +02:00
obscuren
430bcdb219 core/vm: clarified SSTORE 2015-06-18 12:25:02 +02:00
obscuren
787a61bb27 core/state, core/vm: reworked storage get / set to use common.Hash 2015-06-17 11:24:40 +02:00
obscuren
5721fcf668 core/state, core/vm: cleanup refunds 2015-06-17 10:20:33 +02:00
obscuren
287f990891 core/vm: Improved error reporting for trace logging 2015-06-12 13:35:14 +02:00
obscuren
f599a1b5f1 core/vm: added a comment regarding the uint64 vs *big.Int 2015-06-11 11:59:30 +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
fc2a061d51 core/vm: unexported stack again. No longer required 2015-06-10 17:47:36 +02:00
obscuren
065aff9ffa core/vm: documentation and name changes 2015-06-10 17:47:36 +02:00
obscuren
6fb6e6679e core/vm, core/state: added storage to structured vm logging 2015-06-10 12:57:37 +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
obscuren
ff5b3ef087 core/vm: added structured logging 2015-06-10 10:59:44 +02:00
obscuren
468501cb86 core/vm: changed program counter to uint64 2015-06-10 10:44:46 +02:00
Felix Lange
48fb0c3213 core/vm: check for 'no code' before doing any work 2015-06-03 16:25:06 +02:00
Felix Lange
ea2718c946 core/vm: improve JUMPDEST analysis
* JUMPDEST analysis is faster because less type conversions are performed.
* The map of JUMPDEST locations is now created lazily at the first JUMP.
* The result of the analysis is kept around for recursive invocations
  through CALL/CALLCODE.

Fixes #1147
2015-06-03 16:25:05 +02:00
obscuren
b419e2631a core/vm: Cleanups & SUB output fix. Closes #1096 2015-05-26 12:42:33 +02:00
obscuren
f5af1fdca8 core/vm: RETURN op code returns pointer to memory rather than copy 2015-05-20 00:21:23 +02:00
obscuren
1c872ddf4b Changed how logs are being recorded
Logs are now recorded per transactions instead of tossing them out after
each transaction. This should also fix an issue with
`eth_getFilterLogs` (#629) Also now implemented are the `transactionHash,
blockHash, transactionIndex, logIndex` on logs. Closes #654.
2015-04-08 17:15:45 +02:00
obscuren
a0e44e3281 basic glog 2015-04-04 12:40:11 +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
368ebe63a9 Cleanup VM.
* CALLDATA use getData
* removed old context get range value
* removed casting big => int for some cases
* pc now big int #457
2015-03-28 20:30:38 +01:00
obscuren
3b7e4173ce Cleanup VM 2015-03-28 20:03:25 +01:00
obscuren
3ea8c7301e PUSH gas fix 2015-03-27 16:53:05 +01:00
obscuren
8a22cd5e6c Removed defer/panic. #503 2015-03-27 16:09:57 +01:00
obscuren
ff9d66e096 Cleaned up changes 2015-03-24 15:23:16 +01:00
obscuren
ebf4408d73 Decrement depth 2015-03-23 21:48:31 +01:00
obscuren
0330077d76 moved state and vm to core 2015-03-23 16:59:09 +01:00