|
|
|
@ -205,14 +205,24 @@ func runCmd(ctx *cli.Context) error { |
|
|
|
|
} |
|
|
|
|
tstart := time.Now() |
|
|
|
|
var leftOverGas uint64 |
|
|
|
|
var hexInput []byte |
|
|
|
|
if inputFileFlag := ctx.GlobalString(InputFileFlag.Name); inputFileFlag != "" { |
|
|
|
|
if hexInput, err = ioutil.ReadFile(inputFileFlag); err != nil { |
|
|
|
|
fmt.Printf("could not load input from file: %v\n", err) |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
hexInput = []byte(ctx.GlobalString(InputFlag.Name)) |
|
|
|
|
} |
|
|
|
|
input := common.FromHex(string(bytes.TrimSpace(hexInput))) |
|
|
|
|
if ctx.GlobalBool(CreateFlag.Name) { |
|
|
|
|
input := append(code, common.Hex2Bytes(ctx.GlobalString(InputFlag.Name))...) |
|
|
|
|
input = append(code, input...) |
|
|
|
|
ret, _, leftOverGas, err = runtime.Create(input, &runtimeConfig) |
|
|
|
|
} else { |
|
|
|
|
if len(code) > 0 { |
|
|
|
|
statedb.SetCode(receiver, code) |
|
|
|
|
} |
|
|
|
|
ret, leftOverGas, err = runtime.Call(receiver, common.Hex2Bytes(ctx.GlobalString(InputFlag.Name)), &runtimeConfig) |
|
|
|
|
ret, leftOverGas, err = runtime.Call(receiver, input, &runtimeConfig) |
|
|
|
|
} |
|
|
|
|
execTime := time.Since(tstart) |
|
|
|
|
|
|
|
|
|