cmd/evm: allow no gas metering

This commit is contained in:
Jeffrey Wilcke 2016-12-05 12:48:25 +01:00
parent 0abf68b533
commit 0ad8aaad00

View file

@ -44,14 +44,6 @@ var (
Name: "debug", Name: "debug",
Usage: "output full trace logs", 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{ CodeFlag = cli.StringFlag{
Name: "code", Name: "code",
Usage: "EVM code", Usage: "EVM code",
@ -95,6 +87,10 @@ var (
Name: "create", Name: "create",
Usage: "indicates the action should be create rather than call", Usage: "indicates the action should be create rather than call",
} }
DisableGasMeteringFlag = cli.BoolFlag{
Name: "nogasmetering",
Usage: "disable gas metering",
}
) )
func init() { func init() {
@ -102,8 +98,6 @@ func init() {
CreateFlag, CreateFlag,
DebugFlag, DebugFlag,
VerbosityFlag, VerbosityFlag,
ForceJitFlag,
DisableJitFlag,
SysStatFlag, SysStatFlag,
CodeFlag, CodeFlag,
CodeFileFlag, CodeFileFlag,
@ -112,6 +106,7 @@ func init() {
ValueFlag, ValueFlag,
DumpFlag, DumpFlag,
InputFlag, InputFlag,
DisableGasMeteringFlag,
} }
app.Action = run app.Action = run
} }
@ -165,7 +160,8 @@ func run(ctx *cli.Context) error {
GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)), GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)),
Value: common.Big(ctx.GlobalString(ValueFlag.Name)), Value: common.Big(ctx.GlobalString(ValueFlag.Name)),
EVMConfig: vm.Config{ EVMConfig: vm.Config{
Tracer: logger, Tracer: logger,
DisableGasMetering: ctx.GlobalBool(DisableGasMeteringFlag.Name),
}, },
}) })
} else { } else {
@ -179,7 +175,8 @@ func run(ctx *cli.Context) error {
GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)), GasPrice: common.Big(ctx.GlobalString(PriceFlag.Name)),
Value: common.Big(ctx.GlobalString(ValueFlag.Name)), Value: common.Big(ctx.GlobalString(ValueFlag.Name)),
EVMConfig: vm.Config{ EVMConfig: vm.Config{
Tracer: logger, Tracer: logger,
DisableGasMetering: ctx.GlobalBool(DisableGasMeteringFlag.Name),
}, },
}) })
} }