aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/evm
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2017-01-05 18:52:10 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-01-05 18:52:10 +0800
commitbbc4ea4ae8e8a962deae3d5693d9d4a9376eab88 (patch)
treed4743eaa073d1bc7788f5d4fc3771da37f3cb0b5 /cmd/evm
parent2126d8148806b6d8597d6a1c761080e9dc98d745 (diff)
downloaddexon-bbc4ea4ae8e8a962deae3d5693d9d4a9376eab88.tar
dexon-bbc4ea4ae8e8a962deae3d5693d9d4a9376eab88.tar.gz
dexon-bbc4ea4ae8e8a962deae3d5693d9d4a9376eab88.tar.bz2
dexon-bbc4ea4ae8e8a962deae3d5693d9d4a9376eab88.tar.lz
dexon-bbc4ea4ae8e8a962deae3d5693d9d4a9376eab88.tar.xz
dexon-bbc4ea4ae8e8a962deae3d5693d9d4a9376eab88.tar.zst
dexon-bbc4ea4ae8e8a962deae3d5693d9d4a9376eab88.zip
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.
Diffstat (limited to 'cmd/evm')
-rw-r--r--cmd/evm/main.go21
1 files changed, 9 insertions, 12 deletions
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index 993dd7659..035cf1c54 100644
--- a/cmd/evm/main.go
+++ b/cmd/evm/main.go
@@ -44,14 +44,6 @@ var (
Name: "debug",
Usage: "output full trace logs",
}
- ForceJitFlag = cli.BoolFlag{
- Name: "forcejit",
- Usage: "forces jit compilation",
- }
- DisableJitFlag = cli.BoolFlag{
- Name: "nojit",
- Usage: "disabled jit compilation",
- }
CodeFlag = cli.StringFlag{
Name: "code",
Usage: "EVM code",
@@ -95,6 +87,10 @@ var (
Name: "create",
Usage: "indicates the action should be create rather than call",
}
+ DisableGasMeteringFlag = cli.BoolFlag{
+ Name: "nogasmetering",
+ Usage: "disable gas metering",
+ }
)
func init() {
@@ -102,8 +98,6 @@ func init() {
CreateFlag,
DebugFlag,
VerbosityFlag,
- ForceJitFlag,
- DisableJitFlag,
SysStatFlag,
CodeFlag,
CodeFileFlag,
@@ -112,6 +106,7 @@ func init() {
ValueFlag,
DumpFlag,
InputFlag,
+ DisableGasMeteringFlag,
}
app.Action = run
}
@@ -165,7 +160,8 @@ func run(ctx *cli.Context) error {
GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)),
Value: common.Big(ctx.GlobalString(ValueFlag.Name)),
EVMConfig: vm.Config{
- Tracer: logger,
+ Tracer: logger,
+ DisableGasMetering: ctx.GlobalBool(DisableGasMeteringFlag.Name),
},
})
} else {
@@ -179,7 +175,8 @@ func run(ctx *cli.Context) error {
GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)),
Value: common.Big(ctx.GlobalString(ValueFlag.Name)),
EVMConfig: vm.Config{
- Tracer: logger,
+ Tracer: logger,
+ DisableGasMetering: ctx.GlobalBool(DisableGasMeteringFlag.Name),
},
})
}