forked from TrueCloudLab/neoneo-go
Merge pull request #1708 from nspcc-dev/native/fixname
native: fix `getCommittee` name
This commit is contained in:
commit
b1977ea4e3
2 changed files with 24 additions and 1 deletions
|
@ -2,6 +2,7 @@ package native
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"unicode"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -18,3 +19,25 @@ func TestNativeHashes(t *testing.T) {
|
||||||
// Not yet a part of NEO.
|
// Not yet a part of NEO.
|
||||||
//require.Equal(t, "", newNotary().Hash.StringLE()())
|
//require.Equal(t, "", newNotary().Hash.StringLE()())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "C" and "O" can easily be typed by accident.
|
||||||
|
func TestNamesASCII(t *testing.T) {
|
||||||
|
cs := NewContracts(true)
|
||||||
|
for _, c := range cs.Contracts {
|
||||||
|
require.True(t, isASCII(c.Metadata().Name))
|
||||||
|
for m := range c.Metadata().Methods {
|
||||||
|
require.True(t, isASCII(m.Name))
|
||||||
|
}
|
||||||
|
for _, e := range c.Metadata().Manifest.ABI.Events {
|
||||||
|
require.True(t, isASCII(e.Name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func isASCII(s string) bool {
|
||||||
|
ok := true
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
ok = ok && s[i] <= unicode.MaxASCII
|
||||||
|
}
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ func newNEO() *NEO {
|
||||||
md = newMethodAndPrice(n.getCandidatesCall, 100000000, callflag.ReadStates)
|
md = newMethodAndPrice(n.getCandidatesCall, 100000000, callflag.ReadStates)
|
||||||
n.AddMethod(md, desc)
|
n.AddMethod(md, desc)
|
||||||
|
|
||||||
desc = newDescriptor("getСommittee", smartcontract.ArrayType)
|
desc = newDescriptor("getCommittee", smartcontract.ArrayType)
|
||||||
md = newMethodAndPrice(n.getCommittee, 100000000, callflag.ReadStates)
|
md = newMethodAndPrice(n.getCommittee, 100000000, callflag.ReadStates)
|
||||||
n.AddMethod(md, desc)
|
n.AddMethod(md, desc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue