From 982bdcd70451f76cd4d91bc6ea28fe2ffec49c4c Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 10 Sep 2019 19:22:05 +0300 Subject: [PATCH] vm/cli: make operation mandatory if anything added to `run` Matches neo-cli behavior. --- pkg/vm/cli/cli.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/vm/cli/cli.go b/pkg/vm/cli/cli.go index 78f9fd6df..686fb337d 100644 --- a/pkg/vm/cli/cli.go +++ b/pkg/vm/cli/cli.go @@ -83,13 +83,14 @@ var commands = []*ishell.Cmd{ { Name: "run", Help: "Execute the current loaded script", - LongHelp: `Usage: run [] [...] + LongHelp: `Usage: run [ [...]] is an operation name, passed as a first parameter to Main() (and it can't be 'help' at the moment) is a parameter (can be repeated multiple times) specified as :, where type can be 'int' or 'string' and value is - a value of this type (string is pushed as a byte array value) + a value of this type (string is pushed as a byte array value); passing + parameters without operation is not supported Parameters are packed into array before they're passed to the script. so effectively 'run' only supports contracts with signatures like this: @@ -238,13 +239,9 @@ func handleRun(c *ishell.Context) { method []byte params []vm.StackItem err error - start int ) - if isMethodArg(c.Args[0]) { - method = []byte(c.Args[0]) - start = 1 - } - params, err = parseArgs(c.Args[start:]) + method = []byte(c.Args[0]) + params, err = parseArgs(c.Args[1:]) if err != nil { c.Err(err) return