Commit Graph

15 Commits

Author SHA1 Message Date
Jeffrey Wilcke bbc4ea4ae8 core/vm: improved EVM run loop & instruction calling (#3378)
The run loop, which previously contained custom opcode executes have been
removed and has been simplified to a few checks.

Each operation consists of 4 elements: execution function, gas cost function,
stack validation function and memory size function. The execution function
implements the operation's runtime behaviour, the gas cost function implements
the operation gas costs function and greatly depends on the memory and stack,
the stack validation function validates the stack and makes sure that enough
items can be popped off and pushed on and the memory size function calculates
the memory required for the operation and returns it.

This commit also allows the EVM to go unmetered. This is helpful for offline
operations such as contract calls.
2017-01-05 11:52:10 +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
Jeffrey Wilcke b196278044 core/vm: added JIT segmenting / optimisations
* multi-push segments
* static jumps segments
2015-10-16 22:30:42 +02:00
Jeffrey Wilcke ac697326a6 core/vm: reduced big int allocations
Reduced big int allocation by making stack items modifiable. Instead of
adding items such as `common.Big0` to the stack, `new(big.Int)` is
added instead. One must expect that any item that is added to the stack
might change.
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
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
obscuren f94c5473ad core/vm: fixed a bug where `Data` ignored the stack ptr 2015-06-10 21:08:04 +02:00
obscuren fc2a061d51 core/vm: unexported stack again. No longer required 2015-06-10 17:47:36 +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 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 8a22cd5e6c Removed defer/panic. #503 2015-03-27 16:09:57 +01:00
obscuren c32bca45ad Stack limit 2015-03-26 17:45:09 +01:00
obscuren 0330077d76 moved state and vm to core 2015-03-23 16:59:09 +01:00