vm: update neo-vm tests, simplify parsing

We no longer have "*N" notation, see neo-project/neo-vm#326.
This commit is contained in:
Roman Khimov 2020-08-22 22:36:10 +03:00
parent 74097ae8b0
commit 77ea3d361b
2 changed files with 2 additions and 20 deletions

View file

@ -11,8 +11,6 @@ import (
"math/big"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"testing"
@ -330,23 +328,7 @@ func (v *vmUTScript) UnmarshalJSON(data []byte) error {
if b, ok := decodeSingle(ops[i]); ok {
script = append(script, b...)
} else {
const regex = `(?P<hex>(?:0x)?[0-9a-zA-Z]+)\*(?P<num>[0-9]+)`
re := regexp.MustCompile(regex)
ss := re.FindStringSubmatch(ops[i])
if len(ss) != 3 {
return fmt.Errorf("invalid script part: %s", ops[i])
}
b, ok := decodeSingle(ss[1])
if !ok {
return fmt.Errorf("invalid script part: %s", ops[i])
}
num, err := strconv.Atoi(ss[2])
if err != nil {
return fmt.Errorf("invalid script part: %s", ops[i])
}
for i := 0; i < num; i++ {
script = append(script, b...)
}
return fmt.Errorf("invalid script part: %s", ops[i])
}
}

@ -1 +1 @@
Subproject commit 377464ed475a3de108e1bf9c834bd2279b72624e
Subproject commit 8476d0abba10b2efdc94e8d4dc27f5c30c8b66e1